/* ═══════════════════════════════════════
   VARIABLES & RESET
═══════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --black: #ffffff;
    --dark: #f5f5f7;
    --dark-2: #eeeeef;
    --dark-3: #e5e5e7;
    --dark-4: #d5d5d7;
    --gray: #777777;
    --light-gray: #555555;
    --white: #1a1a1a;
    --accent: #10b981;
    --accent-dim: rgba(16, 185, 129, 0.1);
    --accent-glow: rgba(16, 185, 129, 0.3);
    --gradient: linear-gradient(135deg, #10b981, #059669);
    --radius: 12px;
    --radius-lg: 20px;
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.08);
    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.08);
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.08);
}

/* Inline style helpers — JS uses these via var() */
/* (Duplicate of main vars but needed for inline style consistency) */

/* Dark mode override */
[data-theme="dark"] {
    --black: #0a0a0a;
    --dark: #111111;
    --dark-2: #1a1a1a;
    --dark-3: #222222;
    --dark-4: #2a2a2a;
    --gray: #888888;
    --light-gray: #aaaaaa;
    --white: #f0f0f0;
    --accent: #39ff14;
    --accent-dim: rgba(57, 255, 20, 0.15);
    --accent-glow: rgba(57, 255, 20, 0.4);
    --gradient: linear-gradient(135deg, #39ff14, #00e676);
    --danger: #ff4444;
    --danger-dim: rgba(255, 68, 68, 0.15);
    --warning: #ffaa00;
    --warning-dim: rgba(255, 170, 0, 0.15);
    --blue: #4488ff;
    --blue-dim: rgba(68, 136, 255, 0.15);
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--black);
    color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.15; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }
p { color: var(--light-gray); }
.accent { color: var(--accent); }

/* ═══════════════════════════════════════
   SCREENS — show/hide
═══════════════════════════════════════ */
.screen { display: none; }
.screen.active { display: flex; }

/* ═══════════════════════════════════════
   LOGIN
═══════════════════════════════════════ */
.login-screen {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.login-screen::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0.1;
    pointer-events: none;
}
.login-card {
    background: var(--dark);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 2;
}
.login-logo {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}
.login-logo span { color: var(--accent); }
.login-subtitle {
    text-align: center;
    font-size: 0.92rem;
    color: var(--gray);
    margin-bottom: 36px;
}
.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0;
    color: var(--gray);
    font-size: 0.8rem;
}
.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0,0,0,0.08);
}
.quick-access-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray);
    margin-bottom: 14px;
    text-align: center;
}
.quick-btn {
    width: 100%;
    padding: 16px 20px;
    border-radius: var(--radius);
    border: 1px solid rgba(0,0,0,0.08);
    background: var(--dark-2);
    color: var(--white);
    font-family: inherit;
    font-size: 0.92rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
    transition: border-color 0.3s, background 0.3s, transform 0.2s;
}
.quick-btn:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: translateX(4px);
}
.quick-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}
.quick-btn-icon.plat { background: var(--accent-dim); color: var(--accent); }
.quick-btn-icon.gym { background: var(--blue-dim); color: var(--blue); }
.quick-btn-icon.client { background: var(--warning-dim); color: var(--warning); }
.quick-btn-info { text-align: left; }
.quick-btn-email { font-weight: 600; font-size: 0.88rem; }
.quick-btn-role { font-size: 0.75rem; color: var(--gray); }
.quick-btn-arrow { margin-left: auto; color: var(--gray); font-size: 1.2rem; transition: color 0.3s; }
.quick-btn:hover .quick-btn-arrow { color: var(--accent); }

