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

/* --- CSS Variables (Design System) --- */
:root {
    --bg: #fff;
    --bg-alt: #f5f5f5;
    --bg-hover: #f8f8f8;
    --text: #222;
    --text-secondary: #666;
    --text-muted: #999;
    --accent: #c35;
    --accent-hover: #a22;
    --border: #ddd;
    --border-light: #eee;
    --shadow: rgba(0,0,0,0.08);
    --header-bg: #fff;
    --clock-size: 72px;
    --clock-color: #222;
    --max-width: 1200px;
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-clock: 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
}

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

/* --- Reset & Base --- */
*, *::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);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

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

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

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

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

.header-inner {
    display: flex;
    align-items: center;
    height: 60px;
    gap: 20px;
}

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

.slogan { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.slogan span { color: var(--text-muted); }

#nav { flex: 1; display: flex; justify-content: flex-end; }
#menulinks ul { display: flex; gap: 5px; padding: 0; }
#menulinks ul li { list-style: none; }
#menulinks ul li a {
    display: block;
    padding: 8px 14px;
    font-size: 14px;
    color: var(--text-secondary);
    border: none !important;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}
#menulinks ul li a:hover,
#menulinks ul li.chosen a {
    color: var(--text);
    background: var(--bg-alt);
}

/* Mobile menu button */
#menubutton {
    display: none;
    cursor: pointer;
    padding: 10px;
    margin-right: -10px;
}
#menubutton div {
    width: 22px;
    height: 2px;
    background: var(--text);
    margin: 4px 0;
    transition: 0.3s;
    border-radius: 2px;
}
#menubutton.active div:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
#menubutton.active div:nth-child(2) { opacity: 0; }
#menubutton.active div:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* --- Search --- */
#qbox { position: relative; max-width: 300px; width: 100%; }
#q {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border: 1px solid var(--border);
    border-radius: 20px;
    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>') 12px center no-repeat;
    background-size: 18px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: all 0.3s ease;
}
#q:focus { border-color: var(--accent); background-color: var(--bg); }

/* --- Main Content --- */
main { padding: 30px 0 60px; }

/* --- Clock Display --- */
#clock_section { text-align: center; padding: 30px 0; }

#clock_section .timezone-label { font-size: 14px; color: var(--text-secondary); margin-bottom: 5px; }

#clock_section h1 { font-size: 18px; font-weight: 400; color: var(--text-secondary); margin-bottom: 10px; }

#clock0_bg {
    display: inline-block;
    cursor: pointer;
    margin: 10px 0;
}

#clock {
    font-family: var(--font-clock);
    font-size: var(--clock-size);
    font-weight: 900;
    color: var(--clock-color);
    line-height: 1.1;
    letter-spacing: 2px;
}

#ampm {
    font-size: 21px !important;
    line-height: 21px;
    vertical-align: super;
    font-weight: 400;
}

#daydiv {
    font-size: 20px;
    color: var(--text-secondary);
    margin: 10px 0 20px;
}

#sun {
    margin: 15px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
}
#sun a { border: none; font-size: 13px; }

#sun .sun-icon {
    display: inline-block;
    font-size: 32px;
    margin-bottom: 10px;
}

/* --- World Cities --- */
.top_cities_cloud {
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid var(--border-light);
    margin-top: 20px;
}

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

.top_cities_cloud a {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
}
.top_cities_cloud a:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--bg-hover);
}
.top_cities_cloud a .time { color: var(--text-muted); margin-left: 4px; }

/* --- Timezone Cloud --- */
.cloud {
    padding: 20px 0;
    text-align: center;
}
.cloud .tr {
    display: inline-block;
    margin: 3px;
}
.cloud .tr a {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    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 Section --- */
#quote {
    text-align: center;
    padding: 30px 20px;
    background: var(--bg-alt);
    border-radius: 12px;
    margin: 20px 0;
}
#quote blockquote {
    font-size: 18px;
    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 Section --- */
.ad-container {
    text-align: center;
    padding: 20px 0;
    min-height: 90px;
}
.ad-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* --- Ad-free prompt --- */
.adfree-prompt {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--bg-alt), var(--bg));
    border: 1px solid var(--border);
}
.adfree-prompt h2 { font-size: 20px; margin-bottom: 8px; }
.adfree-prompt p { color: var(--text-secondary); font-size: 14px; }
.adfree-prompt .btn { margin-top: 12px; 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: var(--bg-alt);
    border-top: 1px solid var(--border-light);
    padding: 40px 0 20px;
    margin-top: 40px;
}

.footer-inner nav {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 30px;
}

.footer-col { min-width: 160px; }
.footer-col h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.footer-col ul li { margin-bottom: 6px; }
.footer-col ul li a {
    font-size: 13px;
    color: var(--text-secondary);
    border: none !important;
}
.footer-col ul li a:hover { color: var(--accent); }

#footer .description {
    font-size: 13px;
    color: var(--text-muted);
    padding: 15px 0;
    border-top: 1px solid var(--border-light);
    margin-bottom: 15px;
}

#footerlangs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px 0;
    border-top: 1px solid var(--border-light);
}
#footerlangs a {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all 0.2s;
}
#footerlangs a:hover { border-color: var(--accent); color: var(--text); }

.copyright {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

/* --- Customizer / Theme toggle --- */
#customizer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}
#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;
}
#theme-toggle:hover { box-shadow: 0 4px 20px var(--shadow); transform: scale(1.05); }

/* --- Notifications --- */
#msgdiv {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 200;
    max-width: 360px;
}
#msgs {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 20px var(--shadow);
    display: none;
}
#msgs.show { display: block; }
#popmsg-close-btn {
    float: right;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    border: none !important;
}

/* --- Search Suggestions --- */
.susdiv {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px var(--shadow);
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}
.susdiv.show { display: block; }
.susdiv a {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text);
    border: none !important;
    transition: background 0.2s;
}
.susdiv a:hover { background: var(--bg-alt); color: var(--accent); }
.susdiv a span { display: block; font-size: 12px; color: var(--text-muted); }

/* --- Error Page --- */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 48px; margin-bottom: 20px; }
.error-page p { font-size: 18px; color: var(--text-secondary); margin-bottom: 30px; }
.error-page .btn { margin-top: 20px; }

/* --- Responsive --- */
@media (max-width: 1024px) {
    #menulinks ul li a { padding: 8px 10px; font-size: 13px; }
}

@media (max-width: 768px) {
    :root { --clock-size: 48px; }

    .slogan { display: none; }

    #menubutton { display: block; }

    #menulinks {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 20px var(--shadow);
        padding: 10px 20px;
    }
    #menulinks.open { display: block; }
    #menulinks ul { flex-direction: column; gap: 0; }
    #menulinks ul li a { padding: 12px 0; border-bottom: 1px solid var(--border-light); border-radius: 0; }
    #menulinks ul li:last-child a { border-bottom: none; }

    #qbox { max-width: 100%; }
    #clock_section h1 { font-size: 15px; }
    .footer-inner nav { gap: 20px; flex-direction: column; }
    .top_cities_cloud a { font-size: 13px; padding: 5px 10px; }
}

@media (max-width: 480px) {
    :root { --clock-size: 36px; }
    #ampm { font-size: 16px !important; }
    #daydiv { font-size: 16px; }
    .header-inner { gap: 10px; }
    #q { padding: 6px 12px 6px 36px; background-size: 16px; background-position: 10px center; }
}

/* --- Print --- */
@media print {
    #header, #footer, #customizer, .ad-container, .adfree-prompt { display: none; }
    #clock { color: #000 !important; }
}
