/* ========================================
   Spine Vital — Global Styles + App Theme
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    --sv-bg: #F0F6FF;
    --sv-card: #FFFFFF;
    --sv-teal: #00B8A9;
    --sv-teal-dark: #008F83;
    --sv-teal-light: #E0F7F5;
    --sv-blue: #1A73E8;
    --sv-blue-light: #E8F0FE;
    --sv-orange: #FF6B35;
    --sv-orange-light: #FFF0EB;
    --sv-green: #34A853;
    --sv-green-light: #E6F4EA;
    --sv-red: #EA4335;
    --sv-red-light: #FCE8E6;
    --sv-yellow: #FBBC04;
    --sv-text: #1C2B3A;
    --sv-sub: #5F7A95;
    --sv-border: #D8E8F5;
    --sv-shadow: 0 4px 24px rgba(0,100,180,0.10);
}

html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 70px; }

/* ========================================
   LANDING PAGE (index.php)
   ======================================== */
.hero-section {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding-top: 80px;
}
.step-circle {
    width: 60px; height: 60px; border-radius: 50%;
    background-color: var(--sv-teal); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: bold;
}
.about-icon-box { padding: 3rem; }

/* ========================================
   APP LAYOUT (dashboard pages)
   ======================================== */
.app-body {
    font-family: 'Nunito', sans-serif;
    background: var(--sv-bg);
    color: var(--sv-text);
    padding-bottom: 80px; /* bottom nav space */
    min-height: 100vh;
}

/* Top status bar */
.app-top-bar {
    background: linear-gradient(135deg, var(--sv-teal), var(--sv-teal-dark));
    padding: 14px 18px 12px;
    display: flex; justify-content: space-between; align-items: center;
    color: #fff;
}
.app-top-bar .user-info { display: flex; align-items: center; gap: 10px; }
.app-top-bar .user-avatar {
    width: 38px; height: 38px; border-radius: 12px;
    background: rgba(255,255,255,0.25);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.app-top-bar .user-name { font-weight: 900; font-size: 15px; }
.app-top-bar .user-stats { font-size: 11px; color: rgba(255,255,255,0.8); }

/* App title bar */
.app-title-bar {
    background: linear-gradient(135deg, var(--sv-teal), var(--sv-teal-dark));
    text-align: center; padding-bottom: 16px; padding-top: 4px;
}
.app-title-bar .brand { font-weight: 900; font-size: 26px; color: #fff; }
.app-title-bar .brand-accent { color: var(--sv-yellow); }
.app-title-bar .page-label { font-size: 11px; color: rgba(255,255,255,0.75); margin-top: 2px; }

/* Alert banners */
.app-banner {
    padding: 9px 18px; display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.app-banner .banner-icon { font-size: 16px; }
.app-banner .banner-title { font-weight: 800; font-size: 12px; }
.app-banner .banner-desc { font-size: 11px; color: var(--sv-sub); }
.app-banner .banner-arrow { font-weight: 900; }
.app-banner-warn { background: var(--sv-orange-light); border-bottom: 2px solid var(--sv-orange); }
.app-banner-warn .banner-title { color: var(--sv-orange); }
.app-banner-warn .banner-arrow { color: var(--sv-orange); }
.app-banner-info { background: var(--sv-blue-light); border-bottom: 2px solid var(--sv-blue); }
.app-banner-info .banner-title { color: var(--sv-blue); }
.app-banner-info .banner-arrow { color: var(--sv-blue); }

/* Content area */
.app-content { padding: 16px 14px; }

/* Bottom navigation */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 430px; background: #fff;
    border-top: 1px solid var(--sv-border);
    display: flex; padding: 7px 0 11px;
    box-shadow: 0 -4px 20px rgba(0,100,180,0.08);
    z-index: 1000;
}
.bottom-nav a {
    flex: 1; background: none; border: none;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 3px 0; text-decoration: none;
    font-family: 'Nunito', sans-serif;
}
.bottom-nav a .nav-icon {
    font-size: 20px; filter: grayscale(1) opacity(0.45); transition: filter 0.2s;
}
.bottom-nav a.active .nav-icon { filter: none; }
.bottom-nav a .nav-label {
    font-size: 8px; font-weight: 800; letter-spacing: 0.4px;
    color: var(--sv-sub); transition: color 0.2s;
}
.bottom-nav a.active .nav-label { color: var(--sv-teal); }
.bottom-nav a .nav-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--sv-teal); margin-top: 1px;
    display: none;
}
.bottom-nav a.active .nav-dot { display: block; }

/* ========================================
   CARDS
   ======================================== */
