/* ===================================
   Focus Flow - Warm/Cozy Design System
   =================================== */

/* CSS Variables */
:root {
    /* Colors */
    --color-primary: #D4A574;
    --color-primary-dark: #C4956A;
    --color-secondary: #8B7355;
    --color-accent: #E8B89D;
    --color-accent-light: #F5D5C8;
    --color-background: #FDF6E3;
    --color-background-dark: #F5ECD3;
    --color-surface: #FFFFFF;
    --color-text: #5D4E37;
    --color-text-light: #8B7355;
    --color-success: #7CB377;
    --color-break: #89B4C8;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(93, 78, 55, 0.08);
    --shadow-md: 0 4px 16px rgba(93, 78, 55, 0.12);
    --shadow-lg: 0 8px 32px rgba(93, 78, 55, 0.16);

    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    font-size: 16px;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.nav {
    background: var(--color-surface);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--color-background);
    padding: 0.25rem;
    border-radius: var(--radius-lg);
}

.nav-tab {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--color-text-light);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.nav-tab.active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

/* Views */
.view {
    display: none;
    flex: 1;
    padding: 2rem 1.5rem;
}

.view.active {
    display: block;
}

/* Timer View */
.timer-container {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--color-background-dark);
    background: var(--color-surface);
    color: var(--color-text-light);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

.mode-btn.active[data-mode="short"],
.mode-btn.active[data-mode="long"] {
    background: var(--color-break);
    border-color: var(--color-break);
}

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

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

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

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

.timer-ring-progress.break {
    stroke: var(--color-break);
}

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

.timer-time {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
    letter-spacing: -2px;
}

.timer-label {
    font-size: 1rem;
    color: var(--color-text-light);
    font-weight: 600;
    margin-top: 0.5rem;
}

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

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn.primary {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: var(--shadow-md), 0 4px 0 var(--color-secondary);
}

.control-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 6px 0 var(--color-secondary);
}

.control-btn.primary:active {
    transform: translateY(2px);
    box-shadow: var(--shadow-sm), 0 2px 0 var(--color-secondary);
}

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

.control-btn.secondary {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-text-light);
    box-shadow: var(--shadow-sm);
}

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

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

.hidden {
    display: none !important;
}

/* Session Counter */
.session-counter {
    font-size: 1rem;
    color: var(--color-text-light);
    font-weight: 600;
}

.session-counter span {
    color: var(--color-primary);
    font-weight: 800;
    font-size: 1.25rem;
}

/* Breathing Overlay */
.breathing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #E8F4F8 0%, #FDF6E3 50%, #F5ECD3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.8s ease;
    overflow: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.breathing-container {
    text-align: center;
    position: relative;
}

/* Ripple effects behind the circle */
.breathing-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 2px solid rgba(137, 180, 200, 0.3);
    animation: ripple 4s ease-out infinite;
    pointer-events: none;
}

.breathing-ripple:nth-child(2) {
    animation-delay: 1s;
}

.breathing-ripple:nth-child(3) {
    animation-delay: 2s;
}

@keyframes ripple {
    0% {
        width: 200px;
        height: 200px;
        opacity: 0.6;
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

.breathing-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #89B4C8 0%, #6FA3B8 50%, #5A8FA8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    position: relative;
    box-shadow:
        0 0 60px rgba(137, 180, 200, 0.4),
        0 0 100px rgba(137, 180, 200, 0.2),
        inset 0 0 30px rgba(255, 255, 255, 0.2);
    transition: transform 4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.breathing-circle::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 30%;
    height: 20%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    filter: blur(8px);
}

.breathing-circle.inhale {
    transform: scale(1.4);
    box-shadow:
        0 0 80px rgba(137, 180, 200, 0.6),
        0 0 120px rgba(137, 180, 200, 0.3),
        inset 0 0 40px rgba(255, 255, 255, 0.3);
}

.breathing-circle.hold {
    transform: scale(1.4);
    box-shadow:
        0 0 80px rgba(137, 180, 200, 0.5),
        0 0 120px rgba(137, 180, 200, 0.25),
        inset 0 0 40px rgba(255, 255, 255, 0.25);
    animation: gentlePulse 2s ease-in-out infinite;
}

.breathing-circle.exhale {
    transform: scale(1);
    box-shadow:
        0 0 40px rgba(137, 180, 200, 0.3),
        0 0 80px rgba(137, 180, 200, 0.15),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
}

@keyframes gentlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.breathing-inner {
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.2) 100%);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3);
    transition: transform 4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 4s ease;
}