/* ═══════════════════════════════════════
   FORMS (shared)
═══════════════════════════════════════ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray);
}
.form-group input, .form-group select {
    padding: 14px 16px;
    background: var(--dark-2);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius);
    color: var(--white);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}
.form-group input::placeholder { color: var(--gray); }
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient);
    color: var(--black);
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.3s, box-shadow 0.3s;
    margin-top: 8px;
}
.form-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

/* ═══════════════════════════════════════
   REQUEST & WAITING SCREENS
═══════════════════════════════════════ */
.request-screen, .waiting-screen {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
}
.request-card, .waiting-card {
    background: var(--dark);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 500px;
    text-align: center;
}
.request-card h2, .waiting-card h2 { margin-bottom: 10px; font-size: 1.5rem; }
.request-card p, .waiting-card p { margin-bottom: 28px; }
.request-form { text-align: left; }
.waiting-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: pulse 2s infinite;
}
.waiting-icon svg { width: 36px; height: 36px; stroke: var(--accent); fill: none; stroke-width: 2; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { box-shadow: 0 0 0 20px transparent; }
}
.back-btn {
    margin-top: 20px;
    background: none;
    border: 1px solid rgba(0,0,0,0.08);
    color: var(--gray);
    padding: 10px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: border-color 0.3s, color 0.3s;
}
.back-btn:hover { border-color: var(--accent); color: var(--white); }

/* ═══════════════════════════════════════
   SIDEBAR LAYOUT (Platform + Gym)
═══════════════════════════════════════ */
.app-layout { min-height: 100vh; }
.sidebar {
    width: 260px;
    background: var(--dark);
    border-right: 1px solid rgba(0,0,0,0.06);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}
.sidebar-logo {
    font-size: 1.2rem;
    font-weight: 800;
    padding: 0 24px;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}
.sidebar-logo span { color: var(--accent); }
.sidebar-role {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray);
    padding: 0 24px;
    margin-bottom: 28px;
}
.sidebar-nav { flex: 1; }
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--gray);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.sidebar-nav-item:hover { color: var(--white); background: rgba(0,0,0,0.03); }
.sidebar-nav-item.active {
    color: var(--accent);
    background: var(--accent-dim);
    border-right: 3px solid var(--accent);
}
.sidebar-nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
.sidebar-logout {
    margin: 16px 24px 0;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(0,0,0,0.06);
    background: var(--dark-2);
    color: var(--gray);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}
.sidebar-logout:hover { border-color: var(--danger); color: var(--danger); }
.sidebar-logout svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
}

.page-header { margin-bottom: 32px; }
.page-header h2 { font-size: 1.6rem; margin-bottom: 6px; }

/* ═══════════════════════════════════════
   PANELS — show/hide sections
═══════════════════════════════════════ */
.panel-section { display: none; }
.panel-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   METRIC CARDS
═══════════════════════════════════════ */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.metric-card {
    background: var(--dark);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius);
    padding: 24px;
}
.metric-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray);
    margin-bottom: 8px;
}
.metric-value {
    font-size: 2rem;
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.metric-value.danger { background: none; -webkit-text-fill-color: var(--danger); }
.metric-value.warning { background: none; -webkit-text-fill-color: var(--warning); }
.metric-sub { font-size: 0.78rem; color: var(--gray); margin-top: 4px; }

/* ═══════════════════════════════════════
   DATA TABLES
═══════════════════════════════════════ */
.data-table-wrapper {
    background: var(--dark);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    padding: 16px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.data-table tbody td {
    padding: 14px 20px;
    font-size: 0.88rem;
    color: var(--light-gray);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: rgba(0,0,0,0.02); }

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-green { background: var(--accent-dim); color: var(--accent); }
.badge-red { background: var(--danger-dim); color: var(--danger); }
.badge-yellow { background: var(--warning-dim); color: var(--warning); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-gray { background: rgba(136,136,136,0.15); color: var(--gray); }

/* ═══════════════════════════════════════
   ACTION BUTTONS
═══════════════════════════════════════ */
.action-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}
.action-btn:hover { transform: scale(1.05); }
.action-btn:active { transform: scale(0.97); }
.action-btn.green { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(57,255,20,0.2); }
.action-btn.red { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(255,68,68,0.2); }
.action-btn.blue { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(68,136,255,0.2); }
.action-btn.yellow { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(255,170,0,0.2); }
.action-btn.primary { background: var(--gradient); color: var(--black); border: none; padding: 8px 18px; }
.action-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══════════════════════════════════════
   TABS
═══════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--gray);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--white); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ═══════════════════════════════════════
   PODIUM (Gym rankings)
