/* ============================
   CORE BURN - Mobile First CSS
   ============================ */

:root {
    /* Colors */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1f2b4d;

    --accent-primary: #e94560;
    --accent-secondary: #ff6b6b;
    --accent-gradient: linear-gradient(135deg, #e94560 0%, #ff6b6b 100%);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c7c;

    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;

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

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(233, 69, 96, 0.3);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Safe areas for notch devices */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

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

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ============================
   START SCREEN
   ============================ */

#start-screen {
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    padding-top: calc(var(--safe-top) + var(--spacing-lg));
    padding-bottom: calc(var(--safe-bottom) + var(--spacing-lg));
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.start-content {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.start-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.start-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-xs);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-lg);
}

/* Workout Selector */
.workout-selector {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

.workout-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.workout-option:active {
    transform: scale(0.98);
}

.workout-option.active {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.1) 0%, rgba(255, 107, 107, 0.1) 100%);
    box-shadow: var(--shadow-glow);
}

.option-letter {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.option-days {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.workout-info {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
}

.info-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-card);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
}

.info-icon {
    font-size: 1.2rem;
}

.info-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.exercise-preview {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    text-align: left;
}

.exercise-preview h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-md);
}

.exercise-preview ul {
    list-style: none;
}

.exercise-preview li {
    padding: var(--spacing-sm) 0;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

.exercise-preview li:last-child {
    border-bottom: none;
}

.stats-preview {
    margin-top: var(--spacing-lg);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================
   BUTTONS
   ============================ */

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-large {
    width: 100%;
    padding: var(--spacing-lg);
    font-size: 1.2rem;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:active {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-exercise {
    width: 100%;
    padding: var(--spacing-lg);
    font-size: 1.3rem;
    margin-top: var(--spacing-lg);
}

/* ============================
   WORKOUT SCREEN
   ============================ */

#workout-screen {
    background: var(--bg-primary);
}

/* Top Bar */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    padding: var(--spacing-md);
    padding-top: calc(var(--safe-top) + var(--spacing-md));
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.workout-title h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.workout-duration {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.elapsed-time {
    text-align: right;
}

.elapsed-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.elapsed-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
}

/* Round Indicator */
.round-indicator {
    text-align: center;
    padding: var(--spacing-sm);
    background: var(--bg-card);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#current-round {
    color: var(--accent-primary);
    font-weight: 700;
}

/* Main Workout Area */
.workout-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    gap: var(--spacing-md);
}

/* Exercise Card */
.exercise-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.exercise-name {
    font-size: 1.5rem;
    font-weight: 700;
}

.exercise-target {
    background: var(--accent-gradient);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.exercise-visual {
    margin: var(--spacing-lg) 0;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exercise-gif {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-lg);
    object-fit: cover;
}

.exercise-emoji {
    font-size: 80px;
    line-height: 1;
}

.exercise-info {
    margin-bottom: var(--spacing-md);
}

.exercise-duration {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-secondary);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
}

.duration-icon {
    font-size: 1.2rem;
}

/* Timer Display */
.timer-display {
    margin: var(--spacing-lg) 0;
}

.timer-circle {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto;
}

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

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

.timer-progress {
    fill: none;
    stroke: url(#timer-gradient);
    stroke: var(--accent-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s ease;
}

.timer-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* Reps Display */
.reps-display {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-xl);
}

.reps-count {
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent-primary);
    display: block;
    line-height: 1;
}

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

/* Rest Cards */
.rest-card,
.round-rest-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xxl);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.rest-icon,
.round-complete-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
}

.rest-card h3,
.round-rest-card h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

.round-rest-card p {
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

.rest-timer {
    margin: var(--spacing-xl) 0;
}

.rest-timer span:first-child {
    font-size: 5rem;
    font-weight: 800;
    color: var(--success);
    display: block;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

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

/* Motivation */
.motivation {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    max-width: 300px;
    animation: fadeInUp 0.3s ease;
}

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

#motivation-text {
    font-size: 1rem;
    font-weight: 600;
}

/* Bottom Bar */
.bottom-bar {
    position: sticky;
    bottom: 0;
    z-index: 100;
    background: var(--bg-secondary);
    padding: var(--spacing-md);
    padding-bottom: calc(var(--safe-bottom) + var(--spacing-md));
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-info {
    display: flex;
    gap: var(--spacing-lg);
}

.progress-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.95rem;
}

.progress-icon {
    font-size: 1.1rem;
}

/* ============================
   COMPLETE SCREEN
   ============================ */

#complete-screen {
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    padding-top: calc(var(--safe-top) + var(--spacing-lg));
    padding-bottom: calc(var(--safe-bottom) + var(--spacing-lg));
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0a1628 100%);
}

.complete-content {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.complete-icon {
    font-size: 80px;
    margin-bottom: var(--spacing-lg);
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.complete-content h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: var(--spacing-xl);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.complete-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.complete-message {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.complete-message p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

/* ============================
   UTILITIES
   ============================ */

.hidden {
    display: none !important;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease;
}

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

.scale-in {
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Shake animation for done */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Completed state */
.exercise-card.completed {
    background: linear-gradient(135deg, #1a472a 0%, #16213e 100%);
    border: 2px solid var(--success);
}

/* ============================
   MEDIA QUERIES
   ============================ */

/* Small phones */
@media (max-width: 360px) {
    .start-content h1 {
        font-size: 2rem;
    }

    .exercise-emoji {
        font-size: 60px;
    }

    .timer-circle {
        width: 150px;
        height: 150px;
    }

    .timer-countdown {
        font-size: 2.8rem;
    }

    .workout-info {
        gap: var(--spacing-sm);
    }

    .info-item {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

/* Tablets and larger */
@media (min-width: 768px) {
    .start-content,
    .complete-content {
        max-width: 500px;
    }

    .exercise-card,
    .rest-card,
    .round-rest-card {
        max-width: 450px;
    }

    .top-bar {
        padding: var(--spacing-lg);
    }

    .bottom-bar {
        padding: var(--spacing-lg);
    }
}

/* Landscape mode */
@media (max-height: 600px) and (orientation: landscape) {
    .workout-main {
        padding: var(--spacing-sm);
    }

    .exercise-card {
        padding: var(--spacing-md);
    }

    .exercise-emoji {
        font-size: 50px;
    }

    .timer-circle {
        width: 120px;
        height: 120px;
    }

    .timer-countdown {
        font-size: 2.2rem;
    }

    .reps-count {
        font-size: 3.5rem;
    }
}

/* Dark mode preference (already dark by default) */
@media (prefers-color-scheme: light) {
    /* Keep dark theme anyway for workout focus */
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
