/* CTG (Control The Gym) Design System
   Responsive Web Application + Installable PWA
   Brand: Navy #16284d, Gold #b8893f, Cream #f7f4ed. No orange.
*/

:root {
    --ctg-navy: #16284d;
    --ctg-navy-dark: #0f1c36;
    --ctg-navy-light: #223863;
    --ctg-gold: #b8893f;
    --ctg-gold-light: #d6a860;
    --ctg-cream: #f7f4ed;
    --ctg-cream-card: #ffffff;
    --ctg-rose: #d9534f;
    --ctg-rose-bg: #fff5f5;
    --ctg-rose-border: #fed7d7;
    --ctg-green: #38a169;
    --ctg-green-bg: #f0fff4;
    --ctg-green-border: #c6f6d5;
    --ctg-grey-text: #718096;
    --ctg-grey-border: #e2e8f0;
    --ctg-grey-bg: #edf2f7;
    --ctg-font: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --ctg-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --ctg-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--ctg-font);
    background-color: #f3efe6;
    color: #1a202c;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Developer Quick Switcher Top Bar */
.ctg-topbar {
    background: #0b1528;
    color: #f7f4ed;
    padding: 8px 24px;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 2px solid var(--ctg-gold);
    z-index: 1000;
}

.ctg-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.ctg-topbar-brand span.badge {
    background: var(--ctg-gold);
    color: #0b1528;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 800;
}

.ctg-role-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ctg-role-pill {
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.ctg-role-pill:hover,
.ctg-role-pill.active {
    background: var(--ctg-gold);
    color: #0b1528;
}

.ctg-screen-dropdown {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
}
.ctg-screen-dropdown option {
    background: #16284d;
    color: #ffffff;
}

/* Primary Desktop Navbar */
.desktop-navbar {
    background: var(--ctg-navy);
    color: #ffffff;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.desktop-nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.desktop-nav-brand .logo-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--ctg-gold);
    color: #0b1528;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 16px;
}

.desktop-nav-brand .brand-title {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
}

.desktop-nav-brand .brand-gym {
    font-size: 11px;
    color: #a0aec0;
}

.desktop-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.desktop-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 100%;
    color: #cbd5e0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
}

.desktop-nav-link:hover,
.desktop-nav-link.active {
    color: #ffffff;
    border-bottom-color: var(--ctg-gold);
    background: rgba(255, 255, 255, 0.04);
}

.desktop-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
}

.desktop-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #ffffff;
}

/* Web Application Viewport & Phone Simulation System */
.phone-frame-wrapper {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    position: relative;
    transition: all 0.25s ease;
}

.mobile-screen-header-bar {
    display: none;
}

.app-main-layout {
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* Mobile Frame Simulation Mode (When Toggled on Desktop) */
body.preview-phone-mode {
    background: #0f172a !important; /* Premium studio dark backdrop */
}

body.preview-phone-mode .desktop-navbar {
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.preview-phone-mode .phone-frame-wrapper {
    max-width: 412px;
    height: 840px;
    max-height: calc(100vh - 90px);
    margin: 16px auto 30px;
    background: var(--ctg-cream);
    border-radius: 36px;
    border: 8px solid #1e293b;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

body.preview-phone-mode .mobile-screen-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--ctg-navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

body.preview-phone-mode .app-main-layout {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 76px;
    max-width: 100%;
    margin: 0;
    background: var(--ctg-cream);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

body.preview-phone-mode .app-main-layout::-webkit-scrollbar {
    width: 5px;
}
body.preview-phone-mode .app-main-layout::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

body.preview-phone-mode .bottom-nav {
    display: flex !important;
    position: absolute !important;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--ctg-grey-border);
    height: 62px;
    z-index: 90;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

body.preview-phone-mode .dashboard-grid-4,
body.preview-phone-mode .dashboard-grid-3,
body.preview-phone-mode .dashboard-grid-2 {
    grid-template-columns: 1fr !important;
}

/* Sub-header inside views */
.app-header {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--ctg-grey-border);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--ctg-shadow);
}

.app-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--ctg-navy);
    line-height: 1.2;
}

.app-header .subheading {
    font-size: 13px;
    color: var(--ctg-grey-text);
    margin-top: 2px;
}

.app-content {
    display: block;
}

/* Responsive Grid System */
.dashboard-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .desktop-navbar {
        display: none !important;
    }
    .phone-frame-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
    .mobile-screen-header-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        background: var(--ctg-navy);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }
    .app-main-layout {
        padding: 12px 10px 84px;
        max-width: 100%;
    }
    .dashboard-grid-4,
    .dashboard-grid-3,
    .dashboard-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Bottom Navigation Bar (Mobile / PWA only) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid var(--ctg-grey-border);
    justify-content: space-around;
    align-items: center;
    z-index: 50;
    padding: 0 4px;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #718096;
    font-size: 11px;
    font-weight: 600;
    position: relative;
    padding: 6px 4px;
    min-width: 48px;
    min-height: 44px;
    transition: color 0.15s ease;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
    fill: currentColor;
}