═══════════════════════════════════════ */
.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin: 20px 0 30px;
    height: 200px;
}
.podium-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.podium-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--dark-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    margin-bottom: 6px;
    border: 2px solid var(--dark-4);
}
.podium-item:nth-child(2) .podium-avatar { border-color: #ffd700; width: 56px; height: 56px; }
.podium-item:nth-child(1) .podium-avatar { border-color: #c0c0c0; }
.podium-item:nth-child(3) .podium-avatar { border-color: #cd7f32; }
.podium-name { font-size: 0.8rem; font-weight: 700; margin-bottom: 4px; }
.podium-weight { font-size: 0.82rem; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.podium-bar { width: 80px; border-radius: 8px 8px 0 0; }
.podium-item:nth-child(1) .podium-bar { height: 80px; background: rgba(192,192,192,0.2); }
.podium-item:nth-child(2) .podium-bar { height: 110px; background: rgba(255,215,0,0.2); }
.podium-item:nth-child(3) .podium-bar { height: 60px; background: rgba(205,127,50,0.2); }

/* ═══════════════════════════════════════
   GYM CUSTOMIZATION
═══════════════════════════════════════ */
.color-picker-row { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--white); }
.preview-card {
    background: var(--dark-2);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
    text-align: center;
}
.logo-upload-area {
    width: 100%;
    height: 120px;
    border: 2px dashed rgba(0,0,0,0.08);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: var(--gray);
    font-size: 0.85rem;
    transition: border-color 0.3s;
    margin-bottom: 16px;
}
.logo-upload-area:hover { border-color: var(--accent); }
.logo-upload-area svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ═══════════════════════════════════════
   CLIENT MOBILE VIEW
═══════════════════════════════════════ */
.client-app {
    min-height: 100vh;
    background: var(--black);
    justify-content: center;
    padding: 20px;
}
.mobile-frame {
    width: 100%;
    max-width: 390px;
    background: var(--dark);
    border-radius: 30px;
    border: 2px solid var(--dark-4);
    min-height: 90vh;
    position: relative;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.12);
}
.mobile-statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--white);
}
.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 20px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.mobile-header-gym { display: flex; align-items: center; gap: 10px; }
.mobile-gym-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.8rem;
    color: var(--black);
}
.mobile-gym-name { font-weight: 700; font-size: 0.95rem; }
.mobile-gym-sub { font-size: 0.7rem; color: var(--gray); }
.mobile-logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray);
    padding: 6px;
    transition: color 0.2s;
}
.mobile-logout-btn:hover { color: var(--danger); }
.mobile-logout-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

.mobile-body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: calc(90vh - 160px);
}
.mobile-card {
    background: var(--dark-2);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 12px;
}
.mobile-card-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray);
    margin-bottom: 12px;
}

/* Streak */
.streak-display { display: flex; align-items: center; gap: 14px; }
.streak-fire { font-size: 2.2rem; line-height: 1; animation: fireAnim 1s infinite alternate; }
@keyframes fireAnim {
    from { transform: scale(1) rotate(-3deg); }
    to { transform: scale(1.1) rotate(3deg); }
}
.streak-number { font-size: 2rem; font-weight: 900; color: var(--accent); line-height: 1; }
.streak-label { font-size: 0.82rem; color: var(--gray); }

/* Exercises */
.exercise-item { padding: 12px 0; border-bottom: 1px solid rgba(0,0,0,0.04); }
.exercise-item:last-child { border-bottom: none; }
.exercise-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.exercise-name { font-weight: 700; font-size: 0.92rem; color: var(--white); }
.exercise-weight { font-weight: 800; color: var(--accent); font-size: 0.95rem; }
.exercise-detail { font-size: 0.78rem; color: var(--gray); }
.exercise-prev { font-size: 0.72rem; color: var(--gray); font-style: italic; margin-bottom: 6px; }
.exercise-gif {
    width: 100%;
    height: 120px;
    background: var(--dark-3);
    border-radius: 10px;
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--gray);
    font-size: 0.75rem;
    position: relative;
    overflow: hidden;
}
.exercise-gif::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(57,255,20,0.03), transparent);
    animation: shimmer 2s infinite;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.exercise-gif svg { width: 28px; height: 28px; stroke: var(--gray); fill: none; stroke-width: 1.5; opacity: 0.5; }
