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

:root {
    /* Dark theme colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-primary: #00d4aa;
    --accent-secondary: #7c3aed;
    --accent-danger: #ef4444;
    --border-color: #2a2a2a;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

/* Light theme colors - White with Orange */
body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f0f0f0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent-primary: #ff6b35;
    --accent-secondary: #ff8c42;
    --accent-danger: #ef4444;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation */
.nav-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.streak-indicator,
.level-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.streak-indicator svg {
    color: #ff9500;
}

.level-indicator {
    color: var(--accent-secondary);
}

.user-btn {
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-btn:hover {
    background: var(--accent-primary);
    transform: scale(1.05);
}

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

/* Timer Card */
.timer-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    transition: all 0.3s ease;
}

.timer-display {
    font-size: 5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subject-input-container {
    margin-bottom: 2rem;
}

.subject-input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.subject-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.timer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
}

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

.control-btn.secondary:hover {
    background: var(--border-color);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.session-types {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.session-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.session-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

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

/* YouTube Container */
.youtube-container {
    max-width: 600px;
    margin: 2rem auto 0;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 1rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: all 0.3s ease;
}

.youtube-container iframe {
    width: 100%;
    border-radius: 10px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 50px var(--shadow-color);
    transition: all 0.3s ease;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Form Styles */
.auth-form {
    margin-top: 2rem;
}

.form-input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-input.small {
    width: 100px;
}

.terms-container {
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    margin-top: 0.25rem;
}

.checkbox-label a {
    color: var(--accent-primary);
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

/* Button Styles */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

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

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
}

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

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

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

.btn.danger:hover {
    background: #dc2626;
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

.google-btn {
    background: white;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.google-btn:hover {
    background: #f5f5f5;
}

.divider {
    text-align: center;
    margin: 1rem 0;
    position: relative;
}

.divider span {
    background: var(--bg-secondary);
    padding: 0 1rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.auth-links {
    text-align: center;
    margin-top: 1rem;
}

.auth-links a {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Analytics Styles */
.analytics-content {
    max-width: 1200px;
}

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

.date-filter {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

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

.stat-card,
.chart-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: all 0.3s ease;
}

.stat-card h3,
.chart-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chart-card {
    min-height: 300px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

/* Settings Styles */
.settings-content h2 {
    margin-bottom: 2rem;
}

.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.settings-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: all 0.3s ease;
}

.settings-card h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent-primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.user-email {
    color: var(--text-secondary);
}

.settings-link {
    color: var(--accent-primary);
    text-decoration: none;
}

.settings-link:hover {
    text-decoration: underline;
}

/* Language Selector */
.language-selector {
    position: relative;
    display: inline-block;
}

.language-dropdown {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 120px;
    transition: all 0.3s ease;
}

.language-dropdown:hover {
    border-color: var(--accent-primary);
}

/* Credits Styles */
.credits-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    max-width: 800px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.credit-section {
    margin-bottom: 2rem;
}

.credit-section h3 {
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.credit-section p {
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-content {
        padding: 0 1rem;
    }
    
    .nav-links {
        gap: 1rem;
        font-size: 0.875rem;
    }
    
    .user-section {
        gap: 0.5rem;
    }
    
    .streak-indicator,
    .level-indicator {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .timer-display {
        font-size: 3rem;
    }
    
    .timer-card {
        padding: 2rem;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card {
        min-height: 250px;
    }
    
    .timer-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .control-btn {
        padding: 0.75rem 1.5rem;
    }
}

/* Animation for theme transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* User Menu Dropdown */
.user-menu-container {
    position: relative;
}

.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 30px var(--shadow-color);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.user-menu.active {
    display: block;
}

.user-menu-item {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
}

.user-menu-item:hover {
    background: var(--bg-tertiary);
}

.user-menu-item:first-child {
    border-radius: 10px 10px 0 0;
}

.user-menu-item:last-child {
    border-radius: 0 0 10px 10px;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* Music Info Box */
.music-info-box {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: none;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    z-index: 100;
    animation: slideUp 0.3s ease;
}

.music-icon {
    color: var(--accent-primary);
}

.music-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.music-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.music-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* YouTube container update */
.youtube-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 0.5rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    display: none;
}

/* Fix chart container heights */
.chart-card {
    min-height: 300px;
    position: relative;
}

.chart-card canvas {
    max-height: 250px !important;
    width: 100% !important;
}

.chart-card.full-width {
    grid-column: 1 / -1;
    min-height: 350px;
}

.chart-card.full-width canvas {
    max-height: 300px !important;
}

/* Ensure charts maintain aspect ratio */
@media (max-width: 768px) {
    .chart-card {
        min-height: 250px;
    }
    
    .chart-card canvas {
        max-height: 200px !important;
    }
    
    .chart-card.full-width {
        min-height: 300px;
    }
    
    .chart-card.full-width canvas {
        max-height: 250px !important;
    }
}

/* Music Info Box - Updated */
.music-info-box {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: none;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    z-index: 100;
    animation: slideUp 0.3s ease;
    min-width: 250px;
}

.music-icon {
    color: var(--accent-primary);
    animation: pulse 2s ease-in-out infinite;
}

.music-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.music-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.music-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.music-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

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

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

/* Hide YouTube container completely */
.youtube-container {
    display: none !important;
}