/* FitReelix Professional - Master Design 2026 */
:root {
    --bg-top: #1E1F22;
    --bg-bottom: #0D0E10;
    --accent: #B3E954;
    --success: #B3E954;
    --danger: #FF4D4F;
    --warning: #FFA940;
    --text-main: #FFFFFF;
    --text-dim: #98989E;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.05);
    --radius-lg: 32px;
    --radius-md: 20px;
    --radius-sm: 12px;
    --transition-premium: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-premium: 0 20px 40px rgba(0,0,0,0.4);
}

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

body {
    background-color: var(--bg-bottom);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Background Effects */
.gradient-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% -20%, #222429 0%, var(--bg-bottom) 100%);
    z-index: -2;
}

.blob {
    position: absolute; width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(179, 233, 84, 0.05) 0%, transparent 70%);
    z-index: -1; filter: blur(80px); pointer-events: none;
}

/* Navigation & User Profile */
.global-nav {
    position: fixed; top: 0; left: 0; width: 100%; height: 72px; padding: 0 5%;
    display: flex; justify-content: space-between; align-items: center;
    z-index: 1000; backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    background: rgba(13, 14, 16, 0.8);
}

.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.nav-brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand-name { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-subline { font-family: 'Space Grotesk'; font-size: 0.6rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.15em; display: block; margin-top: -2px; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.05);
    padding: 6px 16px 6px 6px;
    border-radius: 100px;
    border: 1px solid var(--card-border);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--accent);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
}

.user-role {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 10px;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.logout-btn:hover { opacity: 1; }

/* Layout Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    min-height: 100vh;
    padding-top: 72px; /* Nav height */
}