.exercise-muscles { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.muscle-tag {
    font-size: 0.65rem;
    padding: 3px 8px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 50px;
    font-weight: 600;
}
.complete-btn {
    width: 100%;
    padding: 10px;
    background: var(--dark-3);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    color: var(--gray);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.3s;
}
.complete-btn:hover { border-color: var(--accent); color: var(--accent); }
.complete-btn.done { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* PR items */
.pr-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.pr-item:last-child { border-bottom: none; }
.pr-name { font-weight: 600; font-size: 0.9rem; }
.pr-value { font-weight: 800; color: var(--accent); }
.pr-date { font-size: 0.7rem; color: var(--gray); }

/* Chart */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 150px;
    padding-top: 10px;
}
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-bar {
    width: 100%;
    background: var(--gradient);
    border-radius: 6px 6px 0 0;
    min-height: 8px;
    transition: height 0.5s ease;
    opacity: 0.8;
}
.chart-bar-label { font-size: 0.65rem; color: var(--gray); }
.chart-bar-value { font-size: 0.68rem; font-weight: 700; color: var(--accent); }

/* Rankings in mobile */
.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.rank-item:last-child { border-bottom: none; }
.rank-pos {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.8rem;
    background: var(--dark-3);
    color: var(--gray);
    flex-shrink: 0;
}
.rank-pos.gold { background: rgba(255,215,0,0.2); color: #ffd700; }
.rank-pos.silver { background: rgba(192,192,192,0.2); color: #c0c0c0; }
.rank-pos.bronze { background: rgba(205,127,50,0.2); color: #cd7f32; }
.rank-pos.me { background: var(--accent-dim); color: var(--accent); }
.rank-name { flex: 1; font-weight: 600; font-size: 0.88rem; }
.rank-name.me { color: var(--accent); }
.rank-weight { font-weight: 800; color: var(--white); font-size: 0.9rem; }

/* Profile */
.profile-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.profile-stat:last-child { border-bottom: none; }
.profile-stat-label { color: var(--gray); font-size: 0.85rem; }
.profile-stat-value { font-weight: 700; font-size: 0.88rem; color: var(--white); }

.level-bar-container { margin: 8px 0; }
.level-bar-label { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 4px; }
.level-bar-label span:first-child { color: var(--light-gray); }
.level-bar-label span:last-child { color: var(--accent); font-weight: 700; }
.level-bar { height: 6px; background: var(--dark-3); border-radius: 3px; overflow: hidden; }
.level-bar-fill { height: 100%; background: var(--gradient); border-radius: 3px; }

/* Week summary */
.week-summary { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day { text-align: center; padding: 8px 0; border-radius: 8px; font-size: 0.7rem; font-weight: 600; }
.week-day-label { color: var(--gray); margin-bottom: 4px; }
.week-day-dot { width: 8px; height: 8px; border-radius: 50%; margin: 4px auto 0; }
.week-day.done .week-day-dot { background: var(--accent); }
.week-day.rest .week-day-dot { background: var(--dark-4); }
.week-day.today { background: var(--accent-dim); }

/* Mobile bottom nav */
.mobile-nav {
    display: flex;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: var(--dark);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}
.mobile-nav-item {
    flex: 1;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--gray);
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}
.mobile-nav-item:hover { color: var(--white); }
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    background: var(--dark);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
}
.mobile-sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--white);
    margin: 4px 0;
    border-radius: 2px;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 90;
}
.sidebar-overlay.active { display: block; }

/* ═══════════════════════════════════════
   ONBOARDING
═══════════════════════════════════════ */
.onboarding-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.onboarding-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--dark-3);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    color: var(--white);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s, transform 0.2s;
    text-align: left;
    width: 100%;
}
.onboarding-option:hover {
    border-color: rgba(57, 255, 20, 0.3);
    background: var(--accent-dim);
}
.onboarding-option.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: scale(0.98);
}
.onboarding-option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray);
    border-radius: 50%;
    flex-shrink: 0;
    transition: border-color 0.3s, background 0.3s;
}
.onboarding-option.selected .onboarding-option-radio {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: inset 0 0 0 3px var(--dark-3);
}
.onboarding-back {
    display: block;
    margin: 12px auto 0;
    background: none;
    border: none;
    color: var(--gray);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 8px 16px;
    transition: color 0.2s;
}
.onboarding-back:hover { color: var(--white); }