.sv-card {
    background: var(--sv-card); border-radius: 22px;
    padding: 18px; box-shadow: var(--sv-shadow); margin-bottom: 13px;
}
.sv-card-title {
    font-weight: 900; font-size: 15px; margin-bottom: 14px;
}
.sv-card-gradient {
    background: linear-gradient(135deg, var(--sv-teal), var(--sv-teal-dark));
    border-radius: 22px; padding: 16px 18px; margin-bottom: 14px;
    color: #fff; text-align: center;
}

/* ========================================
   GAUGE (SVG half-circle)
   ======================================== */
.gauge-wrapper { text-align: center; }
.gauge-label {
    margin-top: -8px; font-size: 19px; font-weight: 900;
    font-family: 'Nunito', sans-serif; transition: color 0.5s;
}
.gauge-sublabel { font-size: 12px; color: var(--sv-sub); margin-top: 3px; }

/* ========================================
   CIRCULAR PROGRESS
   ======================================== */
.circ-prog {
    position: relative; display: inline-block;
}
.circ-prog svg { transform: rotate(-90deg); }
.circ-prog .circ-content {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.circ-prog .circ-value {
    font-weight: 900; font-family: 'Nunito', sans-serif;
}
.circ-prog .circ-sub {
    font-size: 9px; color: var(--sv-sub); text-align: center; padding: 0 4px;
}

/* ========================================
   ANGLE BOXES
   ======================================== */
.angle-boxes { display: flex; gap: 10px; }
.angle-box {
    flex: 1; text-align: center; padding: 8px 4px;
    background: var(--sv-bg); border-radius: 12px;
}
.angle-box .angle-icon { font-size: 18px; margin-bottom: 2px; }
.angle-box .angle-val { font-weight: 900; font-size: 16px; }
.angle-box .angle-lbl { font-size: 9px; color: var(--sv-sub); }

/* ========================================
   EXERCISE CARD
   ======================================== */
.ex-card {
    border: 1.5px solid var(--sv-border); border-radius: 18px;
    padding: 13px 14px; margin-bottom: 10px;
    display: flex; align-items: center; gap: 12px;
    transition: all 0.3s; background: var(--sv-card);
}
.ex-card.done { background: var(--sv-green-light); border-color: var(--sv-green); }
.ex-card.active { border-color: var(--sv-orange); }
.ex-card .ex-ring { position: relative; flex-shrink: 0; width: 50px; height: 50px; }
.ex-card .ex-ring svg { transform: rotate(-90deg); }
.ex-card .ex-emoji {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.ex-card .ex-info { flex: 1; min-width: 0; }
.ex-card .ex-name { font-weight: 800; font-size: 13px; }
.ex-card .ex-desc { font-size: 11px; color: var(--sv-sub); margin-top: 1px; }
.ex-card .ex-meta { font-size: 11px; color: var(--sv-teal); margin-top: 3px; font-weight: 700; }
.ex-card .ex-done-badge {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--sv-green); display: flex; align-items: center;
    justify-content: center; color: #fff; font-size: 18px; flex-shrink: 0;
}
.ex-card .ex-countdown {
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--sv-orange); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 17px; flex-shrink: 0;
}
.ex-card .ex-start-btn {
    background: linear-gradient(135deg, var(--sv-teal), var(--sv-teal-dark));
    color: #fff; border: none; border-radius: 12px;
    padding: 8px 13px; font-weight: 800; font-size: 12px;
    cursor: pointer; font-family: 'Nunito', sans-serif; flex-shrink: 0;
}

/* ========================================
   TASK ITEMS
   ======================================== */
.task-item {
    display: flex; align-items: center; gap: 13px; margin-bottom: 10px;
    padding: 10px 13px; border-radius: 13px;
    background: #F8FBFF; border: 1.5px solid var(--sv-border);
    transition: all 0.25s; cursor: pointer;
}
.task-item.done { background: var(--sv-green-light); border-color: var(--sv-green); cursor: default; }
.task-check {
    width: 26px; height: 26px; border-radius: 8px;
    border: 2px solid var(--sv-border); background: var(--sv-card);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: #fff; flex-shrink: 0;
}
.task-item.done .task-check { background: var(--sv-green); border-color: var(--sv-green); }
.task-label { font-weight: 700; font-size: 13px; }
.task-pts { font-size: 11px; color: var(--sv-teal); font-weight: 700; }

/* ========================================
   RISK PROGRESS BARS
   ======================================== */
.risk-bar { margin-bottom: 14px; }
.risk-bar .risk-bar-header {
    display: flex; justify-content: space-between; margin-bottom: 5px;
}
.risk-bar .risk-bar-label { font-size: 13px; color: var(--sv-sub); }
.risk-bar .risk-bar-value { font-weight: 800; font-size: 13px; }
.risk-bar .risk-bar-track {
    height: 8px; background: var(--sv-border); border-radius: 4px; overflow: hidden;
}
.risk-bar .risk-bar-fill {
    height: 100%; border-radius: 4px; transition: width 0.8s;
}

