/* 
   GYM PRO CORE STYLES V3 
   Extracted for Performance and Modularization
*/
:root {
  --g-bg: #020617;
  --g-surface: rgba(30, 41, 59, 0.65);
  --g-surface-hover: rgba(51, 65, 85, 0.85);
  --g-border: rgba(255, 255, 255, 0.08);
  --g-primary: #10b981;
  --g-primary-glow: rgba(16, 185, 129, 0.35);
  --g-text: #f8fafc;
  --g-glass-blur: blur(16px);
  --g-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

/* UTILITY CLASSES (Design System) */
.g-card-primary {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: 20px;
  padding: 25px;
  backdrop-filter: var(--g-glass-blur);
  -webkit-backdrop-filter: var(--g-glass-blur);
  box-shadow: var(--g-shadow);
  color: var(--g-text);
  transition: all 0.3s ease;
}

.g-card-primary:hover {
  background: var(--g-surface-hover);
  border-color: rgba(16, 185, 129, 0.2);
}

.g-btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 25px;
  font-weight: 900;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.g-btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.g-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.g-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* SIDEBAR SYSTEM */
.g-sidebar-icon { font-size: 2.5rem; line-height: 1; }
.g-sidebar-title { font-weight: 900; font-size: 1.2rem; color: var(--g-primary); margin-top: 15px; letter-spacing: -0.5px; }
.g-sidebar-subtitle { font-size: 0.8rem; color: #64748b; margin-top: 5px; font-weight: bold; }
.g-sidebar-footer { padding: 20px; border-top: 1px solid var(--g-border); background: rgba(0,0,0,0.1); text-align: center; flex-shrink: 0; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.g-sidebar-user { margin-bottom: 15px; display: flex; flex-direction: column; align-items: center; }
.g-sidebar-avatar { width: 45px; height: 45px; border-radius: 50%; background: linear-gradient(135deg, #38bdf8, #3b82f6); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: bold; margin-bottom: 8px; font-size: 1.5rem; box-shadow: 0 4px 10px rgba(56,189,248,0.3); }
.g-sidebar-name { color: var(--g-text); font-weight: bold; font-size: 0.95rem; margin-bottom: 2px; }
.g-sidebar-email { color: #94a3b8; font-size: 0.75rem; word-break: break-all; }
.g-sidebar-badge { background: var(--g-surface); padding: 6px 15px; border-radius: 12px; font-size: 0.75rem; font-weight: bold; color: var(--g-primary); border: 1px solid var(--g-border); margin-bottom: 12px; display: inline-block; }
.g-btn-settings { font-size: 0.8rem; width: 100%; padding: 8px 12px !important; display: block; text-align: center; margin-bottom: 8px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); border: none; font-weight: bold; cursor: pointer; color: #fff; border-radius: 12px; }
.g-btn-logout { font-size: 0.8rem; width: 100%; padding: 8px 12px !important; display: block; text-align: center; text-decoration: none; border-radius: 12px; }

/* 
============================================
NEW DESIGN SYSTEM CLASSES
============================================
*/

/* --- MODALS --- */
.g-modal-overlay { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(2, 6, 23, 0.95); z-index:999999999; display:none; flex-direction:column; align-items:center; justify-content:center; backdrop-filter:blur(10px); padding:20px; direction:rtl; overflow-y:auto; }
.g-modal-box { background:var(--g-surface); width:100%; max-width:450px; border-radius:24px; padding:35px; box-shadow:var(--g-shadow); border:1px solid var(--g-border); text-align:right; position:relative; }
.g-modal-title { margin:0; font-size:2rem; color:var(--g-primary); font-weight:900; }
.g-modal-subtitle { margin:0; padding-right:20px; color:#cbd5e1; font-size:0.9rem; line-height:1.6; }

/* --- FORMS & INPUTS --- */
.g-input-field { background:#0f172a !important; border:2px solid #334155 !important; border-radius:12px !important; padding:15px !important; color:#fff !important; font-weight:900 !important; font-size:1.1rem !important; width:100%; margin-bottom:25px; outline:none; }
.g-input-field:focus { border-color:var(--g-primary) !important; box-shadow:0 0 10px var(--g-primary-glow) !important; }
.g-input-label { display:block; font-size:0.85rem; color:#cbd5e1; margin-bottom:5px; font-weight:bold; }
.g-list-box { background:#1e293b; padding:15px; border-radius:15px; max-height:150px; overflow-y:auto; border:1px solid rgba(255,255,255,0.05); }

/* --- PANELS & LAYOUT --- */
.g-panel-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:25px; flex-wrap:wrap; gap:15px; position:relative; z-index:2; }
.g-chart-box { background:rgba(30, 41, 59, 0.45); border:1px solid var(--g-border); backdrop-filter:var(--g-glass-blur); -webkit-backdrop-filter:var(--g-glass-blur); padding:30px; border-radius:24px; transition:0.3s; }
.g-chart-box:hover { background:var(--g-surface-hover); border-color:rgba(16, 185, 129, 0.2); }

/* --- STATS CARDS --- */
.g-stat-value { color:#fff; font-size:2.4rem; font-weight:900; line-height:1; margin-bottom:6px; font-family:sans-serif; }
.g-stat-label { color:#94a3b8; font-size:0.95rem; font-weight:bold; }

/* --- TYPOGRAPHY --- */
.g-text-primary { color: var(--g-primary) !important; }
.g-text-muted { color: #94a3b8 !important; }
.g-text-danger { color: #ef4444 !important; }
.g-text-warning { color: #f59e0b !important; }
.g-text-info { color: #3b82f6 !important; }


@media print {
    body * {
        visibility: hidden;
    }
    #gfin-content-printables, #gfin-content-printables * {
        visibility: visible;
    }
    #gfin-content-printables {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        color: black !important;
    }
    .no-print {
        display: none !important;
    }
    .print-page-break {
        page-break-before: always;
    }
    .printable-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 20px;
        direction: rtl;
    }
    .printable-table th, .printable-table td {
        border: 1px solid #000;
        padding: 8px;
        text-align: center;
        color: #000 !important;
    }
    .printable-table th {
        background-color: #f2f2f2 !important;
        font-weight: bold;
    }
    .printable-header {
        text-align: center;
        margin-bottom: 20px;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }
}

/* --- EXAMS UI OVERHAUL --- */
.g-exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.g-exam-card { background: var(--g-surface); border-radius: 20px; padding: 25px; border: 1px solid var(--g-border); position: relative; overflow: hidden; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--g-shadow); display: flex; flex-direction: column; justify-content: space-between; }
.g-exam-card::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(167, 139, 250, 0.1) 0%, transparent 70%); opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.g-exam-card:hover { transform: translateY(-8px); border-color: #a78bfa; box-shadow: 0 20px 40px rgba(167, 139, 250, 0.15); }
.g-exam-card:hover::before { opacity: 1; }
.g-exam-card-title { font-size: 1.5rem; font-weight: 900; color: #fff; margin: 0 0 10px 0; display: flex; align-items: center; gap: 10px; }
.g-exam-card-stats { display: flex; gap: 15px; margin-bottom: 20px; }
.g-exam-stat { background: rgba(255,255,255,0.03); padding: 8px 15px; border-radius: 12px; font-size: 0.9rem; color: #cbd5e1; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,0.05); }

/* Fast Track UI */
.g-exam-fast-header { position: sticky; top: 0; z-index: 100; background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--g-border); padding: 20px; border-radius: 20px 20px 0 0; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); margin: -20px -20px 20px -20px; }
.g-fast-nav-btn { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #fff; width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.g-fast-nav-btn:hover:not(:disabled) { background: #3b82f6; transform: scale(1.1); }
.g-fast-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.g-quick-grades { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.g-quick-grade-btn { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #10b981; padding: 10px 15px; border-radius: 12px; font-weight: bold; font-size: 1.1rem; cursor: pointer; transition: 0.2s; flex: 1; min-width: 60px; text-align: center; }
.g-quick-grade-btn:hover { background: #10b981; color: #fff; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4); }

/* Leaderboard */
.g-leaderboard-row { display: flex; align-items: center; background: rgba(255,255,255,0.02); padding: 15px 20px; border-radius: 16px; margin-bottom: 10px; border: 1px solid transparent; transition: 0.3s; }
.g-leaderboard-row:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); transform: translateX(-5px); }
.g-medal { font-size: 2rem; margin-left: 15px; width: 40px; text-align: center; filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)); }
.g-rank-circle { width: 40px; height: 40px; border-radius: 50%; background: #1e293b; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.2rem; color: #94a3b8; margin-left: 15px; }
.g-leaderboard-row.rank-1 { background: linear-gradient(90deg, rgba(250, 204, 21, 0.1), transparent); border-right: 4px solid #facc15; }
.g-leaderboard-row.rank-2 { background: linear-gradient(90deg, rgba(148, 163, 184, 0.1), transparent); border-right: 4px solid #94a3b8; }
.g-leaderboard-row.rank-3 { background: linear-gradient(90deg, rgba(180, 83, 9, 0.1), transparent); border-right: 4px solid #b45309; }
.g-score-bar-container { flex: 1; background: rgba(0,0,0,0.3); height: 12px; border-radius: 6px; overflow: hidden; margin: 0 20px; position: relative; }
.g-score-bar-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #8b5cf6); border-radius: 6px; transition: width 1s ease-out; }
.g-score-badge { background: #0f172a; border: 2px solid #8b5cf6; color: #fff; padding: 5px 15px; border-radius: 20px; font-weight: 900; font-size: 1.2rem; min-width: 80px; text-align: center; box-shadow: 0 0 15px rgba(139, 92, 246, 0.3); }

/* Radar Chart Container */
.g-radar-container { width: 100%; max-width: 500px; margin: 0 auto; aspect-ratio: 1; background: radial-gradient(circle, rgba(139, 92, 246, 0.05) 0%, transparent 70%); border-radius: 50%; }


/* Anatomy Mobile Fixes */
@media (max-width: 768px) {
    .g-anatomy-mobile-wrap {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 10px !important;
    }
    .g-anatomy-mobile-inner {
        flex-wrap: wrap !important;
        width: 100% !important;
        justify-content: center !important;
    }
    .g-anatomy-mobile-inner input, 
    .g-anatomy-mobile-inner select, 
    .g-anatomy-mobile-inner button {
        width: 100% !important;
        margin-bottom: 5px !important;
        justify-content: center !important;
    }
    .g-anatomy-mobile-wrap > button,
    .g-anatomy-mobile-wrap > select,
    .g-anatomy-mobile-wrap > div > button {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
        margin-bottom: 5px !important;
    }
    .g-anatomy-mobile-overlay-btns {
        flex-wrap: wrap !important;
        width: calc(100% - 20px) !important;
        justify-content: center !important;
    }
    .g-anatomy-mobile-overlay-btns > button {
        flex: 1 !important;
        min-width: 120px !important;
        font-size: 0.85rem !important;
        padding: 8px !important;
    }
    #g-anatomy-pose-desc, #g-anatomy-pose-name {
        width: 100% !important;
    }
}

@media (max-width: 768px) {

    /* Reorder Elements on Mobile so 3D Model is visible at the top */
    #g-anatomy-modal-overlay > div {
        display: flex !important;
        flex-direction: column !important;
    }
    #g-anatomy-modal-overlay > div > button { order: 1 !important; }
    #g-anatomy-modal-overlay > div > div:nth-child(2) { order: 2 !important; } /* Title */
    #g-anatomy-modal-overlay > div > div:nth-child(5) { order: 3 !important; } /* Body Layout */
    #g-anatomy-modal-overlay > div > div:nth-child(3) { order: 4 !important; } /* Toolbar 1 */
    #g-anatomy-modal-overlay > div > div:nth-child(4) { order: 5 !important; } /* Toolbar 2 */

    /* Inside Body Layout */
    .g-anatomy-body-layout {
        display: flex !important;
        flex-direction: column !important;
        flex: none !important;
        height: auto !important;
    }
    .g-anatomy-3d-wrapper {
        order: 1 !important;
        min-height: 350px !important;
        height: 50vh !important;
        max-height: 500px !important;
        position: relative !important;
    }
    .g-anatomy-sidebar-joints {
        order: 2 !important;
    }
    .g-anatomy-sidebar-tools {
        order: 3 !important;
    }
}

@media (max-width: 1024px) {
    .g-sidebar-footer {
        display: block !important;
        visibility: visible !important;
        position: relative !important;
        z-index: 1000 !important;
        padding-bottom: 25px !important;
        margin-top: auto !important;
    }
    .g-btn-settings, .g-btn-logout {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    .g-sidebar-nav {
        padding-bottom: 20px !important;
        flex: 1 1 auto !important;
    }
}

@media (max-width: 768px) {
    .g-panel-header {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center !important;
    }
    #gplans-nav {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 15px !important;
    }
    #gplans-nav .gt-month-tab {
        flex-shrink: 0 !important;
    }
}