/* ═══════════════════════════════════════
   PR CELEBRATION
═══════════════════════════════════════ */
.pr-celebration {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.pr-celebration-content {
    text-align: center;
    padding: 40px;
    animation: prBounce 0.5s ease;
}
.pr-celebration-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: prSpin 1s ease;
}
.pr-celebration-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
.pr-celebration-exercise {
    font-size: 1.1rem;
    color: var(--white);
    font-weight: 600;
    margin-bottom: 4px;
}
.pr-celebration-weight {
    font-size: 2.5rem;
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.pr-celebration-prev {
    font-size: 0.88rem;
    color: var(--gray);
}
@keyframes prBounce {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes prSpin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════ */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    background: var(--black);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 360px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}
.toast-notification.toast-show { transform: translateX(0); }
.toast-notification.toast-pr { border-color: rgba(57,255,20,0.3); }
.toast-notification.toast-streak { border-color: rgba(255,170,0,0.3); }
.toast-notification.toast-inactivity { border-color: rgba(255,68,68,0.3); }
.toast-notification.toast-danger { border-color: rgba(255,68,68,0.5); background: rgba(255,68,68,0.05); }
.toast-icon { font-size: 1.5rem; flex-shrink: 0; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; font-size: 0.88rem; color: var(--white); margin-bottom: 2px; }
.toast-message { font-size: 0.78rem; color: var(--gray); }
.toast-close {
    background: none;
    border: none;
    color: var(--gray);
    font-size: 1.2rem;
    cursor: pointer;
    flex-shrink: 0;
    /* Minimum 44×44 touch target so it's tappable on mobile (accessibility). */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toast-close:hover { color: var(--white); }

/* Textarea for messages */
textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ═══════════════════════════════════════
   NUTRITION
═══════════════════════════════════════ */
.calorie-ring-container { display: flex; justify-content: center; margin: 10px 0 18px; }
.calorie-ring { position: relative; width: 120px; height: 120px; }
.calorie-ring svg { width: 100%; height: 100%; }
.calorie-ring-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.calorie-ring-number { font-size: 1.6rem; font-weight: 900; color: var(--white); line-height: 1; }
.calorie-ring-label { font-size: 0.68rem; color: var(--gray); }

.macro-bars { display: flex; flex-direction: column; gap: 10px; }
.macro-bar-row {}
.macro-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    margin-bottom: 4px;
}
.macro-bar-track {
    height: 8px;
    background: var(--dark-3);
    border-radius: 4px;
    overflow: hidden;
}
.macro-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.food-result-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--dark-3);
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    color: inherit;
    transition: border-color 0.2s, background 0.2s;
}
.food-result-item:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.photo-capture-btn:hover {
    background: var(--accent-dim) !important;
}

/* ═══════════════════════════════════════
   YEAR CALENDAR
═══════════════════════════════════════ */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.cal-header {
    text-align: center;
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--gray);
    padding: 2px 0;
}
.cal-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    min-height: 0;
}
.cal-empty { background: transparent; }
.cal-done { background: var(--accent); opacity: 0.85; }
.cal-rest { background: var(--dark-3); }
.cal-future { background: var(--dark-2); opacity: 0.3; }
.cal-today {
    outline: 2px solid var(--white);
    outline-offset: -1px;
}