.breathing-circle.inhale .breathing-inner {
    transform: scale(0.8);
    opacity: 0.9;
}

.breathing-circle.exhale .breathing-inner {
    transform: scale(1);
    opacity: 0.7;
}

.breathing-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.75rem;
    opacity: 0.9;
    transition: opacity 0.5s ease;
    letter-spacing: 1px;
}

.breathing-guide {
    font-size: 1rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
    font-weight: 500;
}

.breathing-timer {
    font-size: 2.5rem;
    font-weight: 800;
    color: #6FA3B8;
    margin-bottom: 2rem;
    text-shadow: 0 2px 10px rgba(137, 180, 200, 0.3);
}

.breathing-progress {
    width: 200px;
    height: 4px;
    background: rgba(137, 180, 200, 0.2);
    border-radius: 2px;
    margin: 0 auto 2rem;
    overflow: hidden;
}

.breathing-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #89B4C8, #6FA3B8);
    border-radius: 2px;
    transition: width 1s linear;
}

.breathing-skip {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(137, 180, 200, 0.4);
    color: var(--color-text-light);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.breathing-skip:hover {
    background: rgba(137, 180, 200, 0.2);
    border-color: #6FA3B8;
    color: var(--color-text);
}

/* Volume control */
.breathing-volume {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.breathing-volume svg {
    width: 20px;
    height: 20px;
    color: var(--color-text-light);
}

.breathing-volume input[type="range"] {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(137, 180, 200, 0.3);
    border-radius: 2px;
    outline: none;
}

.breathing-volume input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #6FA3B8;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Dashboard View */
.dashboard-container {
    max-width: 600px;
    margin: 0 auto;
}

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

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Goal Card */
.goal-card {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

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

.goal-progress-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.goal-edit-btn {
    padding: 0.25rem 0.75rem;
    background: var(--color-background);
    border: none;
    color: var(--color-text-light);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.goal-edit-btn:hover {
    background: var(--color-background-dark);
    color: var(--color-text);
}

.goal-bar {
    height: 12px;
    background: var(--color-background);
    border-radius: 6px;
    overflow: hidden;
}

.goal-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 6px;
    transition: width var(--transition-normal);
    width: 0%;
}

/* Goal Modal */
.goal-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(93, 78, 55, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.goal-modal-content {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 300px;
    width: 90%;
}

.goal-modal-content h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.goal-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.goal-input-group input {
    width: 100px;
    padding: 0.75rem;
    border: 2px solid var(--color-background-dark);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    color: var(--color-text);
}

.goal-input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.goal-input-group span {
    color: var(--color-text-light);
    font-weight: 600;
}

.goal-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.modal-btn.primary:hover {
    background: var(--color-primary-dark);
}

.modal-btn.secondary {
    background: var(--color-background);
    color: var(--color-text-light);
}

.modal-btn.secondary:hover {
    background: var(--color-background-dark);
    color: var(--color-text);
}

/* Chart Card */
.chart-card {
    background: var(--color-surface);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

#weekly-chart {
    width: 100%;
    height: 200px;
}

/* Summary Grid */
.summary-grid {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-background);
}

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

.summary-label {
    color: var(--color-text-light);
    font-weight: 600;
}

.summary-value {
    color: var(--color-text);
    font-weight: 700;
}

/* Responsive */
@media (max-width: 480px) {
    .nav {
        flex-direction: column;
        gap: 1rem;
    }

    .timer-display {
        width: 240px;
        height: 240px;
    }

    .timer-time {
        font-size: 2.75rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        display: flex;
        align-items: center;
        gap: 1rem;
        text-align: left;
    }

    .stat-icon {
        margin-bottom: 0;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}