.nav-item.active {
    color: var(--ctg-navy);
}

.nav-badge {
    position: absolute;
    top: 2px;
    right: 6px;
    background: var(--ctg-rose);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
}

/* Generic Card Styles */
.ctg-card {
    background: var(--ctg-cream-card);
    border-radius: 14px;
    border: 1px solid var(--ctg-grey-border);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--ctg-shadow);
}

.ctg-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ctg-card-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 800;
    color: var(--ctg-grey-text);
}

.ctg-big-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--ctg-navy);
    line-height: 1.1;
}

.ctg-card-link {
    display: inline-block;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ctg-gold);
    text-decoration: none;
}

.ctg-card-link:hover {
    text-decoration: underline;
}

/* Buttons */
.ctg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
    font-family: inherit;
}

.ctg-btn-primary {
    background: var(--ctg-navy);
    color: #ffffff;
}

.ctg-btn-primary:hover {
    background: var(--ctg-navy-dark);
}

.ctg-btn-gold {
    background: var(--ctg-gold);
    color: #0b1528;
}

.ctg-btn-gold:hover {
    background: var(--ctg-gold-light);
}

.ctg-btn-outline {
    background: transparent;
    border: 1.5px solid var(--ctg-navy);
    color: var(--ctg-navy);
}

.ctg-btn-block {
    width: 100%;
}

.ctg-btn-sm {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 12px;
}

/* Overdue Gentle Pulse Animation (PRD PEND-04, Wireframe Screen 2) */
@keyframes gentlePulse {
    0% {
        opacity: 1;
        background-color: rgba(217, 83, 79, 0.10);
    }
    50% {
        opacity: 0.70;
        background-color: rgba(217, 83, 79, 0.24);
    }
    100% {
        opacity: 1;
        background-color: rgba(217, 83, 79, 0.10);
    }
}

.overdue-pulse-card {
    border-left: 4px solid var(--ctg-rose) !important;
    animation: gentlePulse 2s infinite ease-in-out;
}

.overdue-pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--ctg-rose);
    display: inline-block;
    animation: gentlePulse 2s infinite ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
    .overdue-pulse-card,
    .overdue-pulse-dot {
        animation: none !important;
        background-color: rgba(217, 83, 79, 0.12) !important;
    }
}

/* Pills & Tags */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.pill-green {
    background: var(--ctg-green-bg);
    color: var(--ctg-green);
    border: 1px solid var(--ctg-green-border);
}

.pill-rose {
    background: var(--ctg-rose-bg);
    color: var(--ctg-rose);
    border: 1px solid var(--ctg-rose-border);
}

.pill-grey {
    background: var(--ctg-grey-bg);
    color: var(--ctg-grey-text);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

.modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    border-radius: 16px;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--ctg-shadow-lg);
}

.wizard-steps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ctg-grey-border);
}

.wizard-step-indicator {
    font-size: 13px;
    font-weight: 700;
    color: var(--ctg-gold);
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 6px;
}

.form-label span.req {
    color: var(--ctg-rose);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    font-family: inherit;
    font-size: 14px;
    background: #ffffff;
}

.form-control:focus {
    outline: none;
    border-color: var(--ctg-navy);
    box-shadow: 0 0 0 2px rgba(22, 40, 77, 0.2);
}

/* PIN Keypad */
.pin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 240px;
    margin: 16px auto;
}

.pin-btn {
    height: 52px;
    font-size: 20px;
    font-weight: 700;
    background: var(--ctg-grey-bg);
    border: 1px solid var(--ctg-grey-border);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.pin-btn:hover {
    background: #e2e8f0;
}

.pin-display {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--ctg-navy);
}

.pin-dot.filled {
    background: var(--ctg-navy);
}

/* Desk Actions Grid */
.desk-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.desk-action-btn {
    background: #ffffff;
    border: 1px solid var(--ctg-grey-border);
    border-radius: 14px;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--ctg-navy);
    font-weight: 700;
    font-size: 13px;
    box-shadow: var(--ctg-shadow);
    transition: transform 0.15s ease, border-color 0.2s ease;
    cursor: pointer;
}

.desk-action-btn:hover {
    transform: translateY(-2px);
    border-color: var(--ctg-gold);
}

.desk-action-btn .btn-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #ebf0f8;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 20px;
}

/* Timer Running (Screen 19) */
.workout-timer-circle {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 8px solid var(--ctg-gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 24px auto;
    background: #ffffff;
    box-shadow: var(--ctg-shadow-lg);
}

.workout-timer-text {
    font-size: 36px;
    font-weight: 800;
    color: var(--ctg-navy);
    font-variant-numeric: tabular-nums;
}
