/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    /* Dark Theme Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-primary: #334155;
    --border-secondary: #475569;
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(71, 85, 105, 0.3);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.25);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3);
}

/* Base Typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* Header */
.header {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary);
}

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

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

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.theme-toggle:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

.sun-icon, .moon-icon {
    transition: opacity 0.3s ease;
}

[data-theme="dark"] .sun-icon {
    opacity: 0;
    position: absolute;
}

[data-theme="light"] .moon-icon {
    opacity: 0;
    position: absolute;
}

.format-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
}

.format-toggle:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.nav-tab {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    position: relative;
}

.nav-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.nav-tab.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 50%;
}

/* Tab Content */
.tab-content {
    position: relative;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

/* Cards and Glassmorphism */
.converter-card, .utc-card, .epoch-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.converter-card:hover, .utc-card:hover, .epoch-section:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* Input Groups */
.converter-inputs, .datetime-inputs, .epoch-inputs, .timestamp-inputs, .planner-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="date"], input[type="time"], input[type="number"], input[type="text"], select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

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

/* Buttons */
.now-btn, .convert-btn, .add-city-btn, .add-participant, .swap-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.now-btn:hover, .convert-btn:hover, .add-city-btn:hover, .add-participant:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.swap-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    padding: 0.75rem;
    border-radius: 50%;
    align-self: center;
}

.swap-btn:hover {
    background: var(--accent-primary);
    color: white;
    transform: rotate(180deg);
}

/* Conversion Result */
.conversion-result {
    margin: 2rem 0;
}

.result-card {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-radius: 1rem;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.result-time {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.result-date {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.result-timezone {
    font-size: 1rem;
    opacity: 0.8;
}

.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

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

/* Additional Formats */
.additional-formats {
    margin-top: 2rem;
}

.additional-formats h4 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.format-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 1rem;
    position: relative;
}

.format-item label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.format-item code {
    display: block;
    background: var(--bg-tertiary);
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-all;
    margin-bottom: 0.5rem;
}

.copy-small {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-small:hover {
    background: var(--accent-hover);
}

/* Quick Epoch Converter */
.quick-epoch-converter {
    margin-top: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
}

.quick-epoch-converter h4 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.epoch-quick-inputs {
    display: flex;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.epoch-quick-inputs .input-group {
    flex: 1;
}

.quick-epoch-result .result-item {
    margin-bottom: 1rem;
}

.quick-epoch-result .result-item label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.quick-epoch-result .result-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-epoch-result .result-value code {
    flex: 1;
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--text-primary);
}

/* World Clock */
.world-clock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.world-clock-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.city-search {
    margin-bottom: 2rem;
}

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

.search-results {
    margin-top: 1rem;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-primary);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

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

.clock-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.clock-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.clock-card h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.clock-time {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.5rem;
}

.clock-date {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.clock-timezone {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.remove-clock {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.remove-clock:hover {
    transform: scale(1.1);
}

/* Epoch Converter */
.epoch-converter {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.epoch-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.epoch-results, .timestamp-results {
    margin-top: 1.5rem;
}

.result-item {
    margin-bottom: 1rem;
}

.result-item label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.result-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-value code {
    flex: 1;
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--text-primary);
}

/* UTC Tools */
.utc-tools h3 {
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.utc-conversions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.utc-time {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.5rem;
}

.utc-date {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.timezone-offsets h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

.offset-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.offset-item .timezone-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.offset-item .offset-value {
    color: var(--accent-primary);
    font-weight: 500;
}

/* Meeting Planner */
.meeting-planner h3 {
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.participant-timezones {
    margin: 2rem 0;
}

.participant-timezones h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.timezone-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.timezone-selector select {
    flex: 1;
}

.participants-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.participant-tag {
    background: var(--accent-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.participant-tag .remove {
    cursor: pointer;
    font-weight: bold;
}

.meeting-results {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
}

.meeting-time-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-primary);
}

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

.meeting-time-item .timezone {
    font-weight: 600;
    color: var(--text-primary);
}

.meeting-time-item .time {
    color: var(--accent-primary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Footer */
.footer {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .converter-inputs, .datetime-inputs, .epoch-inputs, .timestamp-inputs, .planner-inputs {
        grid-template-columns: 1fr;
    }
    
    .converter-card, .utc-card, .epoch-section {
        padding: 1.5rem;
    }
    
    .result-time {
        font-size: 2rem;
    }
    
    .world-clock-grid {
        grid-template-columns: 1fr;
    }
    
    .format-grid {
        grid-template-columns: 1fr;
    }
    
    .offset-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .timezone-selector {
        flex-direction: column;
    }
    
    .meeting-time-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .nav-tab {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .result-time {
        font-size: 1.5rem;
    }
    
    .utc-time {
        font-size: 2rem;
    }
    
    .clock-time {
        font-size: 1.5rem;
    }
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-primary);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

.toast.error {
    background: var(--error);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}