/* ========================================
   BADGES
   ======================================== */
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sv-badge {
    border-radius: 16px; padding: 10px 6px; text-align: center;
    cursor: default; border: 2px solid #DDD; background: #F5F5F5; opacity: 0.45;
}
.sv-badge.earned {
    background: var(--sv-teal-light); border-color: var(--sv-teal); opacity: 1;
}
.sv-badge .badge-emoji { font-size: 24px; }
.sv-badge .badge-name {
    font-size: 9px; font-weight: 700; color: var(--sv-sub);
    margin-top: 3px; line-height: 1.3;
}
.sv-badge.earned .badge-name { color: var(--sv-teal-dark); }

/* ========================================
   PROFILE
   ======================================== */
.profile-card {
    background: linear-gradient(135deg, var(--sv-teal), var(--sv-teal-dark));
    border-radius: 22px; padding: 22px 18px; margin-bottom: 13px;
    text-align: center; color: #fff;
}
.profile-avatar {
    width: 70px; height: 70px; border-radius: 50%;
    background: rgba(255,255,255,0.25); margin: 0 auto 10px;
    display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.profile-name { font-weight: 900; font-size: 19px; }
.profile-meta { font-size: 12px; opacity: 0.8; margin-top: 2px; }
.profile-stats {
    margin-top: 14px; display: flex; justify-content: center; gap: 22px;
}
.profile-stats .stat-val { font-weight: 900; font-size: 21px; }
.profile-stats .stat-lbl { font-size: 10px; opacity: 0.8; }

/* Settings list */
.settings-list .setting-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 0; border-bottom: 1px solid var(--sv-border);
}
.settings-list .setting-row:last-child { border-bottom: none; }
.settings-list .setting-label { font-size: 13px; color: var(--sv-sub); }
.settings-list .setting-value { font-weight: 700; font-size: 12px; text-align: right; max-width: 200px; }

/* Toggle switch */
.sv-toggle {
    width: 50px; height: 28px; border-radius: 14px;
    position: relative; cursor: pointer; transition: background 0.3s;
    background: #CCC;
}
.sv-toggle.on { background: var(--sv-teal); }
.sv-toggle .sv-toggle-knob {
    width: 22px; height: 22px; border-radius: 50%;
    background: #fff; position: absolute; top: 3px; left: 3px;
    transition: left 0.3s; box-shadow: 0 2px 6px #0003;
}
.sv-toggle.on .sv-toggle-knob { left: 25px; }

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.8; transform:scale(1.04); } }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:.2; } }
.fu { animation: fadeUp 0.35s ease both; }
.pulse-anim { animation: pulse 2s ease-in-out infinite; }
.blink { animation: blink 1.4s ease-in-out infinite; }

/* ========================================
   CHART
   ======================================== */
.chart-container { position: relative; height: 300px; }

/* ========================================
   REPORT / INFO BOXES
   ======================================== */
.info-box {
    border-radius: 12px; padding: 10px 14px;
}
.info-box-green { background: var(--sv-green-light); }
.info-box-orange { background: var(--sv-orange-light); border: 2px solid var(--sv-orange); }
.info-box-blue { background: var(--sv-blue-light); }
.info-box-red { background: var(--sv-red-light); }

/* ========================================
   DEVICE CARDS (device management)
   ======================================== */
.device-card {
    border: none; border-radius: 12px; overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.device-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}
.device-card-img { width: 100%; height: 160px; object-fit: contain; padding: 1rem; background: #f8f9fa; }
.device-card-img-placeholder {
    width: 100%; height: 160px;
    display: flex; align-items: center; justify-content: center; background: #f8f9fa;
}
.device-code-display {
    background: #f8f9fa; padding: 1rem; border-radius: 8px;
    display: inline-flex; align-items: center; gap: 0.5rem;
}

/* ========================================
   SCORE BADGES (legacy compat)
   ======================================== */
.score-badge {
    display: inline-flex; width: 60px; height: 60px; border-radius: 50%;
    align-items: center; justify-content: center;
    font-weight: bold; font-size: 1.2rem; color: #fff; flex-shrink: 0;
}
.score-badge-sm { width: 42px; height: 42px; font-size: 0.95rem; }
.score-good { background-color: var(--sv-green); }
.score-mid  { background-color: var(--sv-yellow); color: #333; }
.score-bad  { background-color: var(--sv-red); }

/* ========================================
   RESPONSIVE: wider than mobile
   ======================================== */
@media (min-width: 480px) {
    .app-body { max-width: 430px; margin: 0 auto; }
}
