/* ===========================
   timerok.ru — Premium Styles
   =========================== */

:root {
    --bg: #030712;
    --bg2: #0f172a;
    --bg3: #1e293b;
    --surface: rgba(15, 23, 42, 0.8);
    --surface2: rgba(30, 41, 59, 0.7);
    --border: rgba(14, 165, 233, 0.2);
    --border2: rgba(14, 165, 233, 0.08);
    --accent: #0ea5e9;
    --accent2: #38bdf8;
    --accent3: #7dd3fc;
    --glow: rgba(14, 165, 233, 0.4);
    --text: #f1f5f9;
    --text2: #94a3b8;
    --text3: #64748b;
    --clock-color: #e0f2fe;
    --clock-glow: rgba(14, 165, 233, 0.6);
    --green: #10b981;
    --red: #f43f5e;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0,0,0,0.5);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #f0f9ff;
    --bg2: #e0f2fe;
    --bg3: #bae6fd;
    --surface: rgba(255, 255, 255, 0.85);
    --surface2: rgba(240, 249, 255, 0.9);
    --border: rgba(14, 165, 233, 0.3);
    --border2: rgba(14, 165, 233, 0.12);
    --accent: #0284c7;
    --accent2: #0369a1;
    --accent3: #0ea5e9;
    --glow: rgba(14, 165, 233, 0.2);
    --text: #0f172a;
    --text2: #334155;
    --text3: #64748b;
    --clock-color: #0c4a6e;
    --clock-glow: rgba(2, 132, 199, 0.4);
    --shadow: 0 8px 32px rgba(0,0,0,0.12);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
}

/* Background gradient */
.bg-gradient {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 0%, rgba(14, 165, 233, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(56, 189, 248, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="light"] .bg-gradient {
    background:
        radial-gradient(ellipse 80% 50% at 20% 0%, rgba(14, 165, 233, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(2, 132, 199, 0.08) 0%, transparent 50%);
}

/* ===== HEADER ===== */
header {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.logo-icon { font-size: 1.6rem; }

.logo-dot { color: var(--accent); }

.theme-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px; height: 44px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
    backdrop-filter: blur(12px);
}

.theme-btn:hover {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 16px var(--glow);
    transform: scale(1.1);
}

.site-title {
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 600;
    color: var(--text2);
    letter-spacing: 0.02em;
    margin-bottom: 24px;
}

/* ===== CLOCK ===== */
.clock-container {
    margin: 0 auto 16px;
    max-width: 700px;
}

.clock-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(4rem, 14vw, 9rem);
    font-weight: 700;
    color: var(--clock-color);
    letter-spacing: 0.05em;
    line-height: 1;
    text-shadow:
        0 0 30px var(--clock-glow),
        0 0 60px var(--clock-glow),
        0 0 100px rgba(14, 165, 233, 0.2);
    transition: color var(--transition);
    animation: clockPulse 1s ease-in-out infinite;
}

@keyframes clockPulse {
    0%, 100% { opacity: 1; }
    45%, 55% { opacity: 0.92; }
}

.clock-seconds-bar {
    width: 100%;
    height: 3px;
    background: var(--border2);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.seconds-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 2px;
    width: 0%;
    transition: width 1s linear;
    box-shadow: 0 0 8px var(--glow);
}

.date-display {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--text2);
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ===== SYNC STATUS ===== */
.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text3);
    margin-bottom: 20px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    backdrop-filter: blur(8px);
}

.sync-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text3);
    transition: background var(--transition);
    flex-shrink: 0;
}

.sync-dot.synced {
    background: var(--green);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
    animation: pulse 2s infinite;
}

.sync-dot.error { background: var(--red); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
    50% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.9); }
}

/* ===== CURRENCY BAR ===== */
.currency-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-width: 600px;
    margin: 0 auto;
    backdrop-filter: blur(12px);
    font-size: 0.9rem;
}

.currency-label { color: var(--text3); font-size: 0.8rem; }

.currency-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.currency-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent2);
    font-size: 0.85rem;
}

.currency-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.currency-divider {
    width: 1px;
    height: 30px;
    background: var(--border);
}

.currency-loading { color: var(--text3); font-size: 0.85rem; }

/* ===== MAIN CONTENT ===== */
main {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* ===== SECTION ===== */
.section {
    margin-bottom: 48px;
}

.section-title {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border2);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== WORLD/RUSSIA TIME GRID ===== */
.time-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.time-grid li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(12px);
    transition: all var(--transition);
    cursor: default;
}

.time-grid li:hover {
    border-color: var(--accent);
    background: var(--surface2);
    box-shadow: 0 0 16px var(--glow);
    transform: translateY(-1px);
}

