/* Pomodoro Focus - Modern Timer Styles */

:root {
    /* Color scheme - Warm & Focused */
    --color-work: #e74c3c;
    --color-work-light: #ff6b5b;
    --color-short-break: #27ae60;
    --color-short-break-light: #2ecc71;
    --color-long-break: #3498db;
    --color-long-break-light: #5dade2;
    
    /* Base colors */
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --text-muted: #6c6c6c;
    
    /* UI colors */
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    
    /* Current theme color */
    --current-color: var(--color-work);
    --current-color-light: var(--color-work-light);
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --radius: 16px;
    --radius-sm: 8px;
    --radius-lg: 24px;
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    position: relative;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
}

/* Timer Section */
.timer-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

/* Session Tabs */
.session-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius);
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

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

.tab-btn.active {
    background: var(--current-color);
    color: white;
}

/* Timer Display */
.timer-display {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto 32px;
}

.timer-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring-bg {
    fill: none;
    stroke: var(--bg-primary);
    stroke-width: 8;
}

.timer-ring-progress {
    fill: none;
    stroke: var(--current-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.timer-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer-time {
    font-size: 56px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -2px;
}

.timer-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 500;
}

/* Timer Controls */
.timer-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

.control-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.control-btn.primary {
    width: 72px;
    height: 72px;
    background: var(--current-color);
    color: white;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
}

.control-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(231, 76, 60, 0.5);
}

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

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

/* Session Counter */
.session-counter {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.session-counter span {
    color: var(--current-color);
    font-weight: 600;
}

/* Stats Section */
.stats-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.stats-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.stats-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.stats-tab:hover {
    color: var(--text-primary);
}

.stats-tab.active {
    color: var(--current-color);
    background: rgba(231, 76, 60, 0.1);
}

/* Stats Views */
.stats-view {
    display: none;
}

.stats-view.active {
    display: block;
}

/* Stat Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Weekly Chart */
.weekly-chart {
    margin-bottom: 24px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    gap: 8px;
    margin-bottom: 8px;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(to top, var(--current-color), var(--current-color-light));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
}

.chart-label {
    font-size: 11px;
    color: var(--text-muted);
    flex: 1;
    text-align: center;
}

.weekly-totals {
    display: flex;
    justify-content: center;
    gap: 48px;
}

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

.total-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.total-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.achievement-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0.4;
}

.achievement-card.unlocked {
    opacity: 1;
}

.achievement-card.unlocked:hover {
    transform: translateY(-2px);
    background: var(--bg-card);
}

.achievement-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.achievement-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.achievement-desc {
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Settings Button */
.settings-btn {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.settings-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.settings-btn svg {
    width: 20px;
    height: 20px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

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

.modal-body {
    padding: 24px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.setting-group input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 16px;
    transition: all 0.3s ease;
}

.setting-group input[type="number"]:focus {
    outline: none;
    border-color: var(--current-color);
}

.setting-group.toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-group.toggle label {
    margin-bottom: 0;
}

.setting-group input[type="checkbox"] {
    width: 48px;
    height: 24px;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-group input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.setting-group input[type="checkbox"]:checked {
    background: var(--current-color);
}

.setting-group input[type="checkbox"]:checked::before {
    transform: translateX(24px);
    background: white;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn.primary:hover {
    opacity: 0.9;
}

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

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

/* Achievement Toast */
.achievement-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    padding: 16px 24px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1001;
}

.achievement-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 32px;
}

.toast-content {
    color: white;
}

.toast-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.toast-name {
    font-size: 16px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 480px) {
    .app-container {
        padding: 16px;
    }
    
    .timer-section {
        padding: 24px 16px;
    }
    
    .timer-display {
        width: 200px;
        height: 200px;
    }
    
    .timer-time {
        font-size: 48px;
    }
    
    .stat-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .stat-card {
        padding: 12px 8px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.timer-display.running .timer-ring-progress {
    animation: pulse 2s ease-in-out infinite;
}

/* Theme variations */
.theme-work {
    --current-color: var(--color-work);
    --current-color-light: var(--color-work-light);
}

.theme-short-break {
    --current-color: var(--color-short-break);
    --current-color-light: var(--color-short-break-light);
}

.theme-long-break {
    --current-color: var(--color-long-break);
    --current-color-light: var(--color-long-break-light);
}
