/* Import a clean, modern font */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;500&display=swap');

/* CSS Variables for theming and easy customization */
:root {
    /* Light Mode Colors */
    --tt-bg-light: #f0f2f5;
    --tt-card-bg-light: rgba(255, 255, 255, 0.6);
    --tt-text-color-light: #2c3e50;
    --tt-accent-color-light: #3498db;
    --tt-glow-color-light: rgba(52, 152, 219, 0.5);
    --tt-shadow-light: 0 8px 32px 0 rgba(0, 0, 0, 0.1);

    /* Dark Mode Colors */
    --tt-bg-dark: #121828;
    --tt-card-bg-dark: rgba(30, 41, 59, 0.5);
    --tt-text-color-dark: #e2e8f0;
    --tt-accent-color-dark: #5eead4;
    --tt-glow-color-dark: rgba(94, 234, 212, 0.7);
    --tt-shadow-dark: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

#time-travel-container {
    /* Using variables for the default light theme */
    --bg-color: var(--tt-bg-light);
    --card-bg: var(--tt-card-bg-light);
    --text-color: var(--tt-text-color-light);
    --accent-color: var(--tt-accent-color-light);
    --glow-color: var(--tt-glow-color-light);
    --shadow: var(--tt-shadow-light);

    font-family: 'Roboto Mono', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 800px;
    margin: 2rem auto;
    position: relative;
    overflow: hidden;
    transition: background 0.5s ease, color 0.5s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dark mode styles */
#time-travel-container.dark-mode {
    --bg-color: var(--tt-bg-dark);
    --card-bg: var(--tt-card-bg-dark);
    --text-color: var(--tt-text-color-dark);
    --accent-color: var(--tt-accent-color-dark);
    --glow-color: var(--tt-glow-color-dark);
    --shadow: var(--tt-shadow-dark);
}

/* Glassmorphic card effect for main displays */
.time-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

/* Main "7 Hours Ago" Display */
.time-travel-header {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 0.5rem;
    animation: fadeInDown 0.8s ease-out;
}

.time-display {
    font-size: 4rem;
    font-weight: 500;
    color: var(--accent-color);
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color);
    transition: color 0.5s ease, text-shadow 0.5s ease;
    animation: pulse 2s infinite ease-in-out;
}

.time-display .am-pm {
    font-size: 1.5rem;
    margin-left: 10px;
    opacity: 0.7;
}

/* Current Time and Date Section */
.current-info-container {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease-out;
}

.current-info-card {
    flex-grow: 1;
}

.current-info-card h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.7;
}

.real-clock, .date-display {
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--text-color);
    transition: color 0.5s ease;
}

.real-clock .seconds {
    font-size: 1.25rem;
    opacity: 0.6;
}

/* Controls: Toggles and Buttons */
.controls {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    animation: fadeInUp 1s ease-out;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    font-size: 0.9rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Timezone Info Button */
#tz-info-btn {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    opacity: 0.6;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}
#tz-info-btn:hover {
    opacity: 1;
    background-color: var(--accent-color);
    color: var(--bg-color);
    border-color: var(--accent-color);
}

/* Timezone Modal/Popup */
.modal-overlay {
    position: fixed; /* Use fixed to cover the whole page, even if container is small */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: var(--bg-color);
    color: var(--text-color);
    padding: 2rem;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: left;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-content h3 {
    margin-top: 0;
    color: var(--accent-color);
    border-bottom: 1px solid;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.modal-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.modal-content strong {
    color: var(--accent-color);
    font-weight: 500;
}

#modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
#modal-close-btn:hover {
    opacity: 1;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0% { text-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color); }
    50% { text-shadow: 0 0 20px var(--glow-color), 0 0 40px var(--glow-color); }
    100% { text-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color); }
}

/* Responsive Design */
@media (max-width: 768px) {
    #time-travel-container {
        padding: 1.5rem;
        margin: 1rem;
    }
    .time-display {
        font-size: 3rem;
    }
    .real-clock, .date-display {
        font-size: 1.5rem;
    }
    .current-info-container {
        flex-direction: column;
    }
}
@media (max-width: 480px) {
     #time-travel-container {
        padding: 1rem;
    }
    .time-travel-header {
        font-size: 1.2rem;
    }
    .time-display {
        font-size: 2.2rem;
    }
    .time-display .am-pm {
        font-size: 1rem;
    }
    .real-clock, .date-display {
        font-size: 1.2rem;
    }
    .controls {
        flex-direction: column;
        gap: 1rem;
    }
}