/* Sidebar */
.sidebar {
    background: rgba(255,255,255,0.01);
    border-right: 1px solid var(--card-border);
    padding: 40px 20px;
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.qr-container {
    background: #fff; padding: 12px; border-radius: 20px; width: 140px; height: 140px;
    margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;  
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.qr-hint { color: #000; font-size: 10px; font-weight: 900; text-transform: uppercase; margin-top: 6px; }  

.side-nav { display: flex; flex-direction: column; gap: 8px; }
.side-nav a {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px; border-radius: 16px;
    color: var(--text-dim); text-decoration: none;
    font-weight: 600; transition: var(--transition-premium);
}
.side-nav a:hover, .side-nav a.active { background: var(--glass); color: var(--accent); }
.side-nav a svg { opacity: 0.7; }
.side-nav a.active svg { opacity: 1; }

.badge {
    background: var(--accent); color: #000; padding: 2px 8px; border-radius: 10px;
    font-size: 0.7rem; font-weight: 800; margin-left: auto;
}

/* Main Content Area */
.main-content {
    padding: 40px 5%;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.content-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 40px; flex-wrap: wrap; gap: 20px;
}

.content-header h2 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }

.search-wrapper { position: relative; flex: 1; max-width: 400px; }
.search-input {
    width: 100%; background: var(--glass); border: 1px solid var(--card-border);
    padding: 14px 24px; border-radius: 100px; color: #fff; outline: none;
    transition: var(--transition-premium);
}
.search-input:focus { border-color: var(--accent); background: var(--glass-hover); }

/* Client Cards */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.client-card {
    background: var(--glass); border: 1px solid var(--card-border);
    border-radius: var(--radius-md); padding: 24px;
    transition: var(--transition-premium); cursor: pointer;
    position: relative; overflow: hidden;
}

.client-card:hover {
    transform: translateY(-8px); border-color: rgba(179,233,84,0.3);
    background: var(--glass-hover); box-shadow: var(--shadow-premium);
}

.client-header { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; }
.client-avatar {
    width: 56px; height: 56px; border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), #8ac23a);
    color: #000; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.2rem; overflow: hidden;
}
.client-avatar img { width: 100%; height: 100%; object-fit: cover; }
.client-avatar.large { width: 80px; height: 80px; border-radius: 24px; font-size: 1.8rem; }

.client-info-main { display: flex; flex-direction: column; }
.client-name { font-weight: 700; font-size: 1.2rem; }
.status-badge-container { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.status-dot.active { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.client-status { font-size: 0.8rem; color: var(--text-dim); font-weight: 600; }

.client-stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-pill {
    background: rgba(0,0,0,0.2); padding: 12px 16px; border-radius: 16px;
    display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; font-weight: 800; letter-spacing: 0.05em; }
.stat-value { font-weight: 700; color: var(--accent); font-size: 1.1rem; }

/* Detail View Layout */
#detail-view-container { width: 100%; }
.detail-header {
    display: flex; align-items: center; gap: 30px; margin-bottom: 40px;
    padding-bottom: 30px; border-bottom: 1px solid var(--card-border);
}

.icon-btn {
    background: var(--glass); border: 1px solid var(--card-border);
    width: 48px; height: 48px; border-radius: 50%; color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition-premium);
}
.icon-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }

.detail-tabs { margin-bottom: 30px; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; }  
.detail-tabs::-webkit-scrollbar { display: none; }
.tabs-scroll { display: flex; gap: 12px; padding-bottom: 10px; }

.tab-btn {
    white-space: nowrap; background: var(--glass); border: 1px solid var(--card-border);
    padding: 12px 24px; border-radius: 100px; color: var(--text-dim);
    font-weight: 700; cursor: pointer; transition: var(--transition-premium);
}
.tab-btn:hover { background: var(--glass-hover); color: #fff; }
.tab-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }

.section-card {
    background: var(--glass); border: 1px solid var(--card-border);
    border-radius: var(--radius-lg); padding: 32px; margin-bottom: 24px;
}
.section-card h3 { font-size: 1.4rem; font-weight: 800; margin-bottom: 24px; letter-spacing: -0.02em; }   

/* List Items */
.data-list { display: flex; flex-direction: column; gap: 12px; }
.data-item {
    background: rgba(255,255,255,0.02); padding: 18px 24px; border-radius: 16px;
    border: 1px solid var(--card-border); display: flex; justify-content: space-between; align-items: center;
    transition: var(--transition-premium);
}
.data-item:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
.item-info h4 { font-weight: 700; margin-bottom: 4px; }
.item-info p { font-size: 0.85rem; color: var(--text-dim); }

/* Form Elements & Inputs */
.onboarding-form { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 0.75rem; font-weight: 800; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }

input[type="text"], input[type="number"], input[type="date"], input[type="time"], textarea, select {      
    background: var(--glass); border: 1px solid var(--card-border);
    padding: 14px 20px; border-radius: 16px; color: #fff; outline: none;
    font-size: 1rem; transition: var(--transition-premium);
    font-family: 'Inter', system-ui, sans-serif;
    width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--glass-hover); }

select option {
    background-color: #1E1F22 !important;
    color: #FFFFFF !important;
}

/* Weekday Selector */
.weekday-selector { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.day-cb { flex: 1; min-width: 40px; cursor: pointer; position: relative; }
.day-cb input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.day-cb span {
    display: flex; align-items: center; justify-content: center;
    height: 40px; border-radius: 12px; background: var(--glass);
    border: 1px solid var(--card-border); color: var(--text-dim);
    font-size: 0.8rem; font-weight: 700; transition: var(--transition-premium);
}
.day-cb input:checked ~ span { background: var(--accent); color: #000; border-color: var(--accent); box-shadow: 0 0 15px rgba(179,233,84,0.3); }

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid var(--card-border);
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background-color: var(--text-dim);
    transition: .4s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: rgba(179,233,84,0.2);
    border-color: var(--accent);
}
input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background-color: var(--accent);
    box-shadow: 0 0 10px rgba(179,233,84,0.5);
}