/* ═══════════════════════════════════════
   WRAPPED (Year Summary)
═══════════════════════════════════════ */
.wrapped-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.6s ease;
    cursor: pointer;
    user-select: none;
    /* Wrapped siempre en modo oscuro */
    --white: #f0f0f0;
    --gray: #888888;
    --accent: #39ff14;
    --accent-dim: rgba(57, 255, 20, 0.15);
    --gradient: linear-gradient(135deg, #39ff14, #00e676);
    --dark-3: #222222;
    color: #f0f0f0;
}
.wrapped-slide {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
    animation: wrappedFadeIn 0.5s ease;
}
.wrapped-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.wrapped-big-number {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.wrapped-progress {
    display: flex;
    gap: 6px;
    padding: 20px;
}
.wrapped-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.1);
    transition: all 0.3s;
}
.wrapped-dot.active {
    background: var(--accent);
    width: 24px;
    border-radius: 4px;
}
.wrapped-dot.done { background: rgba(57,255,20,0.4); }
.wrapped-nav-hint {
    font-size: 0.72rem;
    color: rgba(0,0,0,0.3);
    padding-bottom: 20px;
    height: 36px;
}
@keyframes wrappedFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.badge-item {
    text-align: center;
    padding: 14px 8px;
    border-radius: 14px;
    background: var(--dark-3);
    border: 1px solid rgba(0,0,0,0.04);
    transition: transform 0.2s;
}
.badge-item.earned { border-color: rgba(57,255,20,0.15); }
.badge-item.earned:hover { transform: scale(1.05); }
.badge-item.gym-badge { border-color: rgba(255,170,0,0.2); background: rgba(255,170,0,0.03); }
.badge-item.locked { opacity: 0.4; }
.badge-icon { font-size: 1.8rem; margin-bottom: 6px; }
.badge-name { font-size: 0.72rem; font-weight: 700; color: var(--white); margin-bottom: 2px; line-height: 1.2; }
.badge-desc { font-size: 0.62rem; color: var(--gray); line-height: 1.3; }

/* ═══════════════════════════════════════
   WORKOUT MODE SELECTOR
═══════════════════════════════════════ */
.workout-mode-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--dark-2);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    color: var(--white);
    text-align: left;
    margin-bottom: 10px;
    transition: border-color 0.3s, transform 0.2s, background 0.2s;
}
.workout-mode-btn:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: translateX(4px);
}
.workout-mode-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.workout-mode-info { flex: 1; min-width: 0; }
.workout-mode-title { font-weight: 700; font-size: 1rem; margin-bottom: 2px; }
.workout-mode-desc { font-size: 0.78rem; color: var(--gray); line-height: 1.4; }

