:root {
    --bg-main: #0B0E14;
    --bg-card: rgba(22, 27, 34, 0.6);
    --bg-card-header: rgba(33, 38, 45, 0.8);
    --border-subtle: rgba(255, 255, 255, 0.08);
    
    --accent-neon: #64ffda;
    --accent-neon-dim: rgba(100, 255, 218, 0.15);
    --accent-primary: #3b82f6;
    
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --text-dark: #0f172a;
    
    --font-primary: 'Inter', -apple-system, sans-serif;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    
    --input-bg: rgba(255, 255, 255, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-primary);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 100px; /* Space for FAB */
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(100, 255, 218, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Typography */
h1 { font-size: 2.2rem; font-weight: 900; letter-spacing: -1px; margin-bottom: 4px; }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.5px; }

/* Header */
.app-header {
    padding: 30px 20px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, var(--bg-main) 70%, transparent);
    backdrop-filter: blur(10px);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.date-badge {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-neon);
    letter-spacing: 1px;
}

.session-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: var(--input-bg);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
}

.subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* Cards */
.workout-container { padding: 0 20px; }

.exercise-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(20px);
}

.ex-header {
    background: var(--bg-card-header);
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.ex-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.muscle-group {
    background: var(--accent-neon-dim);
    color: var(--accent-neon);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 6px;
}

.ex-history {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.history-label { color: var(--text-muted); }
.history-metric { color: #fff; font-weight: 600; }
.history-1rm { color: var(--text-muted); background: var(--input-bg); padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; margin-left: auto;}

/* Sets Table */
.sets-container { padding: 8px 16px; }

.set-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.set-row:last-child { border-bottom: none; }

.header-row { padding: 4px 0; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px;}

.set-num-col { width: 40px; text-align: center; }
.input-col { flex: 1; text-align: center; }
.check-col { width: 50px; text-align: right; }

.set-num {
    width: 40px;
    text-align: center;
    font-weight: 700;
    color: #fff;
    background: var(--input-bg);
    height: 28px;
    line-height: 28px;
    border-radius: 6px;
    display: inline-block;
}

.set-input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-primary);
    text-align: center;
    width: 100%;
    outline: none;
}
.set-input::placeholder { color: rgba(255,255,255,0.2); }

.complete-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    background: transparent;
    color: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
    display: block;
}

@keyframes sonar-ripple {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

.complete-btn.active {
    background: var(--accent-neon);
    border-color: var(--accent-neon);
    color: var(--text-dark);
    box-shadow: 0 0 15px var(--accent-neon-dim);
    transform: scale(1.05);
}

.complete-btn.active::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: var(--accent-neon);
    z-index: -1;
    animation: sonar-ripple 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes pulse-record {
    0% { box-shadow: 0 0 0 0 rgba(255, 95, 86, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 95, 86, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 95, 86, 0); }
}

.complete-btn.recording {
    border-color: #ff5f56;
    color: #ff5f56;
    animation: pulse-record 1.5s infinite;
}

.add-set-btn {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: none;
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-subtle);
    cursor: pointer;
}

/* Floating Action Bar */
.floating-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(0deg, var(--bg-main) 60%, transparent);
    z-index: 20;
}

.finish-workout-btn {
    width: 100%;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    padding: 18px;
    border-radius: var(--border-radius-lg);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
    cursor: pointer;
}

/* Rest Timer Overlay */
.rest-timer-overlay {
    position: fixed;
    bottom: -100px; /* Hidden */
    left: 0;
    right: 0;
    background: var(--bg-card-header);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    z-index: 30;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

.rest-timer-overlay.active {
    bottom: 0;
}

.rest-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.rest-content p { color: var(--accent-neon); font-size: 0.8rem; font-weight: 700; text-transform: uppercase;}
.rest-content h2 { font-variant-numeric: tabular-nums; color: #fff; font-size: 1.5rem;}

.skip-rest-btn {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
}

.progress-bar-container {
    height: 4px;
    background: rgba(255,255,255,0.05);
    width: 100%;
}
.progress-bar {
    height: 100%;
    background: var(--accent-neon);
    width: 100%; /* Will animate via JS */
    box-shadow: 0 0 10px var(--accent-neon);
    transition: width 1s linear;
}

/* Icon Buttons (PR and Video) */
.ex-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.icon-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); }
.trophy-btn { color: #ffd700; background: rgba(255, 215, 0, 0.1); border-color: rgba(255, 215, 0, 0.3);}

/* Video Modal */
.video-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.video-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.video-modal-content {
    background: var(--bg-card-header);
    border-top: 1px solid var(--border-subtle);
    border-radius: 20px 20px 0 0;
    width: 100%;
    padding: 30px 20px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.video-modal-overlay.active .video-modal-content {
    transform: translateY(0);
}

.video-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.video-modal-header h3 { font-size: 1.1rem; margin: 0;}
.close-modal-btn {
    background: var(--input-bg);
    border: none;
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
}

.video-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
}
.youtube-placeholder span {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.video-cues h4 { margin-bottom: 10px; color: var(--accent-neon); font-size: 0.9rem;}
.video-cues ul { padding-left: 20px; font-size: 0.9rem; line-height: 1.5; color: var(--text-muted);}
