/* ============================================
   ANY TIMEZONE CONVERTER - CUSTOM STYLES
   ============================================ */

/* ============================================
   1. CSS VARIABLES & THEME COLORS
   ============================================ */

:root {
    /* Primary Colors */
    --primary: #2563EB;
    --primary-dark: #1E40AF;
    --primary-light: #3B82F6;
    
    /* Accent Colors */
    --accent: #0EA5E9;
    --accent-alt: #14B8A6;
    
    /* Background Colors */
    --bg-primary: #F8FAFC;
    --bg-secondary: #E2E8F0;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: #FFFFFF;
    
    /* Text Colors */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    
    /* Border Colors */
    --border-color: #E2E8F0;
    --border-focus: #2563EB;
    
    /* Status Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-full: 50%;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Font Weights */
    --font-light: 300;
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
}

/* Dark Mode Theme */
body.dark-mode {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --card-bg: #1E293B;
    
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    
    --border-color: #334155;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
}

/* ============================================
   2. GLOBAL STYLES & RESET
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   3. NAVBAR STYLES
   ============================================ */

.navbar {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
    transition: all var(--transition-normal);
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: var(--font-bold);
    color: var(--primary);
    text-decoration: none;
    transition: transform var(--transition-fast);
}

.navbar-brand:hover {
    transform: scale(1.02);
    color: var(--primary-dark);
}

.navbar-brand i {
    font-size: 1.8rem;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: var(--font-bold);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: var(--font-regular);
}

.btn-dark-mode {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-dark-mode:hover {
    background: var(--primary-dark);
    transform: scale(1.1) rotate(15deg);
    box-shadow: var(--shadow-lg);
}

.btn-dark-mode i {
    font-size: 1.2rem;
}

/* ============================================
   4. MAIN CONTAINER
   ============================================ */

.main-container {
    flex: 1;
    padding: 2rem 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

/* ============================================
   5. PARENT CARD & CONVERTER CARDS
   ============================================ */

.parent-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    margin-bottom: 2rem;
    display: flex;
    gap: 2rem;
    align-items: stretch;
    transition: all var(--transition-normal);
}

.converter-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card-header {
    color: var(--primary);
    font-weight: var(--font-semibold);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

/* ============================================
   6. SUB CARDS
   ============================================ */

.sub-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.sub-card.dropdown-active {
    z-index: 100;
}

.sub-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.sub-card .form-label {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: block;
}

/* ============================================
   7. TIMEZONE SELECTOR - CUSTOM DROPDOWN
   ============================================ */

/* Custom Dropdown Container */
.custom-dropdown {
    position: relative;
    width: 100%;
}

/* Dropdown Selected Bar */
.dropdown-selected {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-fast);
    user-select: none;
}

.dropdown-selected:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dropdown-selected.active {
    border-color: var(--primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.selected-text {
    color: var(--text-primary);
    font-weight: var(--font-medium);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-icon {
    color: var(--primary);
    transition: transform var(--transition-fast);
    margin-left: 0.5rem;
}

.dropdown-selected.active .dropdown-icon {
    transform: rotate(180deg);
}

/* Dropdown Options Container */
.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-top: none;
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.dropdown-options.show {
    max-height: 400px;
    opacity: 1;
}

/* Dropdown Search */
.dropdown-search {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-fast);
}

.dropdown-search:focus {
    background: var(--card-bg);
    border-bottom-color: var(--primary);
}

.dropdown-search::placeholder {
    color: var(--text-muted);
}

/* Options List */
.options-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

/* Custom Scrollbar for Options List */
.options-list::-webkit-scrollbar {
    width: 8px;
}

.options-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.options-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.options-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Dropdown Option Item */
.dropdown-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    border-left: 3px solid transparent;
}

.dropdown-option:hover {
    background: var(--bg-secondary);
    border-left-color: var(--primary);
    padding-left: 1.25rem;
}

.dropdown-option.selected {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    font-weight: var(--font-semibold);
    border-left-color: var(--primary);
}

.dropdown-option.hidden {
    display: none;
}

/* No Results Message */
.no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Legacy form-select styles (kept for compatibility) */
.form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.75rem;
    transition: all var(--transition-fast);
}

.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.auto-detect-badge {
    background: rgba(37, 99, 235, 0.1);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 0.85rem;
}

.auto-detect-badge i {
    animation: pulse 2s infinite;
}

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

/* Popular Shortcuts */
.popular-shortcuts {
    margin-top: 0.5rem;
}

.shortcut-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.shortcut-badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
}

.shortcut-badge:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* ============================================
   8. DATE & TIME PICKER
   ============================================ */

.datetime-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group-text {
    background: var(--primary);
    color: white;
    border: none;
}

.form-control {
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
    background: var(--card-bg);
    color: var(--text-primary);
}

.datetime-info {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.5rem;
}

