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

/* CSS Variables for Theming */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-dark: #333;
    --text-light: #666;
    --border-radius: 15px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    --transition-slow: all 0.5s ease;
}

body.dark-mode {
    --card-bg: rgba(40, 40, 50, 0.95);
    --text-dark: #e0e0e0;
    --text-light: #b0b0b0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    min-height: 100vh;
    padding: 0;
    color: var(--text-dark);
    transition: background 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

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

/* Global Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
    }
}

/* Navigation Bar */
.navbar {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.6s ease;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-title {
    font-size: 1.8em;
    color: white;
    font-weight: 700;
    margin: 0;
}

.nav-controls {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.nav-btn:active {
    transform: scale(0.95);
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    animation: slideDown 0.6s ease;
}

header h2 {
    font-size: 1.8em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header-time {
    font-size: 1.3em;
    opacity: 0.9;
    font-weight: 300;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
    animation: slideUp 0.6s ease 0.1s both;
}

.search-section {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    pointer-events: none;
}

.search-box {
    width: 100%;
    padding: 15px 20px 15px 50px;
    font-size: 1em;
    border: none;
    border-radius: var(--border-radius);
    background: var(--card-bg);
    box-shadow: var(--shadow);
    transition: var(--transition);
    color: var(--text-dark);
}

.search-box:focus {
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    animation: slideUp 0.6s ease 0.2s both;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    background: white;
    color: var(--primary-color);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-full {
    width: 100%;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    animation: slideUp 0.6s ease 0.3s both;
}

.stat-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 15px 25px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: 700;
}

/* Cities Grid */
.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    animation: fadeIn 0.6s ease 0.4s both;
}

.city-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.city-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.city-card:hover::before {
    left: 100%;
}

.city-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.city-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.city-name {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-dark);
}

.remove-btn {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    color: #999;
    transition: var(--transition);
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    color: #e74c3c;
    transform: scale(1.2) rotate(90deg);
}

.city-time {
    font-size: 2.8em;
    font-weight: 300;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.city-timezone {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 10px;
}

.city-date {
    color: var(--text-light);
    font-size: 0.85em;
    margin-bottom: 15px;
}

.time-period {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 10px;
}

.time-period.day {
    background: linear-gradient(135deg, #ffd89b, #19547b);
    color: white;
}

.time-period.night {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    padding: 35px;
    border-radius: var(--border-radius);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 450px;
    position: relative;
    animation: slideUp 0.3s ease;
}

.modal-content h2 {
    margin-bottom: 10px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-hint {
    color: var(--text-light);
    font-size: 0.9em;
    margin-bottom: 15px;
}

.modal-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: var(--transition);
    color: var(--text-dark);
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: var(--transition);
    background: none;
    border: none;
}

.close:hover {
    color: var(--text-dark);
    transform: rotate(90deg);
}

/* Suggestions */
.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: var(--transition);
    text-align: center;
}

.suggestion-item:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Settings */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: var(--transition);
}

.setting-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    header h2 {
        font-size: 1.3em;
    }

    .nav-title {
        font-size: 1.3em;
    }

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

    .controls {
        flex-direction: column;
    }

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

    .city-time {
        font-size: 2em;
    }

    .modal-content {
        width: 95%;
        padding: 25px;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: white;
    grid-column: 1 / -1;
}

.empty-state h2 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.empty-state p {
    opacity: 0.8;
    margin-bottom: 20px;
}

/* Footer Styles */
.footer {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    margin-top: 60px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.6s ease;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 50px 20px 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.footer-section h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #667eea;
}

.footer-section h4 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.footer-section ul li:hover {
    color: #667eea;
    transform: translateX(5px);
}

.footer-section a {
    color: #667eea;
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.footer-info {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 15px;
}

.footer-bottom {
    text-align: center;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85em;
}

.footer-bottom a {
    color: #667eea;
    text-decoration: none;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    background: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #4caf50;
    color: white;
}

.toast-error {
    background: #f44336;
    color: white;
}

.toast-warning {
    background: #ff9800;
    color: white;
}

.toast-info {
    background: #2196F3;
    color: white;
}

@media (max-width: 768px) {
    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: none;
    }
}

/* ========== SORT MENU ========== */
.sort-menu {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sort-btn {
    padding: 8px 12px;
    font-size: 0.9em;
    border-radius: 6px;
    border: 2px solid transparent;
    background: var(--secondary-bg);
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.sort-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--secondary-color);
    font-weight: 600;
}

/* ========== CITY CARD HOVER IMPROVEMENTS ========== */
.city-card {
    cursor: default;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.city-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.city-card:hover::before {
    left: 100%;
}

.city-time {
    cursor: pointer !important;
    transition: all 0.2s ease;
    font-weight: 600;
}

.city-time:hover {
    color: var(--primary-color);
    transform: scale(1.02);
}

.city-gmt {
    font-size: 0.85em;
    color: var(--text-light);
    margin-top: 4px;
}

.city-info {
    flex: 1;
}

/* ========== IMPROVED EMPTY STATE ========== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state h2 {
    color: var(--text-dark);
    margin-bottom: 10px;
}

.empty-state p {
    margin: 0;
    font-size: 0.95em;
}

/* ========== KEYBOARD SHORTCUTS HINT ========== */
.keyboard-hint {
    font-size: 0.75em;
    opacity: 0.6;
    margin-top: 4px;
}

@media (max-width: 480px) {
    .sort-menu {
        display: none;
    }
}

/* ========== CITY SUGGESTIONS ========== */
.suggestions {
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: var(--card-bg);
    margin-top: -2px;
    z-index: 1001;
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.suggestion-item:hover {
    background-color: var(--primary-color);
    color: white;
}

.suggestion-item.disabled {
    cursor: default;
    color: var(--text-light);
    background-color: var(--secondary-bg);
    text-align: center;
}

.suggestion-item.disabled:hover {
    background-color: var(--secondary-bg);
    color: var(--text-light);
}

.suggestion-name {
    font-weight: 600;
    font-size: 0.95em;
}

.suggestion-zone {
    font-size: 0.8em;
    opacity: 0.7;
}

.suggestion-item:hover .suggestion-zone {
    opacity: 1;
}

/* Fix modal-input to show suggestions */
.modal-input {
    margin-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.suggestions:not(:empty) + .suggestions {
    border-radius: 0 0 8px 8px;
}
