/*
 * سیستەمی نەخۆشخانا - ڕووکاری فەرمی و یەکگرتوو (Theme)
 * تایبەت بە بەکارهێنانی ئۆفلاین - هیچ فۆنت یان سەرچاوەیەکی دەرەکی ناوەڵێنێت
 * تەنها فۆنتە ناوخۆییەکانی سیستەمی کۆمپیوتەر بەکاردێت (Tahoma / Segoe UI / Arial)
 */

:root {
    /* ===== ڕەنگی سەرەکی - شینی تۆخی فەرمی ===== */
    --navy-900: #0a2439;
    --navy-800: #0e3350;
    --navy-700: #123f61;
    --navy-600: #1a5075;
    --navy-500: #22638f;
    --navy-100: #e7edf2;

    /* ===== ڕەنگی لاوەکی - ئاڵتونی تۆخ (فەرمی) ===== */
    --gold-700: #8a6d1f;
    --gold-600: #a3822a;
    --gold-500: #b9974b;
    --gold-100: #f4ecd8;

    /* ===== ڕەنگە ناڕەسمیەکان (بەشەکان) ===== */
    --c-surgery: #123f61;
    --c-lab: #0e6b63;
    --c-pharmacy: #7a3d5c;
    --c-platelet: #59417f;
    --c-radiology: #1f5f88;
    --c-sonar: #0e7d75;
    --c-nasoor: #93403c;
    --c-total: #a3822a;
    --c-expense: #99372d;
    --c-receipt: #7c5a2e;
    --c-supply: #96602c;
    --c-net: #2b6e49;
    --c-paid: #2b6e49;
    --c-pending: #a3822a;
    --c-count: #55677a;
    --c-care: #b23b6b;
    --c-icu: #a1281f;
    --c-nicu: #2f7d9e;
    --c-emergency: #c0392b;

    /* ===== نەوت / پاسپینە ===== */
    --bg: #eef1f5;
    --surface: #ffffff;
    --border: #e0e4e9;
    --border-strong: #ccd3da;
    --text: #26313d;
    --text-muted: #667180;

    /* ===== دۆخەکان ===== */
    --success: #1e7245;
    --success-bg: #e7f3ec;
    --danger: #a4342b;
    --danger-bg: #faeae9;
    --warning: #93700c;
    --warning-bg: #fbf1dc;
    --info: #1a5c78;
    --info-bg: #e6f0f4;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(10, 36, 57, 0.06);
    --shadow-md: 0 4px 14px rgba(10, 36, 57, 0.08);
    --font: 'Segoe UI', Tahoma, Arial, sans-serif;
}

* { font-family: var(--font); }

body { background: var(--bg); color: var(--text); }

h1, h2, h3, h4, h5, h6 { color: var(--navy-800); font-weight: 700; letter-spacing: -0.01em; }

a { color: var(--navy-600); }

::selection { background: var(--gold-100); color: var(--navy-900); }