/* Buttons & Actions */
.item-actions { display: flex; gap: 10px; }
.edit-btn, .add-btn-small {
    background: rgba(255,255,255,0.05); color: #fff; border: 1px solid var(--card-border);
    padding: 8px 16px; border-radius: 12px; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: var(--transition-premium);
}
.edit-btn:hover, .add-btn-small:hover { background: var(--accent); color: #000; border-color: var(--accent); }

.cta-button {
    background: var(--accent); color: #000; padding: 16px 32px; border-radius: 100px;
    border: none; font-weight: 800; font-size: 1rem; cursor: pointer;
    transition: var(--transition-premium); display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.cta-button:hover { transform: scale(1.05); box-shadow: 0 10px 30px rgba(179,233,84,0.3); }
.cta-button.secondary { background: rgba(255,255,255,0.05); color: #fff; border: 1px solid var(--card-border); }
.cta-button.secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--accent); }
.cta-button.small { padding: 10px 24px; font-size: 0.85rem; }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(15px); z-index: 2000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-content { width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; padding: 40px; }      
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.close-btn { background: none; border: none; color: var(--text-dim); font-size: 2rem; cursor: pointer; }  

/* Charts */
.lab-chart-container { background: rgba(0,0,0,0.3); border-radius: 24px; padding: 24px; border: 1px solid var(--card-border); }

/* Mobile Specifics (MUST BE AT THE END TO OVERRIDE GLOBALS) */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 80px 1fr; }
    .side-nav a span, .sidebar .qr-container, .brand-text-wrapper { display: none; }
    .side-nav a { padding: 14px; justify-content: center; }
    .sidebar { padding: 20px 10px; width: 80px; }
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; padding-top: 60px; padding-bottom: 80px; min-height: 100vh; }
    .sidebar {
        position: fixed; top: auto; bottom: 0; left: 0; width: 100%; height: 70px;
        flex-direction: row; justify-content: space-around; padding: 10px;
        z-index: 1000; border-right: none; border-top: 1px solid var(--card-border);
        background: rgba(13, 14, 16, 0.95); backdrop-filter: blur(20px);
    }
    .side-nav { flex-direction: row; width: 100%; justify-content: space-around; }
    .side-nav a { padding: 10px; border-radius: 12px; flex: 1; flex-direction: column; justify-content: center; gap: 4px; }
    .side-nav a span { display: block; font-size: 0.6rem; }
    .sidebar-header { display: none; }
    
    .main-content { padding: 15px 5%; width: 100%; box-sizing: border-box; }
    .grid-container { grid-template-columns: 1fr; }
    
    .detail-header { flex-direction: column; align-items: stretch; gap: 15px; }
    .client-hero { flex-direction: row; align-items: center; width: 100%; gap: 15px; }
    .client-avatar.large { width: 50px; height: 50px; font-size: 1.2rem; flex-shrink: 0; }
    .detail-actions { width: 100%; }
    .detail-actions .cta-button { width: 100%; }
    
    .hero-title { font-size: 2rem; }
    .hero-content { padding: 0 10px; box-sizing: border-box; }

    /* Form and Modal Mobile Fixes */
    .form-row { grid-template-columns: 1fr; gap: 15px; }
    .modal-overlay { padding: 10px; align-items: flex-start; overflow-y: auto; }
    .modal-content { padding: 20px; max-height: none; width: 100%; border-radius: 20px; margin: auto 0; height: auto; }
    .modal-header { margin-bottom: 15px; position: sticky; top: -20px; background: var(--bg-top); padding: 15px 0; z-index: 10; border-bottom: 1px solid var(--card-border); }
    .section-card { padding: 15px; }
    .stat-pill { padding: 15px; }
    .hydration-summary-row { grid-template-columns: 1fr !important; }
    .data-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .item-actions { width: 100%; display: flex; }
    .item-actions button { flex: 1; }
    
    /* Nav fixes for mobile */
    .global-nav { padding: 10px 15px; height: auto; min-height: 60px; }
    .brand-text-wrapper { display: none; } /* Hide full brand text to make room */
    .user-profile { padding: 4px 12px 4px 4px; border-radius: 100px; border: 1px solid var(--card-border); background: var(--glass); }
    .user-info-text { display: flex; } /* Show name wrapper */
    .user-role { display: none; } /* Hide role to save space */
    .user-name { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
    .logout-btn { display: none; } /* Hide logout text, icon only or in settings */
    .user-avatar-small { width: 32px; height: 32px; }
}

/* Animations */
.fade-in { animation: fadeIn 0.8s ease-out forwards; }
.slide-up { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

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