/* ======================================
   NutritionPro - نظام إدارة عيادات التغذية
   Fresh Green Theme
   ====================================== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
    --primary: #2E7D32;
    --primary-dark: #1B5E20;
    --primary-light: #66BB6A;
    --primary-gradient: linear-gradient(135deg, #2E7D32, #66BB6A);
    --sidebar-bg: #E8F5E9;
    --sidebar-hover: #C8E6C9;
    --sidebar-active: #2E7D32;
    --body-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-dark: #2c3e50;
    --text-muted: #6c757d;
    --text-light: #ffffff;
    --border-color: #e9ecef;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-dark);
    direction: rtl;
    min-height: 100vh;
    font-size: 14px;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* ======= LOGIN PAGE ======= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 30%, #A5D6A7 60%, #66BB6A 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(46,125,50,0.15) 0%, transparent 70%);
    top: -100px; right: -100px;
    border-radius: 50%;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(46,125,50,0.1) 0%, transparent 70%);
    bottom: -50px; left: -50px;
    border-radius: 50%;
}
.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    padding: 45px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.15);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(46,125,50,0.2);
    overflow: hidden;
}
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, #2E7D32, #66BB6A, #2E7D32, transparent);
    background-size: 200% 100%;
    animation: borderScan 2.5s ease-in-out infinite;
}
@keyframes borderScan {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.login-title { color: var(--primary-dark); font-weight: 800; font-size: 1.7rem; margin-bottom: 5px; }
.login-subtitle { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 30px; }
.login-card .form-label { font-weight: 600; color: var(--text-dark); font-size: 0.9rem; margin-bottom: 6px; }
.login-card .input-group {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}
.login-card .input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.15);
}
.login-card .input-group-text { background: transparent; border: none; color: var(--primary); font-size: 1.1rem; padding: 12px 15px; }
.login-card .form-control { border: none; padding: 12px 10px; font-size: 0.95rem; background: transparent; }
.login-card .form-control:focus { box-shadow: none; }
.btn-login {
    background: var(--primary-gradient);
    border: none; border-radius: var(--radius);
    padding: 13px; font-size: 1.1rem; font-weight: 700;
    color: #fff; width: 100%;
    transition: var(--transition);
}
.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(46,125,50,0.4);
    color: #fff;
}
.login-footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
    text-align: center; padding: 12px;
    font-size: 0.85rem; color: var(--text-muted);
}
.login-footer a { color: var(--primary-dark); font-weight: 700; text-decoration: none; }

/* ======= SIDEBAR ======= */
.sidebar {
    position: fixed; top: 0; right: 0;
    width: 260px; height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    box-shadow: -5px 0 20px rgba(0,0,0,0.08);
    border-left: 1px solid #C8E6C9;
}
.sidebar-brand {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid #C8E6C9;
}
.sidebar-brand img { max-width: 60px; max-height: 60px; border-radius: 12px; margin-bottom: 8px; object-fit: contain; }
.sidebar-brand h5 { color: var(--primary); font-weight: 700; font-size: 1rem; margin-bottom: 2px; }
.sidebar-brand small { color: #558B2F; font-size: 0.7rem; letter-spacing: 2px; text-transform: uppercase; }
.brand-icon {
    width: 50px; height: 50px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px;
    color: #fff; font-size: 1.3rem;
}
.sidebar-section {
    padding: 15px 15px 5px;
    color: #558B2F;
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
}
.sidebar-menu { list-style: none; padding: 0 10px; margin: 0; }
.sidebar-menu li { margin-bottom: 3px; }
.sidebar-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 15px;
    color: #33691E; text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.9rem; font-weight: 500;
}
.sidebar-menu a:hover { background: var(--sidebar-hover); color: var(--primary-dark); }
.sidebar-menu a.active {
    background: linear-gradient(135deg, rgba(46,125,50,0.25), rgba(46,125,50,0.1));
    color: var(--primary-dark); font-weight: 700;
    border-right: 3px solid var(--primary);
}
.sidebar-menu a i { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-menu .badge { margin-right: auto; font-size: 0.7rem; padding: 3px 8px; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ======= TOP NAVBAR ======= */
.top-navbar {
    position: fixed; top: 0; left: 0; right: 260px;
    height: 56px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px; z-index: 998;
    gap: 10px;
}
.sidebar-toggle {
    background: none; border: none; font-size: 1.3rem;
    color: var(--text-dark); cursor: pointer; display: none;
}
.navbar-search { position: relative; width: 350px; }
.navbar-search input {
    width: 100%;
    border: 2px solid var(--border-color); border-radius: 25px;
    padding: 8px 20px;
    font-family: 'Tajawal'; font-size: 0.9rem;
    transition: var(--transition); background: var(--body-bg);
}
.navbar-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,50,0.1); }
.search-results-dropdown {
    position: absolute; top: 100%; right: 0; left: 0;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
    max-height: 400px; overflow-y: auto; z-index: 1000; margin-top: 5px;
}
.search-results-dropdown .search-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 15px; cursor: pointer; border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}
.search-results-dropdown .search-item:hover { background: #f8f9fa; }
.navbar-actions { display: flex; align-items: center; gap: 15px; }
.nav-icon {
    background: none; border: none; font-size: 1.2rem;
    color: var(--text-muted); cursor: pointer; position: relative;
    transition: var(--transition); text-decoration: none;
}
.nav-icon:hover { color: var(--primary); }
.nav-icon .badge {
    position: absolute; top: -8px; right: -8px; font-size: 0.6rem; padding: 2px 5px;
}
.user-avatar {
    width: 38px; height: 38px;
    background: var(--primary-gradient);
    color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.95rem;
}

/* Notification Dropdown */
.notification-dropdown {
    display: none; position: absolute; top: 100%; left: 0;
    width: 360px; background: #fff;
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    z-index: 1000; margin-top: 10px;
    max-height: 400px; overflow-y: auto;
}
.notification-dropdown.show { display: block; }
.n-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 15px; border-bottom: 1px solid var(--border-color);
}
.n-item {
    padding: 10px 15px; border-bottom: 1px solid #f8f9fa;
    cursor: pointer; transition: var(--transition);
}
.n-item:hover { background: #f8f9fa; }
.n-item.unread { background: #E8F5E9; border-right: 3px solid var(--primary); }
.n-footer {
    text-align: center; padding: 10px;
    border-top: 1px solid var(--border-color);
}
.n-footer a { color: var(--primary); text-decoration: none; font-size: 0.85rem; font-weight: 600; }

/* ======= MAIN CONTENT ======= */
.main-content {
    margin-right: 260px; margin-top: 56px;
    padding: 25px; min-height: calc(100vh - 56px);
}
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ======= PAGE HEADER ======= */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 25px; flex-wrap: wrap; gap: 15px;
}
.page-header h4 { font-weight: 700; color: var(--text-dark); margin: 0; }
.page-header .breadcrumb { margin: 0; font-size: 0.85rem; }
.page-header .breadcrumb a { color: var(--primary); text-decoration: none; }

/* ======= STAT CARDS ======= */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius); padding: 22px;
    box-shadow: var(--shadow); transition: var(--transition);
    border-right: 4px solid var(--primary);
    position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px; display: flex;
    align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff;
}
.stat-card h3 { font-weight: 800; font-size: 1.8rem; margin: 8px 0 3px; }
.stat-card p { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

.stat-green .stat-icon { background: linear-gradient(135deg, #2E7D32, #66BB6A); }
.stat-blue .stat-icon { background: linear-gradient(135deg, #1565C0, #42A5F5); }
.stat-orange .stat-icon { background: linear-gradient(135deg, #E65100, #FF9800); }
.stat-purple .stat-icon { background: linear-gradient(135deg, #6A1B9A, #AB47BC); }
.stat-red .stat-icon { background: linear-gradient(135deg, #B71C1C, #EF5350); }
.stat-teal .stat-icon { background: linear-gradient(135deg, #00695C, #4DB6AC); }

.stat-green { border-right-color: #2E7D32; }
.stat-blue { border-right-color: #1565C0; }
.stat-orange { border-right-color: #E65100; }
.stat-purple { border-right-color: #6A1B9A; }
.stat-red { border-right-color: #B71C1C; }
.stat-teal { border-right-color: #00695C; }

/* ======= CARDS ======= */
.card { border: none; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header {
    background: var(--card-bg); border-bottom: 1px solid var(--border-color);
    padding: 18px 22px; font-weight: 700; font-size: 1rem;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-body { padding: 22px; }

/* ======= TABLES ======= */
.table { margin-bottom: 0; }
.table thead th {
    background: #E8F5E9; color: var(--primary-dark);
    font-weight: 700; font-size: 0.85rem;
    padding: 14px 15px; border-bottom: 2px solid #C8E6C9;
    white-space: nowrap;
}
.table tbody td { padding: 12px 15px; vertical-align: middle; font-size: 0.9rem; }
.table tbody tr { transition: var(--transition); border-bottom: 1px solid #f5f5f5; }
.table tbody tr:hover { background: #F1F8E9; }

/* ======= BUTTONS ======= */
.btn-primary {
    background: var(--primary-gradient); border: none;
    font-weight: 600; transition: var(--transition);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(46,125,50,0.4); }
.btn-success { background: #2E7D32; border-color: #2E7D32; }
.btn-success:hover { background: #1B5E20; border-color: #1B5E20; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-sm { font-size: 0.8rem; padding: 5px 12px; border-radius: 6px; }

/* ======= BADGES ======= */
.badge-status { padding: 5px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.badge-active { background: #E8F5E9; color: #2E7D32; }
.badge-inactive { background: #FFEBEE; color: #C62828; }
.badge-pending { background: #FFF3E0; color: #E65100; }
.badge-completed { background: #E8F5E9; color: #2E7D32; }
.badge-cancelled { background: #FFEBEE; color: #C62828; }

/* BMI Categories */
.bmi-underweight { color: #1976D2; font-weight: 700; }
.bmi-normal { color: #2E7D32; font-weight: 700; }
.bmi-overweight { color: #F57F17; font-weight: 700; }
.bmi-obese1 { color: #E65100; font-weight: 700; }
.bmi-obese2 { color: #BF360C; font-weight: 700; }
.bmi-obese3 { color: #B71C1C; font-weight: 700; }

/* ======= FORMS ======= */
.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 15px; font-size: 0.9rem;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46,125,50,0.1);
}
.form-label { font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }

/* ======= MODALS ======= */
.modal-content { border: none; border-radius: var(--radius); }
.modal-header {
    background: var(--primary-gradient); color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 18px 22px;
}
.modal-header .btn-close { filter: invert(1); }
.modal-header .modal-title { font-weight: 700; }

/* ======= LOADING OVERLAY ======= */
.loading-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(255,255,255,0.8);
    z-index: 99999;
    justify-content: center; align-items: center;
}
.loading-overlay.show, .loading-overlay[style*="block"] {
    display: flex !important;
}
.spinner-green {
    width: 45px; height: 45px;
    border: 4px solid #E8F5E9;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ======= SETTINGS TABS ======= */
.settings-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 20px; }
.settings-tabs .tab-btn {
    padding: 8px 18px; border-radius: 20px;
    border: 2px solid var(--border-color);
    background: #fff; color: var(--text-muted);
    font-weight: 600; font-size: 0.85rem;
    cursor: pointer; transition: var(--transition);
}
.settings-tabs .tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.settings-tabs .tab-btn.active {
    background: var(--primary-gradient); color: #fff;
    border-color: transparent;
}
.tab-content-section { display: none; }
.tab-content-section.active { display: block; animation: fadeIn 0.3s ease; }

/* ======= POS ======= */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; min-height: calc(100vh - 130px); }
.pos-cart {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.pos-cart-header {
    background: var(--primary-gradient); color: #fff;
    padding: 15px 20px; border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 700; font-size: 1.1rem;
}
.pos-cart-items { flex: 1; overflow-y: auto; padding: 10px; }
.pos-cart-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; border-bottom: 1px solid var(--border-color);
}
.pos-cart-footer { padding: 15px 20px; border-top: 2px solid var(--border-color); }
.pos-total { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.pos-products-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
}
.pos-product-card {
    background: var(--card-bg); border-radius: var(--radius-sm);
    padding: 15px; text-align: center; cursor: pointer;
    transition: var(--transition); border: 2px solid transparent;
    box-shadow: var(--shadow);
}
.pos-product-card:hover { border-color: var(--primary); transform: translateY(-2px); }

/* ======= WAITING SCREEN ======= */
.waiting-screen {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%);
    min-height: 100vh; color: #fff;
    padding: 30px; display: flex; flex-direction: column;
}
.waiting-header {
    text-align: center; padding: 20px; margin-bottom: 30px;
}
.waiting-header h1 { font-size: 2.5rem; font-weight: 800; }
.waiting-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px; flex: 1;
}
.waiting-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius); padding: 25px;
    text-align: center; border: 1px solid rgba(255,255,255,0.2);
    transition: var(--transition);
}
.waiting-card.active {
    background: rgba(255,255,255,0.95); color: var(--primary-dark);
    animation: pulse 2s infinite;
}
.waiting-number {
    font-size: 3rem; font-weight: 900;
    line-height: 1;
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }

/* ======= QUEUE STATUS COLORS ======= */
.queue-waiting { background: #FFF3E0; color: #E65100; }
.queue-in-session { background: #E3F2FD; color: #1565C0; }
.queue-completed { background: #E8F5E9; color: #2E7D32; }

/* ======= CHARTS ======= */
.chart-container { position: relative; max-height: 300px; }

/* ======= EMPTY STATE ======= */
.empty-state {
    text-align: center; padding: 50px 20px;
}
.empty-state i { font-size: 4rem; color: #C8E6C9; margin-bottom: 15px; }
.empty-state h5 { color: var(--text-muted); font-weight: 600; }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; }

/* ======= FILTER BAR ======= */
.filter-bar {
    display: flex; gap: 10px; align-items: center;
    flex-wrap: wrap; margin-bottom: 15px;
}
.filter-bar .form-control, .filter-bar .form-select {
    max-width: 200px; padding: 8px 12px; font-size: 0.85rem;
}

/* ======= PATIENT VIEW TABS ======= */
.nav-tabs .nav-link {
    color: var(--text-muted); font-weight: 600;
    border: none; padding: 10px 20px;
}
.nav-tabs .nav-link.active { color: var(--primary); border-bottom: 3px solid var(--primary); background: transparent; }
.nav-tabs .nav-link:hover { color: var(--primary); }

/* ======= MEAL PLAN GRID ======= */
.meal-plan-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.day-column {
    background: var(--card-bg); border-radius: var(--radius-sm);
    padding: 12px; box-shadow: var(--shadow); min-height: 200px;
}
.day-column .day-name {
    text-align: center; font-weight: 700; color: var(--primary);
    padding-bottom: 8px; border-bottom: 2px solid #E8F5E9; margin-bottom: 10px;
}
.meal-item {
    background: #F1F8E9; border-radius: 6px; padding: 8px;
    margin-bottom: 6px; font-size: 0.82rem;
    border-right: 3px solid var(--primary-light);
}
.meal-item .meal-calories { color: var(--primary); font-weight: 700; font-size: 0.75rem; }

/* ======= PRINT ======= */
@media print {
    .sidebar, .top-navbar, .sidebar-overlay, .no-print, .quick-toolbar, .filter-bar, .modal,
    .page-header .btn, .page-header button, .toast-container, .btn-group { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    body { background: #fff !important; font-size: 11pt !important; color: #000 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
    .stat-card { border: 1px solid #ddd !important; box-shadow: none !important; }
    .table { font-size: 10pt !important; }
    .table thead th { background: #f0f0f0 !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-weight: 700 !important; }
    .table td, .table th { padding: 6px 10px !important; }
    .badge { border: 1px solid #999 !important; }
    a { text-decoration: none !important; color: #000 !important; }
    
    /* Print Header */
    .print-header {
        display: flex !important; align-items: center; gap: 15px;
        padding: 12px 0 12px; margin-bottom: 15px;
        border-bottom: 3px solid #2E7D32;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .print-header img { max-height: 50px; border-radius: 8px; }
    .print-header .ph-icon-inline {
        width: 45px; height: 45px; background: #2E7D32; color: #fff;
        display: flex; align-items: center; justify-content: center;
        border-radius: 8px; font-size: 1.2rem; flex-shrink: 0;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .print-header .print-info { flex: 1; }
    .print-header .print-info h4 { margin: 0; color: #2E7D32; font-weight: 800; font-size: 14pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .print-header .print-info p { margin: 2px 0 0; font-size: 9pt; color: #555; }
    .print-header .print-header-meta { text-align: left; }
    .print-header .print-page-title { font-weight: 700; font-size: 11pt; color: #333; }
    .print-header .print-date { font-size: 9pt; color: #888; }
    
    /* Print Footer */
    .print-footer {
        display: flex !important; justify-content: center;
        padding: 8px 0; border-top: 1.5px solid #ddd;
        margin-top: 15px; font-size: 8pt; color: #999;
    }
    
    /* Page title for print */
    .page-header { margin-bottom: 10px !important; }
    .page-header h4, .page-header h5 { font-size: 13pt !important; }
    
    @page { margin: 1.2cm 1cm; }
}
.print-header, .print-footer { display: none; }

/* ======= NAVBAR QUICK ACTIONS (merged toolbar) ======= */
.navbar-quick-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}
.navbar-divider {
    width: 1px; height: 24px;
    background: var(--border-color);
    margin: 0 6px;
}
.nav-quick-btn {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
}
.nav-quick-btn:hover { background: #E8F5E9; color: var(--primary); transform: translateY(-1px); }
.navbar-clock {
    display: flex; align-items: center; gap: 6px;
    color: var(--text-dark); font-size: 0.82rem; font-weight: 600;
    background: #E8F5E9;
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.navbar-clock i { font-size: 0.85rem; color: var(--primary); }
.clock-date { font-size: 0.75rem; color: var(--text-muted); border-right: 1px solid var(--border-color); padding-right: 8px; margin-right: 4px; }

/* ======= RESPONSIVE ======= */
@media (max-width: 991px) {
    .sidebar { right: -260px; }
    .sidebar.show { right: 0; background: #fff; }
    .sidebar-toggle { display: block; }
    .top-navbar { right: 0; }
    .main-content { margin-right: 0; }
    .pos-layout { grid-template-columns: 1fr; }
    .meal-plan-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .page-header { flex-direction: column; align-items: flex-start; }
    .navbar-search { width: 200px; }
    .stat-card h3 { font-size: 1.4rem; }
    .meal-plan-grid { grid-template-columns: repeat(2, 1fr); }
    .notification-dropdown { width: 300px; }
    .navbar-quick-actions { gap: 2px; }
    .navbar-clock { display: none; }
    .navbar-divider { display: none; }
    .nav-quick-btn { width: 30px; height: 30px; font-size: 0.85rem; }
}
@media (max-width: 576px) {
    .main-content { padding: 15px; }
    .navbar-search { display: none; }
    .meal-plan-grid { grid-template-columns: 1fr; }
    .navbar-quick-actions { display: none; }
}

/* ======= IMPROVED TABLE ACTIONS ======= */
.table .btn-group-actions { display: flex; gap: 4px; flex-wrap: nowrap; }
.table .btn-group-actions .btn { padding: 4px 8px; font-size: 0.75rem; }

/* ======= ENHANCED STATUS BADGES ======= */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; }
.status-dot.active { background: #2E7D32; }
.status-dot.inactive { background: #dc3545; }

/* ======= GLOBAL LINK STYLING (Fix blue links) ======= */
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); text-decoration: none; }
.table a { color: var(--text-dark); }
.table a:hover { color: var(--primary); }
.card-header a { font-size: 0.82rem; }

/* ======= TOAST NOTIFICATIONS ======= */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.toast-container .alert { pointer-events: auto; min-width: 350px; max-width: 500px; box-shadow: var(--shadow-lg); border-radius: var(--radius); animation: slideDown 0.3s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* ======= ANIMATED COUNTERS ======= */
.stat-card h3 { font-variant-numeric: tabular-nums; }
.stat-card h3.counting { transition: none; }

/* ======= IMPROVED CARD HOVER ======= */
.card { transition: var(--transition); }
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.1); }

/* ======= EMPTY STATE ENHANCED ======= */
.empty-state-inline { text-align: center; padding: 30px 15px; color: var(--text-muted); }
.empty-state-inline i { font-size: 2.5rem; color: #C8E6C9; margin-bottom: 10px; display: block; }

/* ======= PROGRAM LINKS ======= */
.program-link { color: var(--primary) !important; font-weight: 600; }
.program-link:hover { color: var(--primary-dark) !important; text-decoration: underline !important; }

/* ======= PAGE STATS BAR ======= */
.page-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.page-stat-item {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 150px;
}
.page-stat-item .stat-value { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.page-stat-item .stat-label { font-size: 0.82rem; color: var(--text-muted); }
.page-stat-item i { font-size: 1.3rem; color: var(--primary-light); }

/* ======= VIEW TOGGLE ======= */
.view-toggle { display: inline-flex; gap: 2px; background: #f0f0f0; border-radius: 8px; padding: 2px; }
.view-toggle .btn { border: none; padding: 6px 14px; border-radius: 6px; font-size: 0.82rem; }
.view-toggle .btn.active { background: var(--primary); color: #fff; }
.view-toggle .btn:not(.active) { background: transparent; color: var(--text-muted); }
.view-toggle .btn:not(.active):hover { background: rgba(0,0,0,0.05); }

/* ======= PATIENT PROFILE HEADER ======= */
.patient-profile-header {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 20px;
}
.patient-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
}

/* ======= BMI GAUGE ======= */
.bmi-gauge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    margin-top: 10px;
}
.bmi-value { font-size: 1.8rem; font-weight: 900; }
.bmi-label { font-size: 0.85rem; font-weight: 600; }

/* ======= PROGRESS CHART CARD ======= */
.progress-chart-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.progress-chart-card h6 { font-weight: 700; color: var(--primary); margin-bottom: 15px; }

/* ======= SMOOTH ENTRANCE ======= */
.fade-in-up { animation: fadeInUp 0.5s ease forwards; opacity: 0; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.row > [class*="col-"]:nth-child(1) .stat-card { animation-delay: 0s; }
.row > [class*="col-"]:nth-child(2) .stat-card { animation-delay: 0.05s; }
.row > [class*="col-"]:nth-child(3) .stat-card { animation-delay: 0.1s; }
.row > [class*="col-"]:nth-child(4) .stat-card { animation-delay: 0.15s; }

/* ======= USER GUIDE ======= */
.guide-nav-card { border-radius: var(--radius); overflow: hidden; }
.guide-nav-card .card-header { padding: 14px 18px; font-size: 0.95rem; }
.guide-nav-list {
    list-style: none;
    padding: 0; margin: 0;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}
.guide-nav-list li a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 18px; font-size: 0.85rem;
    color: var(--text-dark); text-decoration: none;
    border-right: 3px solid transparent;
    transition: var(--transition);
}
.guide-nav-list li a:hover { background: #f5f5f5; color: var(--primary); }
.guide-nav-list li a.active {
    background: #E8F5E9; color: var(--primary);
    border-right-color: var(--primary);
    font-weight: 700;
}
.guide-nav-list li a i { width: 18px; text-align: center; font-size: 0.82rem; color: var(--text-muted); }
.guide-nav-list li a.active i { color: var(--primary); }
.guide-nav-divider {
    padding: 10px 18px 4px;
    font-size: 0.75rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
}
.guide-section { margin-bottom: 20px; scroll-margin-top: 90px; }
.guide-section-title {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 15px; padding-bottom: 12px;
    border-bottom: 2px solid #E8F5E9;
}
.guide-section-title i { font-size: 1.3rem; color: var(--primary); }
.guide-section-title h5 { margin: 0; font-weight: 700; color: var(--text-dark); }
.guide-steps { display: flex; flex-direction: column; gap: 12px; }
.guide-step {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px; background: #FAFAFA;
    border-radius: var(--radius-sm);
    border-right: 3px solid var(--primary);
}
.guide-step .step-num {
    flex-shrink: 0;
    width: 32px; height: 32px;
    background: var(--primary-gradient);
    color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.9rem;
}
.guide-step strong { display: block; margin-bottom: 3px; color: var(--text-dark); }
.guide-step p { margin: 0; font-size: 0.88rem; color: var(--text-muted); }
.guide-list { padding-right: 18px; margin: 0; }
.guide-list li { padding: 4px 0; font-size: 0.9rem; line-height: 1.7; }
.guide-fields-grid {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.guide-field {
    background: #E8F5E9; color: var(--primary-dark);
    padding: 4px 14px; border-radius: 20px;
    font-size: 0.82rem; font-weight: 600;
}
.guide-actions-row {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.guide-actions-row .badge { font-size: 0.82rem; padding: 6px 12px; }
.guide-feature-card {
    text-align: center; padding: 20px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.guide-feature-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.guide-feature-card i { font-size: 1.8rem; margin-bottom: 10px; display: block; }
.guide-feature-card h6 { font-weight: 700; margin-bottom: 5px; }
.guide-feature-card small { color: var(--text-muted); font-size: 0.82rem; }
.guide-accordion .accordion-button {
    font-weight: 600; font-size: 0.9rem;
    padding: 12px 18px;
}
.guide-accordion .accordion-button:not(.collapsed) { background: #E8F5E9; color: var(--primary); }
.guide-accordion .accordion-body { font-size: 0.9rem; }
.guide-fields-table .table { font-size: 0.85rem; }
.guide-fields-table th { white-space: nowrap; }
.guide-nav-search input { font-size: 0.82rem; }
@media (max-width: 991px) {
    .guide-nav-card { position: static !important; margin-bottom: 20px; }
    .guide-nav-list { max-height: 300px; }
}

/* ======================================
   Nutrition Calculator
   ====================================== */
.nutri-section-header {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nutri-section-header i {
    font-size: 1.1rem;
}
.nutri-result-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    height: 100%;
    transition: var(--transition);
}
.nutri-result-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.nutri-result-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
}
.nutri-result-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}
.nutri-result-icon {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 5px;
}
/* BMI Gauge */
.bmi-gauge { margin-top: 10px; }
.bmi-gauge-bar {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to left, #B71C1C, #E65100, #F57F17, #2E7D32, #1976D2);
    position: relative;
    margin-bottom: 5px;
}
.bmi-gauge-marker {
    position: absolute;
    top: -4px;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 3px solid #333;
    border-radius: 50%;
    transform: translateX(50%);
    transition: right 0.5s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.bmi-gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 4px;
}
/* Energy Cards */
.nutri-energy-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px 15px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    height: 100%;
    transition: var(--transition);
}
.nutri-energy-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.nutri-energy-card.nutri-energy-target {
    border: 2px solid var(--primary-light);
    background: linear-gradient(135deg, #E8F5E9 0%, #fff 100%);
}
.nutri-energy-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.3rem;
}
.nutri-energy-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 500;
}
.nutri-energy-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}
.nutri-energy-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.nutri-energy-desc {
    font-size: 0.72rem;
    color: #999;
    margin-top: 5px;
}
/* Macro Bar */
.nutri-macro-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.nutri-macro-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.nutri-macro-item:hover {
    box-shadow: var(--shadow-lg);
}
.nutri-macro-item.protein { border-right: 4px solid #FF6384; }
.nutri-macro-item.carbs { border-right: 4px solid #FFCE56; }
.nutri-macro-item.fat { border-right: 4px solid #36A2EB; }
.nutri-macro-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.nutri-macro-item.protein .nutri-macro-icon { background: #FFE0E6; color: #FF6384; }
.nutri-macro-item.carbs .nutri-macro-icon { background: #FFF8E1; color: #F9A825; }
.nutri-macro-item.fat .nutri-macro-icon { background: #E3F2FD; color: #36A2EB; }
.nutri-macro-info { flex: 1; }
.nutri-macro-name { font-weight: 700; font-size: 0.95rem; }
.nutri-macro-detail { font-size: 0.82rem; color: var(--text-muted); }
.nutri-macro-cal { font-weight: 700; font-size: 0.9rem; color: var(--text-dark); white-space: nowrap; }
/* Serving Cards */
.nutri-serving-card {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 15px 10px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    height: 100%;
    transition: var(--transition);
}
.nutri-serving-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.nutri-serving-icon { font-size: 1.4rem; margin-bottom: 5px; }
.nutri-serving-value { font-size: 1.6rem; font-weight: 800; color: var(--text-dark); }
.nutri-serving-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.nutri-serving-cal { font-size: 0.68rem; color: #aaa; margin-top: 3px; }

@media (max-width: 767px) {
    .nutri-result-value { font-size: 1.6rem; }
    .nutri-energy-value { font-size: 1.3rem; }
    .nutri-serving-value { font-size: 1.2rem; }
    .bmi-gauge-labels { font-size: 0.6rem; }
}

/* ======= SUBSCRIPTION PLAN CARDS ======= */
.sub-plan-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
    transition: var(--transition);
    text-align: center;
}
.sub-plan-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.sub-plan-card .plan-price { font-size: 1.8rem; font-weight: 900; color: var(--primary); }
.sub-plan-card .plan-period { color: var(--text-muted); font-size: 0.85rem; }
.status-dot.frozen { background: #6c757d; }
.status-dot.warning { background: #ffc107; }

/* ======= PROGRAM LINKS FIX ======= */
.table a.program-link { color: var(--primary-dark); text-decoration: none; font-weight: 700; }
.table a.program-link:hover { color: var(--primary); text-decoration: underline; }

/* ======= BETTER FORM SWITCHES ======= */
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ======= PAGE STAT ROW ======= */
.page-stats { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; }
.page-stat-item {
    flex: 1; min-width: 140px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 15px 18px;
    box-shadow: var(--shadow);
    text-align: center;
    border-bottom: 3px solid var(--primary);
    transition: var(--transition);
}
.page-stat-item:hover { transform: translateY(-2px); }
.page-stat-item .stat-val { font-size: 1.4rem; font-weight: 800; color: var(--primary-dark); }
.page-stat-item .stat-lbl { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.page-stat-item.danger { border-bottom-color: var(--danger); }
.page-stat-item.danger .stat-val { color: var(--danger); }
.page-stat-item.warning { border-bottom-color: var(--warning); }
.page-stat-item.warning .stat-val { color: #E65100; }
.page-stat-item.info { border-bottom-color: var(--info); }
.page-stat-item.info .stat-val { color: var(--info); }
.page-stat-item.success { border-bottom-color: var(--success); }
.page-stat-item.success .stat-val { color: var(--success); }

/* ======= VIEW TOGGLE BUTTONS ======= */
.view-toggle { display: inline-flex; gap: 0; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid var(--border-color); }
.view-toggle .btn { border: none; border-radius: 0; padding: 6px 14px; font-size: 0.85rem; }
.view-toggle .btn.active { background: var(--primary); color: #fff; }
.view-toggle .btn:not(.active) { background: #fff; color: var(--text-muted); }
.view-toggle .btn:not(.active):hover { background: #f8f9fa; }