/* ===================== SIDEBAR ===================== */
.sidebar {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, var(--navy-800) 0%, var(--navy-900) 100%);
    color: #fff;
    position: fixed;
    right: 0;
    top: 0;
    width: 260px;
    z-index: 1000;
    border-left: 1px solid rgba(255,255,255,0.06);
}
.sidebar-header {
    padding: 28px 20px 22px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-header i { color: var(--gold-500); }
.sidebar-logo {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    background: #fff;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    margin: 0 auto 8px;
}
.sidebar-header h5 { color: #fff; font-weight: 700; font-size: 1.02rem; margin-bottom: 4px; letter-spacing: 0; }
.sidebar-header small { letter-spacing: .03em; text-transform: uppercase; font-size: .7rem; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.35); }
.nav-item:last-child .nav-link { margin-bottom: 15px; }
.nav-link {
    color: rgba(255,255,255,0.78);
    padding: 13px 20px;
    border-right: 3px solid transparent;
    font-size: .93rem;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-link:hover, .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.07);
    border-right-color: var(--gold-500);
}
.nav-link.active { font-weight: 600; }
.nav-link i { width: 25px; text-align: center; margin-left: 10px; color: rgba(255,255,255,0.85); }
.nav-link.text-danger { color: #e2a29c !important; }

/* ===================== LAYOUT ===================== */
.main-content { margin-right: 260px; padding: 24px; }

.topbar {
    background: var(--surface);
    padding: 16px 26px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar h4, .topbar h5 { margin-bottom: 0; }

/* ===================== CARDS ===================== */
.card-custom {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    padding: 24px;
    border-radius: var(--radius);
    color: #fff;
    box-shadow: var(--shadow-md);
    position: relative;
}
.stat-card i { font-size: 2.2rem; opacity: 0.55; }
.stat-card h3 { font-size: 1.85rem; font-weight: 700; color: #fff; }
.stat-card small, .stat-card .text-white-50 { opacity: 0.85; }

.bg-surgery   { background: var(--c-surgery); }
.bg-lab       { background: var(--c-lab); }
.bg-pharmacy  { background: var(--c-pharmacy); }
.bg-platelet  { background: var(--c-platelet); }
.bg-radiology { background: var(--c-radiology); }
.bg-sonar     { background: var(--c-sonar); }
.bg-nasoor    { background: var(--c-nasoor); }
.bg-total     { background: var(--c-total); }
.bg-expense   { background: var(--c-expense); }
.bg-receipt   { background: var(--c-receipt); }
.bg-supply    { background: var(--c-supply); }
.bg-net       { background: var(--c-net); }
.bg-count     { background: var(--c-count); }
.bg-care      { background: var(--c-care); }
.bg-icu       { background: var(--c-icu); }
.bg-nicu      { background: var(--c-nicu); }
.bg-emergency { background: var(--c-emergency); }

.share-card {
    background: var(--navy-100);
    border-radius: var(--radius);
    padding: 20px;
    border-right: 4px solid var(--navy-700);
}
.expense-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    border-right: 4px solid var(--c-expense);
}
.receipt-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    border-right: 4px solid var(--c-supply);
}
.income-card {
    background: linear-gradient(135deg, var(--c-platelet), #40305f);
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
}
.income-card h3 { font-size: 2.2rem; font-weight: 700; }
.income-input { font-size: 1.4rem; font-weight: 700; text-align: center; }

/* ===================== AVATARS ===================== */
.patient-avatar, .staff-avatar, .user-avatar {
    border-radius: 50%;
    background: var(--navy-700);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700;
}
.patient-avatar { width: 40px; height: 40px; }
.staff-avatar, .user-avatar { width: 45px; height: 45px; font-size: 1.1rem; }

/* ===================== TABLE ===================== */
.table th {
    background: var(--navy-100);
    font-weight: 600;
    color: var(--navy-800);
    font-size: .85rem;
    border-bottom-width: 1px;
}
.table td { vertical-align: middle; }
.table td, .table th { border-color: var(--border); }
.table-hover > tbody > tr:hover > * { background-color: #f5f8fa; }

/* ===================== FORMS / BUTTONS ===================== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-strong);
}
.form-control:focus, .form-select:focus {
    border-color: var(--navy-600);
    box-shadow: 0 0 0 0.2rem rgba(18, 63, 97, 0.15);
}
.form-group label { color: var(--navy-800); }

.btn-primary-custom {
    background: var(--navy-700);
    border: 1px solid var(--navy-700);
    border-radius: var(--radius-sm);
    color: #fff;
    transition: background .15s ease;
}
.btn-primary-custom:hover { background: var(--navy-800); color: #fff; }

.btn-primary { background-color: var(--navy-700); border-color: var(--navy-700); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--navy-800); border-color: var(--navy-800); }
.btn-outline-primary { color: var(--navy-700); border-color: var(--navy-700); }
.btn-outline-primary:hover { background-color: var(--navy-700); border-color: var(--navy-700); }

.input-group-text { background: var(--navy-100); border-color: var(--border-strong); color: var(--navy-800); }

/* ===================== MODAL ===================== */
.modal-content { border-radius: var(--radius); border: none; }
.modal-header {
    background: var(--navy-800);
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ===================== BADGES / STATUS ===================== */
.status-badge, .status-paid, .status-pending {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}
.status-pending  { background: var(--warning-bg); color: var(--warning); }
.status-preparing{ background: var(--info-bg); color: var(--info); }
.status-in_surgery{ background: var(--danger-bg); color: var(--danger); }
.status-recovery { background: var(--success-bg); color: var(--success); }
.status-completed{ background: #eee7f5; color: #5b3a8c; }
.status-paid     { background: var(--success-bg); color: var(--success); }
.status-discharged { background: var(--navy-100); color: var(--navy-800); }

.badge-dept { font-size: .75rem; font-weight: 600; }

/* ===================== TABS ===================== */
.accounting-tabs {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.accounting-tabs .tab-btn {
    flex: 1;
    min-width: 160px;
    padding: 13px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    text-decoration: none;
}
.accounting-tabs .tab-btn:hover { background: #e5e9ed; color: var(--navy-800); }
.accounting-tabs .tab-btn.active {
    background: var(--navy-700);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.tab-badge { background: rgba(255,255,255,0.22); padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; margin-right: 5px; }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.nav-tabs .nav-link { color: var(--navy-700) !important; background: transparent !important; border-right: none !important; padding: 10px 20px; font-weight: 600; }
.nav-tabs .nav-link.active { background: var(--navy-700) !important; color: #fff !important; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.nav-tabs .nav-link.active .badge { color: var(--navy-700) !important; }

/* ===================== SEARCH ===================== */
.search-box { position: relative; }
.search-box input { padding-right: 40px; border-radius: 25px; }
.search-box i { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ===================== TYPE / PRICE CARDS (surgery & service types) ===================== */
.type-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease;
}
.type-card:hover { box-shadow: var(--shadow-md); }
.type-card-inactive { opacity: 0.55; background: var(--bg); }
.type-name { font-weight: 700; font-size: 1.02rem; color: var(--navy-800); }
.type-price { font-size: 1.25rem; font-weight: 700; color: var(--success); }

.price-breakdown { background: var(--bg); border-radius: var(--radius-sm); padding: 15px; }
.price-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--border-strong); }

/* ===================== ROOM & PATIENT CARDS (surgery room) ===================== */
.room-card {
    border-radius: var(--radius);
    padding: 20px;
    color: #fff;
    transition: transform .2s ease;
    cursor: pointer;
}
.room-card:hover { transform: translateY(-3px); }
.room-occupied  { background: var(--c-expense); }
.room-available { background: var(--c-net); }
.room-vip       { background: var(--gold-600); }
.room-vvip      { background: var(--c-platelet); }

.patient-card {
    border-right: 4px solid var(--navy-700);
    transition: box-shadow .2s ease;
}
.patient-card:hover { box-shadow: var(--shadow-md); }

.screen-preview {
    background: #0a1622;
    color: #4ade80;
    padding: 26px;
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    text-align: center;
    margin: 20px 0;
}

.nurse-checkbox { display: inline-block; margin: 5px; }
.nurse-checkbox .form-check { background: var(--bg); padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ===================== EMPTY STATE ===================== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state i { font-size: 2.6rem; opacity: 0.3; margin-bottom: 12px; }

/* ===================== PRINT (shared: dashboard/accounting/archive/room-supplies) ===================== */
.print-section, .print-receipt, .print-header { display: none; }
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-right: 0; }
    .print-section, .print-receipt { display: block !important; }
    .print-header { display: block !important; }
    .card-custom { break-inside: avoid; box-shadow: none !important; }
    .table-responsive { overflow: visible !important; }
}
.print-header { text-align: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 2px solid var(--navy-700); }
.print-header h3 { color: var(--navy-800); }
.print-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.print-table th, .print-table td { border: 1px solid #555; padding: 8px; text-align: right; }
.print-table th { background: #f0f0f0; }
.summary-box { border: 2px solid var(--navy-700); padding: 15px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.summary-box h4 { color: var(--navy-800); margin-bottom: 10px; }

.receipt-header { text-align: center; border-bottom: 2px solid var(--navy-700); padding-bottom: 15px; margin-bottom: 20px; }
.receipt-header h3 { color: var(--navy-800); }
.receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.receipt-table th, .receipt-table td { border: 1px solid #555; padding: 8px; text-align: right; }
.receipt-table th { background: #f0f0f0; }

/* ===================== LOGIN & UNAUTHORIZED (full-page) ===================== */
body.auth-page {
    background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--navy-900) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container, .unauthorized-container {
    background: rgba(255,255,255,0.97);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(10,36,57,0.35);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    animation: fadeIn 0.5s ease-out;
}
.unauthorized-container { padding: 55px 40px; text-align: center; max-width: 480px; width: 90%; }
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo i { font-size: 54px; color: var(--navy-700); }
.login-logo img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 0 6px 18px rgba(10,36,57,0.18);
}
.login-logo h2 { color: var(--navy-800); font-weight: 700; margin-top: 14px; font-size: 1.4rem; }
.login-logo p { color: var(--text-muted); font-size: 0.9rem; }

.unauthorized-icon { font-size: 70px; color: var(--danger); margin-bottom: 18px; }
.unauthorized-container h2 { color: var(--danger); font-weight: 700; margin-bottom: 14px; }
.unauthorized-container p { color: var(--text-muted); margin-bottom: 28px; font-size: 1.05rem; }
.btn-back {
    background: var(--navy-700);
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 28px;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: background .2s ease;
}
.btn-back:hover { background: var(--navy-800); color: #fff; }

.form-floating > label { right: 0; left: auto; padding-right: 1rem; }
.form-floating > .form-control { padding-right: 1rem; }

.btn-login {
    background: var(--navy-700);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-weight: 600;
    font-size: 1.05rem;
    color: #fff;
    transition: background .2s ease;
}
.btn-login:hover { background: var(--navy-800); color: #fff; }

.footer-text { text-align: center; margin-top: 18px; color: var(--text-muted); font-size: 0.85rem; }

.alert { border-radius: var(--radius-sm); }
