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

:root {
    /* Dark Mode (Default) */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --border-color: #334155;
    --card-bg: rgba(30, 41, 59, 0.5);
    --card-hover: rgba(30, 41, 59, 0.7);
    --header-bg: rgba(15, 23, 42, 0.5);
    --input-bg: #334155;
    --modal-bg: #1e293b;
    --btn-secondary-bg: rgba(71, 85, 105, 0.5);
    --btn-secondary-hover: rgba(71, 85, 105, 0.7);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

.light-mode {
    /* Light Mode */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --border-color: #e2e8f0;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-hover: rgba(255, 255, 255, 0.9);
    --header-bg: rgba(255, 255, 255, 0.8);
    --input-bg: #f8fafc;
    --modal-bg: #ffffff;
    --btn-secondary-bg: #e2e8f0;
    --btn-secondary-hover: #cbd5e1;
    --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(99, 102, 241, 0.1));
    padding: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1);
}

.icon-globe {
    color: var(--accent-color);
    filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.3));
    transition: transform 0.3s ease;
}

.logo:hover .icon-globe {
    transform: rotate(15deg) scale(1.1);
}

/* Old header styles removed */

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), #6366f1);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.5);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.6);
    filter: brightness(1.1);
}

.btn-full {
    width: 100%;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: var(--text-secondary);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Main */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.clocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Clock Card */
.clock-card {
    background-color: rgba(30, 41, 59, 0.7);
    /* Glassmorphism base */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    gap: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s ease, border-color 0.3s ease;
}

.light-mode .clock-card {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.clock-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.clock-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.clock-title {
    flex: 1;
}

.clock-title h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.clock-title p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.clock-display {
    margin-bottom: 1rem;
}

.digital-clock {
    text-align: center;
}

.time-24 {
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.time-12 {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.analog-clock {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

.clock-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.clock-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.time-of-day {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(71, 85, 105, 0.2);
    border-radius: 0.375rem;
}

.time-of-day svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.time-of-day svg line,
.time-of-day svg path,
.time-of-day svg circle,
.time-of-day svg polyline {
    stroke: currentColor;
}

.time-of-day.morning svg {
    color: #facc15;
}

.time-of-day.afternoon svg {
    color: #fb923c;
}

.time-of-day.evening svg {
    color: #a78bfa;
}

.time-of-day.night svg {
    color: #60a5fa;
}

.time-of-day span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.badge {
    background: rgba(71, 85, 105, 0.5);
    color: #cbd5e1;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    border: 1px solid #475569;
}

.clock-toggle {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 5rem 0;
    display: none;
}

.empty-state.visible {
    display: block;
}

.empty-state svg {
    color: #475569;
    margin-bottom: 1rem;
}

.empty-state h2 {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

.footer .container {
    padding: 1.5rem 1rem;
    text-align: center;
}

.footer p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease, border-color 0.3s ease;
}

.light-mode .modal-content {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.light-mode .modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.light-mode .modal-close {
    background: rgba(0, 0, 0, 0.05);
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.input,
.select {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.light-mode .input,
.light-mode .select {
    background: rgba(255, 255, 255, 0.5);
}

.input::placeholder {
    color: var(--text-secondary);
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: var(--bg-primary);
}

.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .clocks-grid {
        grid-template-columns: 1fr;
    }
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Time Travel Slider */
.time-travel-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-right: 1.5rem;
    min-width: 200px;
}

.time-travel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.time-travel-controls label {
    font-weight: 500;
}

#timeOffsetLabel {
    font-family: monospace;
    color: var(--accent-color);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.btn-text:hover {
    color: var(--text-primary);
    background: var(--btn-secondary-bg);
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    transition: transform 0.1s;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

@media (max-width: 768px) {
    .time-travel-container {
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }
}

/* Weather Styles */
.weather-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.weather-icon {
    width: 24px;
    height: 24px;
}

.weather-temp {
    font-weight: 600;
    color: var(--text-primary);
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.help-text a {
    color: var(--accent-color);
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

.header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.header .subtitle {
    margin: 0.5rem 0 0;
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 400;
}

.weather-error {
    color: var(--danger-color);
    font-size: 0.75rem;
    font-style: italic;
}

.weather-loading {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-style: italic;
}

/* Search Suggestions */
.form-group {
    position: relative;
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    list-style: none;
    margin-top: 0.25rem;
    padding: 0;
}

.suggestions-list li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.suggestions-list li:last-child {
    border-bottom: none;
}

.suggestions-list li:hover {
    background-color: var(--bg-secondary);
}

.suggestions-list li.no-results {
    color: var(--text-secondary);
    cursor: default;
    font-style: italic;
}

.suggestions-list li.no-results:hover {
    background-color: transparent;
}

/* Comparison / Sub-timezones */
.comparison-section {
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comparison-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.comparison-toggle-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
}

.comparison-toggle-btn:hover {
    text-decoration: underline;
}

.comparison-reset-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
}

.comparison-reset-btn:hover {
    text-decoration: underline;
}

.comparison-search-container {
    position: relative;
    margin-bottom: 0.5rem;
}

.comparison-search-input {
    width: 100%;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.comparison-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 10;
    list-style: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.comparison-suggestions li {
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.comparison-suggestions li:hover {
    background: var(--bg-secondary);
}

.sub-timezone-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sub-timezone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

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

.sub-tz-info {
    display: flex;
    flex-direction: column;
}

.sub-tz-label {
    font-weight: 500;
}

.sub-tz-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sub-tz-time {
    font-family: monospace;
    font-size: 0.9rem;
    margin-right: 8px;
}

.sub-tz-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    opacity: 0.6;
    padding: 0 4px;
}

.sub-tz-remove:hover {
    opacity: 1;
}