.city-name {
    font-size: 0.9rem;
    color: var(--text2);
    font-weight: 500;
}

.city-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent2);
    letter-spacing: 0.05em;
}

.city-offset {
    font-size: 0.7rem;
    color: var(--text3);
    margin-top: 2px;
}

/* ===== COUNTRIES GRID ===== */
.countries-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px;
}

.countries-grid li {
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(8px);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.countries-grid li:hover {
    border-color: var(--accent);
    background: var(--surface2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}

.country-flag { font-size: 1.2rem; }

.country-name {
    font-size: 0.82rem;
    color: var(--text2);
    font-weight: 500;
    line-height: 1.3;
}

.country-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent3);
    margin-top: 2px;
    font-weight: 600;
}

/* ===== INFO SECTION ===== */
.info-section {
    margin-bottom: 48px;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(12px);
    line-height: 1.8;
    color: var(--text2);
}

.info-card p + p { margin-top: 12px; }

.info-card strong { color: var(--accent2); }

/* ===== FOOTER ===== */
footer {
    position: relative;
    z-index: 1;
    background: var(--surface);
    border-top: 1px solid var(--border2);
    padding: 40px 20px 24px;
    backdrop-filter: blur(12px);
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.footer-col { display: flex; flex-direction: column; gap: 10px; }

.footer-heading {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text3);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border2);
}

.footer-col p { font-size: 0.85rem; color: var(--text3); line-height: 1.7; }

.footer-col a {
    font-size: 0.875rem;
    color: var(--text2);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-col a:hover { color: var(--accent2); }

.footer-copy {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text3);
    padding-top: 16px;
    border-top: 1px solid var(--border2);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: var(--bg3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    header { padding: 16px 16px 32px; }
    .clock-display { font-size: 4rem; }
    .time-grid { grid-template-columns: 1fr; }
    .countries-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .currency-bar { gap: 12px; padding: 10px 16px; }
}

@media (max-width: 380px) {
    .clock-display { font-size: 3.2rem; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

header { animation: fadeIn 0.6s ease both; }
.section { animation: fadeIn 0.6s ease both; }
.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.2s; }
.section:nth-child(4) { animation-delay: 0.3s; }

/* ===== SEARCH COMPONENT ===== */
.search-container {
    position: relative;
    max-width: 580px;
    margin: 28px auto 0;
    width: 100%;
    z-index: 100;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 10px 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent2);
    box-shadow: 0 0 24px var(--glow);
}

.search-icon {
    font-size: 1.15rem;
    opacity: 0.8;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: var(--text);
    font-family: inherit;
}

.search-input::placeholder {
    color: var(--text3);
}

.search-clear {
    background: transparent;
    border: none;
    color: var(--text3);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.search-clear:hover {
    color: var(--text);
    background: rgba(255,255,255,0.1);
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0,0,0,0.6);
    max-height: 420px;
    overflow-y: auto;
    z-index: 101;
    display: flex;
    flex-direction: column;
}

.search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border2);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover, .search-item.active {
    background: rgba(14, 165, 233, 0.15);
}

.search-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-item-flag {
    font-size: 1.4rem;
}

.search-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.search-item-sub {
    font-size: 0.78rem;
    color: var(--text3);
    margin-top: 2px;
}

.search-item-time-box {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.search-item-time {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent2);
}

.search-item-diff {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent3);
}

.search-empty {
    padding: 24px;
    text-align: center;
    color: var(--text3);
    font-size: 0.9rem;
}

/* ===== MODAL COMPONENT ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
    animation: fadeIn 0.25s ease both;
}

.modal-card {
    background: var(--surface);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid var(--border);
    border-radius: 24px;
    max-width: 520px;
    width: 100%;
    padding: 32px;
    position: relative;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), 0 0 32px var(--glow);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text2);
    font-size: 1.1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text);
    transform: rotate(90deg);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.modal-flag {
    font-size: 2.8rem;
}

.modal-city-name {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
}

.modal-country-name {
    font-size: 0.95rem;
    color: var(--text2);
    margin-top: 2px;
}

.modal-clock-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
}

.modal-clock-digits {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--clock-color);
    text-shadow: 0 0 28px var(--clock-glow);
    letter-spacing: -0.02em;
}

.modal-date-text {
    font-size: 0.95rem;
    color: var(--text2);
    margin-top: 8px;
}

.modal-diff-tag {
    display: inline-block;
    margin-top: 12px;
    padding: 4px 14px;
    border-radius: 9999px;
    background: rgba(14, 165, 233, 0.2);
    color: var(--accent2);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.modal-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.modal-stat {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-stat-label {
    font-size: 0.75rem;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.modal-stat-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

