/* styles.css - IronLog Gym Design System */
:root {
    --bg-base: #090a0f;
    --bg-surface: #12141d;
    --bg-surface-elevated: #1a1e2b;
    --bg-surface-active: #222838;
    
    --border-subtle: #1e2333;
    --border-focus: #10b981;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.25);
    --accent-amber: #f59e0b;
    --accent-indigo: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-rose: #f43f5e;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* App Header */
header {
    background-color: rgba(18, 20, 29, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 15px;
    color: #000;
    box-shadow: 0 0 12px var(--accent-emerald-glow);
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Main Container & Views */
main {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 90px; /* Space for bottom nav & floating timer */
}

.view-section {
    display: none;
    animation: fadeIn 0.2s ease-out;
}

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

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

/* Bottom Navigation */
nav.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(18, 20, 29, 0.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-around;
    padding: 8px 12px;
    z-index: 50;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-btn .icon {
    font-size: 20px;
}

.nav-btn.active {
    color: var(--accent-emerald);
}

.nav-btn.active .icon {
    transform: scale(1.1);
}

/* Cards & Containers */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Exercise Cards inside Active Workout */
.exercise-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 14px;
    transition: border-color 0.2s;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.exercise-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.prev-perf-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.prev-perf-hint span {
    color: var(--accent-cyan);
    font-weight: 600;
}

.badge-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--accent-indigo);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Sets Table */
.sets-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.set-row-header {
    display: grid;
    grid-template-columns: 36px 1fr 1fr 44px 44px;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    padding-bottom: 4px;
}

.set-row {
    display: grid;
    grid-template-columns: 36px 1fr 1fr 44px 44px;
    gap: 8px;
    align-items: center;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 6px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.set-row.completed {
    background-color: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
}

.set-num {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
}

.set-input {
    background-color: var(--bg-base);
    border: 1px solid var(--border-subtle);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    width: 100%;
    outline: none;
}

.set-input:focus {
    border-color: var(--accent-emerald);
}

.btn-check-set {
    background-color: var(--bg-surface-active);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-check-set:active {
    transform: scale(0.92);
}

.set-row.completed .btn-check-set {
    background-color: var(--accent-emerald);
    border-color: var(--accent-emerald);
    color: #000;
    font-weight: 900;
}

.btn-remove-set {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-set:hover {
    color: var(--accent-rose);
}

/* Action Buttons */
.btn {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 13px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: var(--accent-emerald);
    color: #000;
    box-shadow: 0 2px 10px var(--accent-emerald-glow);
}

.btn-secondary {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.btn-danger {
    background-color: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--accent-rose);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}

/* Floating Rest Timer Bar */
#floatingTimerBar {
    position: fixed;
    bottom: 64px;
    left: 16px;
    right: 16px;
    max-width: 480px;
    margin: 0 auto;
    background: rgba(18, 20, 29, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--accent-amber);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 45;
    animation: slideUp 0.25s ease-out;
}

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

#floatingTimerBar.hidden {
    display: none !important;
}

.timer-digits {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 900;
    color: var(--accent-amber);
    letter-spacing: 0.5px;
}

.timer-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.timer-pill-btn {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
}

.timer-pill-btn:active {
    transform: scale(0.92);
}

/* PR Badge Animation */
.pr-badge {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    animation: pulsePR 1.5s infinite alternate;
}

@keyframes pulsePR {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

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

.modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

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

/* Search input */
.search-bar {
    width: 100%;
    background-color: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: #fff;
    font-size: 13px;
    outline: none;
    margin-bottom: 12px;
}

.search-bar:focus {
    border-color: var(--accent-emerald);
}

/* Category Filter Pills */
.filter-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.filter-pill.active {
    background-color: var(--accent-emerald);
    color: #000;
    border-color: var(--accent-emerald);
}

/* History Cards */
.history-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 12px;
}

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

.history-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.history-date {
    font-size: 11px;
    color: var(--text-muted);
}

.history-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.history-stats b {
    color: #fff;
}

.sync-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.sync-pending {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.sync-done {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
