/* ============================================================
   World-Time.org - Main Stylesheet
   Inspired by Time.is - exact time, any time zone
   ============================================================ */

:root {
    --bg: #fff;
    --bg-alt: #f5f5f5;
    --bg-hover: #f8f8f8;
    --text: #000;
    --text-secondary: #666;
    --text-muted: #999;
    --accent: #c35;
    --accent-hover: #e57;
    --border: #ddd;
    --border-light: #eee;
    --shadow: rgba(0,0,0,0.08);
    --header-bg: #fff;
    --clock-size: clamp(80px, 23vw, 200px);
    --clock-color: #000;
    --clock-font: 'Montserrat', 'Arial Black', 'Arial-BoldMT', 'Arial Bold', Arial, Helvetica, sans-serif;
    --font-main: 'Montserrat', 'Arial Black', 'Arial-BoldMT', 'Arial Bold', Arial, Helvetica, sans-serif;
    --max-width: 1200px;
}

body.dark {
    --bg: #000;
    --bg-alt: #111;
    --bg-hover: #222;
    --text: #fff;
    --text-secondary: #ccc;
    --text-muted: #777;
    --border: #333;
    --border-light: #222;
    --header-bg: #000;
    --clock-color: #fff;
    --shadow: rgba(255,255,255,0.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-main);
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; text-decoration: none; }
a:link, a:visited { border-bottom: 1px solid transparent; color: inherit; }
a:hover { color: var(--text); border-color: var(--accent); }

img { max-width: 100%; height: auto; }
ul { list-style: none; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ===== HEADER ===== */
#header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 20px;
    gap: 16px;
    max-width: var(--max-width);
    margin: 0 auto;
}

.logo {
    font-size: 20px;
    font-weight: 900;
    color: var(--accent) !important;
    border: none !important;
    white-space: nowrap;
}
.logo:hover { color: var(--accent) !important; }

.slogan { font-size: 13px; color: var(--text-muted); font-weight: 400; }
@media (max-width: 768px) { .slogan { display: none; } }

#qbox { flex: 1; max-width: 240px; position: relative; }
#q {
    width: 100%;
    padding: 6px 12px 6px 34px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-alt) url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>') 8px center no-repeat;
    background-size: 16px;
    font-size: 13px;
    color: var(--text);
    outline: none;
}
#q:focus { border-color: var(--accent); background-color: var(--bg); }

#top_right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

#menubutton {
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
#menubutton div {
    width: 20px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    transition: 0.3s;
}
#menubutton:hover div { background: var(--text); }

#user a { display: flex; align-items: center; border: none !important; color: var(--text-muted); }
#user a:hover { color: var(--accent); }
#user svg { fill: none; }

/* Fullscreen button */
#fullscreen-btn { cursor: pointer; padding: 6px; display: flex; align-items: center; color: var(--text-muted); }
#fullscreen-btn:hover { color: var(--accent); }
#fullscreen-btn svg { display: block; }

/* ===== SIDEBAR MENU ===== */
#navbg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
#navbg.open { opacity: 1; visibility: visible; }

#nav {
    position: fixed;
    top: 0; left: -320px;
    width: 300px;
    height: 100%;
    z-index: 201;
    transition: left 0.3s ease;
    background: #eee;
    overflow-y: auto;
    box-shadow: 2px 0 20px var(--shadow);
}
body.dark #nav { background: #1a1a1a; }
#nav.open { left: 0; }

#close-menu {
    text-align: right;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
}
#close-menu a { border: none !important; color: var(--text-muted); font-size: 28px; display: inline-block; }
#close-menu a:hover { color: var(--text); }

#menulinks ul { padding: 8px 0; }
#menulinks ul li { list-style: none; }
#menulinks ul li a {
    display: block;
    padding: 10px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    border: none !important;
    transition: background 0.2s, color 0.2s;
}
#menulinks ul li a:hover {
    background: var(--bg-hover);
    color: var(--text);
}
#menulinks ul li.chosen a { color: var(--text); font-weight: 700; }

/* ===== MAIN ===== */
main { padding: 0 0 40px; }