.info-item {
    background: rgba(37, 99, 235, 0.1);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

/* ============================================
   9. SWAP BUTTON
   ============================================ */

.swap-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-swap {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
    font-size: 1.5rem;
}

.btn-swap:hover {
    background: var(--accent-alt);
    transform: scale(1.1) rotate(180deg);
    box-shadow: var(--shadow-xl);
}

.btn-swap:active {
    transform: scale(0.95) rotate(180deg);
}

.btn-swap.swapping {
    animation: swap-animation 0.6s ease-in-out;
}

@keyframes swap-animation {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg) scale(1.2); }
}

/* ============================================
   10. RESULT DISPLAY
   ============================================ */

.result-display {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
    border: 2px solid var(--primary);
}

.result-content {
    text-align: center;
}

.converted-datetime {
    margin-bottom: 1rem;
}

.result-time {
    font-size: 2.5rem;
    font-weight: var(--font-bold);
    color: var(--primary);
    margin-bottom: 0.5rem;
    animation: fadeIn 0.5s ease-in;
}

.result-date {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.day-indicator {
    background: var(--accent);
    color: white;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    font-weight: var(--font-medium);
}

.day-indicator.same-day {
    background: var(--info);
}

.day-indicator.next-day {
    background: var(--success);
}

.day-indicator.previous-day {
    background: var(--warning);
}

.time-difference {
    background: rgba(20, 184, 166, 0.1);
    color: var(--accent-alt);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: var(--font-medium);
}

/* ============================================
   11. FEATURE BAR
   ============================================ */

.feature-bar {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.feature-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.feature-btn {
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-weight: var(--font-medium);
    transition: all var(--transition-fast);
    border: none;
}

.feature-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   12. LIVE CLOCKS
   ============================================ */

.live-clocks {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
}

.clock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.clock-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.clock-time {
    font-size: 1.25rem;
    font-weight: var(--font-bold);
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

.clock-divider {
    color: var(--text-muted);
    font-size: 1.5rem;
}

/* ============================================
   13. FAVORITES MODAL
   ============================================ */

.modal-content {
    background: var(--card-bg);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    color: var(--primary);
}

.favorites-list {
    max-height: 400px;
    overflow-y: auto;
}

.favorite-item {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.favorite-item:hover {
    background: var(--primary);
    color: white;
    transform: translateX(5px);
}

.favorite-item .btn-delete {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.favorite-item .btn-delete:hover {
    background: #DC2626;
}

/* ============================================
   14. FOOTER
   ============================================ */

.footer {
    background: var(--card-bg);
    padding: 2rem 0;
    margin-top: auto;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.05);
}

.footer-content {
    text-align: center;
    color: var(--text-secondary);
}

.footer-content p {
    margin-bottom: 0.5rem;
}

.footer-content i {
    color: var(--primary);
}

/* ============================================
   15. TOAST NOTIFICATIONS
   ============================================ */

.toast {
    background: var(--card-bg);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-md);
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-error {
    border-left: 4px solid var(--danger);
}

.toast.toast-info {
    border-left: 4px solid var(--info);
}

.toast-body {
    padding: 1rem;
}

/* ============================================
   16. ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

/* ============================================
   17. RESPONSIVE DESIGN - MOBILE
   ============================================ */

@media (max-width: 767px) {
    .parent-card {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    
    .swap-container {
        margin: 1rem 0;
    }
    
    .btn-swap {
        transform: rotate(90deg);
    }
    
    .btn-swap:hover {
        transform: rotate(90deg) scale(1.1);
    }
    
    .brand-subtitle {
        display: none !important;
    }
    
    .brand-title {
        font-size: 1rem;
    }
    
    .navbar-brand i {
        font-size: 1.5rem;
    }
    
    .feature-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .feature-buttons {
        flex-direction: column;
    }
    
    .feature-btn {
        width: 100%;
    }
    
    .live-clocks {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .clock-divider {
        display: none;
    }
    
    .result-time {
        font-size: 2rem;
    }
    
    .datetime-info {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ============================================
   18. RESPONSIVE DESIGN - TABLET
   ============================================ */

@media (min-width: 768px) and (max-width: 1023px) {
    .parent-card {
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .sub-card {
        padding: 1rem;
    }
    
    .result-time {
        font-size: 2rem;
    }
    
    .feature-bar {
        flex-direction: column;
    }
}

/* ============================================
   19. RESPONSIVE DESIGN - LARGE SCREENS
   ============================================ */

@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    body {
        font-size: 1.05rem;
    }
    
    .parent-card {
        padding: 2.5rem;
    }
    
    .result-time {
        font-size: 3rem;
    }
    
    .btn-swap {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
    }
}

/* ============================================
   20. ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus Indicators */
*:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus,
.btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Screen Reader Only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
    }
    
    body.dark-mode {
        --border-color: #FFFFFF;
    }
}

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

/* ============================================
   21. UTILITY CLASSES
   ============================================ */

.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hover-lift {
    transition: transform var(--transition-fast);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

/* ============================================
   22. PRINT STYLES
   ============================================ */

@media print {
    .navbar,
    .footer,
    .feature-bar,
    .btn-dark-mode {
        display: none;
    }
    
    .parent-card {
        box-shadow: none;
        border: 1px solid #000;
    }
}