/* ═══════════════════════════════════════
   THEME TOGGLE
═══════════════════════════════════════ */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 900;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--dark);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform 0.3s, box-shadow 0.3s;
}
.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
[data-theme="dark"] .theme-toggle {
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ═══════════════════════════════════════
   RANKS & MUSCLE MAP
═══════════════════════════════════════ */
.rank-icon-pulse { animation: rankPulse 3s ease-in-out infinite; display: inline-block; }
@keyframes rankPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.rank-bronce { animation: rankRotate 20s linear infinite; }
.rank-plata { animation: rankShine 4s ease-in-out infinite; }
.rank-oro { animation: rankPulse 3s ease-in-out infinite; }
.rank-platino { animation: rankFlip 6s ease-in-out infinite; }
.rank-diamante { animation: rankSparkle 2s ease-in-out infinite; }

@keyframes rankRotate { to { transform: rotate(360deg); } }
@keyframes rankShine { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.4); } }
@keyframes rankFlip { 0%,100% { transform: perspective(200px) rotateY(0deg); } 50% { transform: perspective(200px) rotateY(15deg); } }
@keyframes rankSparkle { 0%,100% { filter: brightness(1) drop-shadow(0 0 2px #00FFFF); } 50% { filter: brightness(1.3) drop-shadow(0 0 8px #00FFFF); } }

/* Muscle detail slide-up panel */
.muscle-detail-panel {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 390px;
    background: var(--dark);
    border: 1px solid var(--dark-4);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    z-index: 1500;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
    transition: transform 0.35s ease;
}
.muscle-detail-panel.show { transform: translateX(-50%) translateY(0); }
.muscle-detail-header { display: flex; justify-content: space-between; align-items: center; }

/* Rank up celebration */
.rankup-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.rankup-content { text-align: center; animation: prBounce 0.6s ease; }
.rankup-icon { margin-bottom: 20px; }
.rankup-title { font-size: 2rem; font-weight: 900; letter-spacing: 0.05em; margin-bottom: 8px; }
.rankup-sub { font-size: 0.92rem; color: var(--gray); }

/* Confetti */
.confetti-particle {
    position: absolute;
    top: -10px;
    border-radius: 2px;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Exercise done state */
.exercise-done {
    opacity: 0.6;
    border-color: rgba(57, 255, 20, 0.15) !important;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    /* Push content below the device notch/punch-hole when the gym/platform
       panel is opened on a phone. 60px already reserved for the hamburger. */
    .main-content {
        margin-left: 0;
        padding: calc(env(safe-area-inset-top, 0px) + 60px) calc(env(safe-area-inset-right, 0px) + 16px) calc(env(safe-area-inset-bottom, 0px) + 24px) calc(env(safe-area-inset-left, 0px) + 16px);
    }
    .mobile-sidebar-toggle { display: block; }
    .login-card { margin: 20px; padding: 32px 24px; }
    .metrics-row { grid-template-columns: 1fr 1fr; }
    .data-table { font-size: 0.8rem; }
    .data-table thead th, .data-table tbody td { padding: 10px 12px; }
}

/* ── Client app — full screen on real mobile devices ──
   Respect safe-area-inset-* so content doesn't slip under the notch,
   punch-hole camera, Dynamic Island or home-indicator bar on iOS/Android. */
@media (max-width: 500px) {
    .client-app {
        padding: 0;
        min-height: 100vh;
        min-height: 100dvh;
    }
    .mobile-frame {
        max-width: 100%;
        border-radius: 0;
        border: none;
        min-height: 100vh;
        min-height: 100dvh;
        box-shadow: none;
    }
    .mobile-statusbar {
        display: none;
    }
    .mobile-header {
        /* Push the header below the notch / punch-hole with a minimum of 12px
           so devices without a cutout still get breathing room. */
        padding: calc(env(safe-area-inset-top, 0px) + 12px) calc(env(safe-area-inset-right, 0px) + 16px) 12px calc(env(safe-area-inset-left, 0px) + 16px);
        position: sticky;
        top: 0;
        background: var(--dark);
        z-index: 10;
    }
    .mobile-body {
        padding: 12px calc(env(safe-area-inset-right, 0px) + 16px) 80px calc(env(safe-area-inset-left, 0px) + 16px);
        max-height: none;
        min-height: calc(100vh - 130px);
        min-height: calc(100dvh - 130px);
    }
    .mobile-card {
        padding: 16px;
        border-radius: 14px;
    }
    .mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        /* Bottom inset for home-indicator; left/right for landscape notches. */
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }
}

/* ── Small phones (SE, mini) ── */
@media (max-width: 375px) {
    .mobile-header {
        padding: calc(env(safe-area-inset-top, 0px) + 10px) calc(env(safe-area-inset-right, 0px) + 12px) 10px calc(env(safe-area-inset-left, 0px) + 12px);
    }
    .mobile-body {
        padding: 10px calc(env(safe-area-inset-right, 0px) + 12px) 80px calc(env(safe-area-inset-left, 0px) + 12px);
    }
    .mobile-card {
        padding: 14px;
        margin-bottom: 10px;
    }
    .mobile-gym-name { font-size: 0.85rem; }
    .mobile-nav-item { font-size: 0.58rem; }
}