/* Fullscreen clock mode */
main.fs {
    background: var(--bg);
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    padding: 40px; margin: 0; max-width: 100%;
    overflow-y: auto;
}
main.fs #clock_section { padding: 10px 0; max-width: 100%; width: 100%; }
main.fs #clock_section h1 { display: none; }
main.fs #clock_section .timezone-label { text-align: center; }
main.fs #clock { --clock-size: clamp(80px, 23vw, 300px); }
main.fs #ampm { font-size: min(48px, 6vw) !important; }
main.fs #daydiv { font-size: min(28px, 3vw); }
main.fs .sync-status { display: none; }
main.fs .ad-container,
main.fs .adfree-prompt,
main.fs #quote,
main.fs section[style] { display: none; }
main.fs .city-description,
main.fs .city-dst-note,
main.fs .related-section { display: none; }
main.fs .top_cities_cloud { border-top: none; margin-top: 8px; }
main.fs .top_cities_cloud .city-block .city-time { font-size: 22px; }
main.fs .top_cities_cloud .city-block .city-name { font-size: 16px; }
main.fs .cloud { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
main.fs .cloud .tr a { font-size: 15px; padding: 6px 14px; }

/* ===== CLOCK ===== */
#clock_section { text-align: center; padding: 5px 0 5px; }

#clock_section .timezone-label { font-size: 16px; color: var(--text-muted); margin-bottom: 4px; text-align: center; }

#clock_section h1 { display: none; }

/* ===== SYNC STATUS (like time.is) ===== */
.sync-status {
    text-align: center;
    padding: 6px 20px;
    font-size: 14px;
    color: #589;
    background: var(--bg);
}
.sync-status #syncDtl { padding: 4px 0;text-align: left; }
.sync-status #syncH { font-weight: 400; }
.sync-status #syncDtlDetail { color: var(--text-muted); font-size: 13px; }

#clock0_bg { display: block; cursor: pointer; margin: 0; text-align: center; width: 100%; }

#clock {
    font-family: var(--clock-font);
    font-size: var(--clock-size);
    font-weight: 900;
    color: var(--clock-color);
    line-height: 1.0;
    letter-spacing: 4px;
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: baseline;
    white-space: nowrap;
    text-align: center;
}

#clock_display { display: inline-block; text-align: center; min-width: 3.2em; }

#ampm {
    font-size: min(36px, 5vw) !important;
    line-height: 1;
    font-weight: 400;
    margin-left: 8px;
}

#daydiv { font-size: 20px; color: var(--text-muted); margin: 4px 0 6px; font-weight: 400; }

#weekdiv { color: var(--text-muted); }

#sun {
    margin: 4px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
}
#sun a { border: none; font-size: 13px; }
#sun a:hover { color: var(--accent); }
#sun .sun-icon { display: inline-block; font-size: 18px; margin-bottom: 2px; }
#sunrise-info, #sunset-info { margin: 0 4px; }
#daylen-info { color: var(--text-muted); }

/* ===== WORLD CITIES (city-block: name above, time below, fully clickable) ===== */
.top_cities_cloud {
    padding: 15px 0;
    text-align: center;
    border-top: 1px solid var(--border-light);
    margin-top: 10px;
}

.top_cities_cloud .city-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 6px;
}

.city-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 20px 5px;
    border: 1px solid var(--border);
    border-bottom: 1px solid var(--border) !important;
    border-radius: 4px;
    transition: all 0.2s;
    text-decoration: none !important;
    min-width: 0;
    box-sizing: border-box;
}
.city-block:hover { border-color: var(--accent); border-bottom-color: var(--accent) !important; background: var(--bg-hover); text-decoration: none; }
.city-block .city-name { font-size: 14px; color: var(--text-secondary); }
.city-block:hover .city-name { color: var(--accent); }
.city-block .city-time { font-size: 18px; font-weight: 700; color: var(--text); margin-top: 2px; }
.city-block:hover .city-time { color: var(--text); }
.top_cities_cloud a.more-link {
    display: inline-flex; align-items: center;
    padding: 6px 16px;
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
}

/* ===== TIMEZONE CLOUD ===== */
.cloud { padding: 15px 0; text-align: center; }
.cloud .tr { display: inline-block; margin: 3px; }
.cloud .tr a {
    display: inline-block;
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.cloud .tr a:hover { border-color: var(--accent); color: var(--text); background: var(--bg-hover); }

/* ===== QUOTE ===== */
#quote {
    text-align: center; padding: 30px 20px;
    background: var(--bg-alt); border-radius: 8px; margin: 20px 0;
}
#quote blockquote { font-size: 17px; font-style: italic; color: var(--text-secondary); line-height: 1.6; }
#quote blockquote footer { margin-top: 10px; font-size: 14px; font-style: normal; color: var(--text-muted); }

/* ===== AD ===== */
.ad-container { text-align: center; padding: 15px 0; min-height: 60px; }
.ad-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }

/* ===== AD-FREE ===== */
.adfree-prompt {
    text-align: center; padding: 30px 20px; margin: 20px auto; border-radius: 8px;
    background: linear-gradient(135deg, var(--bg-alt), var(--bg));
    border: 1px solid var(--border);
    max-width: 600px;
    width: calc(100% - 40px);
    box-sizing: border-box;
}
.adfree-prompt h2 { font-size: 20px; margin-bottom: 10px; text-align: center; }
.adfree-prompt p { color: var(--text-secondary); font-size: 14px; text-align: center; }
.adfree-prompt .btn { margin-top: 14px; display: inline-block; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-block; padding: 10px 24px;
    background: var(--accent); color: #fff !important;
    border: none; border-radius: 6px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
    text-decoration: none !important;
}
.btn:hover { background: var(--accent-hover); }

/* ===== FOOTER ===== */
#footer { background: #333; padding: 40px 0 20px; margin-top: 40px; width: 100%; clear: both; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 30px; margin-bottom: 20px; }
.footer-col { min-width: 140px; }
.footer-col h4 { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: #fff; }
.footer-col ul li { margin-bottom: 6px; }
.footer-col ul li a { font-size: 13px; color: #999 !important; border: none !important; }
.footer-col ul li a:hover { color: #fff !important; }
#footer .description { font-size: 13px; color: #999; padding: 15px 0; border-top: 1px solid #444; margin-bottom: 15px; }
#footerlangs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0; border-top: 1px solid #444; direction: ltr; }
#footerlangs a { font-size: 12px; color: #999; padding: 4px 8px; border: 1px solid #555; border-radius: 4px; transition: all 0.2s; }
#footerlangs a:hover { border-color: var(--accent); color: #fff; }
.copyright { font-size: 12px; color: #999; text-align: center; padding-top: 15px; border-top: 1px solid #444; }

/* ===== THEME TOGGLE ===== */
#customizer { position: fixed; bottom: 20px; right: 20px; z-index: 99; }
#theme-toggle {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg); border: 1px solid var(--border);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 20px; box-shadow: 0 2px 12px var(--shadow); transition: all 0.3s;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1280px) {
    :root { --clock-size: clamp(80px, 22vw, 200px); }
}
@media (max-width: 1024px) {
    :root { --clock-size: clamp(70px, 20vw, 180px); }
}
@media (max-width: 768px) {
    :root { --clock-size: clamp(60px, 18vw, 140px); }
    #ampm { font-size: min(22px, 4vw) !important; }
    #qbox { max-width: 140px; }
    #q { font-size: 12px; }
    #clock_section .timezone-label { font-size: 14px; }
}
@media (max-width: 480px) {
    :root { --clock-size: clamp(50px, 16vw, 100px); }
    #ampm { font-size: min(16px, 3.5vw) !important; }
    #daydiv { font-size: 15px; }
    .city-block .city-time { font-size: 14px; }
}
@media print {
    #header, #footer, #customizer, .ad-container, .adfree-prompt, #nav, #navbg { display: none; }
    #clock { color: #000 !important; }
}

/* ===== City Description (timezone page SEO content) ===== */
.city-description { margin: 18px auto; }
.city-description-body { background: var(--bg-alt); border-radius: 10px; padding: 18px 22px; line-height: 1.65; font-size: 13.5px; color: var(--text); border: 1px solid var(--border-light); }
.city-description-body p { margin: 0 0 12px; }
.city-description-body p:last-child { margin-bottom: 0; }
.city-description-body strong { color: var(--accent); }
.city-dst-note { margin-top: 10px; padding: 10px 16px; background: var(--bg-alt); border-left: 3px solid #f5a623; border-radius: 6px; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); border-top: 1px solid var(--border-light); border-right: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); }
body.dark .city-dst-note { background: var(--bg-alt); border-left-color: #f5a623; }
body.dark .city-description-body { border-color: var(--border); }

/* ===== Related Content Section (city page bottom) ===== */
.related-section { margin: 22px auto 8px; padding-top: 4px; }
.related-heading { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text-muted); letter-spacing: .5px; text-transform: uppercase; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.related-card { background: var(--bg-alt); border-radius: 8px; border: 1px solid var(--border-light); transition: all .2s ease; }
.related-card:hover { border-color: var(--accent); background: var(--bg-hover); transform: translateY(-1px); box-shadow: 0 3px 10px var(--shadow); }
.related-card a { display: flex; flex-direction: column; padding: 12px 14px; text-decoration: none; height: 100%; }
.ri-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.ri-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.35; }
@media (max-width: 768px) { .related-grid { grid-template-columns: repeat(2, 1fr); } .city-description-body { padding: 14px 16px; } }
@media (max-width: 480px) { .related-grid { grid-template-columns: 1fr; } }
