/* ==========================================================
   Haswani System - General styles (Dashboard)
   Page is LTR (English), sidebar on the left side
   ========================================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1f2a40;
    --sidebar-bg-hover: #2b3a57;
    --sidebar-text: #c7d0e0;
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #4c8bf5;
    --topbar-h: 60px;
    --content-bg: #f4f6fa;
    --border-soft: #e3e8f0;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: var(--content-bg);
    color: #2c3345;
}

/* ===== App shell layout ===== */
.app-shell {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

/* ===== Sidebar (left side) ===== */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--sidebar-accent);
    color: #fff;
    font-weight: 800;
}

.sidebar-nav {
    padding: 10px 0 30px;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-group-title {
    padding: 16px 20px 6px;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #7c88a1;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-accent);
}

.nav-icon {
    color: var(--sidebar-accent);
    font-size: 0.7rem;
}

/* ===== Main area ===== */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #2c3345;
}

.topbar-spacer {
    flex: 1;
}

.topbar-user {
    color: #6b7488;
    font-size: 0.9rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #2c3345;
}

.app-content {
    padding: 24px;
    flex: 1;
}

.app-footer {
    padding: 14px 24px;
    color: #8a93a6;
    font-size: 0.85rem;
    border-top: 1px solid var(--border-soft);
    background: #fff;
}

/* ===== Page header ===== */
.page-header {
    margin-bottom: 22px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.page-header p {
    color: #8a93a6;
    margin: 0;
}

/* ===== Generic content card ===== */
.content-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 20px;
}

/* ===== Section shades (one gray shade per hierarchy level) =====
   Delegation → Site → Work → Contractor Task → Follow-ups → Result
   Darkest at the top level (Delegation), getting lighter going down.
   Each level: a background shade + a side bar.
   Usage: <div class="content-card sec sec-delegation"> ... */
.sec {
    border-left: 6px solid transparent;
}
.sec .table {
    --bs-table-bg: transparent;     /* tables take the section shade */
}
.sec-delegation    { background: #d9dde1; border-left-color: #343a40; }
.sec-site     { background: #dee2e6; border-left-color: #495057; }
.sec-work     { background: #e3e6e9; border-left-color: #6c757d; }
.sec-task     { background: #e9ecef; border-left-color: #868e96; }
.sec-followup { background: #f1f3f5; border-left-color: #9aa1a8; }
.sec-result   { background: #f8f9fa; border-left-color: #adb5bd; }

/* ===== Login page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    width: 100%;
    max-width: 380px;
    padding: 16px;
}
.login-brand {
    height: auto;
    justify-content: center;
    border-bottom: none;
    margin-bottom: 16px;
}
.login-brand a {
    color: #1f2a40;
}
.login-logo {
    text-align: center;
    margin-bottom: 20px;
}
.login-logo img {
    max-width: 220px;
    width: 100%;
    height: auto;
}
.captcha-img {
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

/* ===== Notifications (bell + list) ===== */
.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #495057;
    padding: 4px 6px;
    margin-right: 4px;
    text-decoration: none;
}
.notif-bell:hover {
    color: #1d4ed8;
}
.notif-count {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}
.notif-unread td {
    font-weight: 600;
    background: #f5f8ff;
}

/* ===== Tables tweaks ===== */
.table > :not(caption) > * > * {
    padding: 0.65rem 0.75rem;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        z-index: 1050;
        transition: transform .25s ease;
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: inline-block;
    }
}

/* ===== Record info (track-info): أيقونة دائرية ناعمة ===== */
.track-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #dbe4f0;
    border-radius: 50%;
    background: #f1f5fb;
    color: #5b7ba6;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.track-info:hover,
.track-info:focus-visible {
    background: #e2ecf9;
    border-color: #a9c1e3;
    color: #2f5d9b;
    outline: none;
}

/* ===== المواقع المنسوخة (Copy): سطر بلون زهري ===== */
.table > tbody > tr.row-copy > * {
    --bs-table-bg: #fde7f0;
}
.table-hover > tbody > tr.row-copy:hover > * {
    --bs-table-bg-state: #fbd5e5;
}

/* ===== أعداد الموقع (counts-info): نفس شكل Record Info بلون مختلف ===== */
.counts-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    margin-right: 4px;
    border: 1px solid #cdebe6;
    border-radius: 50%;
    background: #eefaf8;
    color: #2f8f82;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.counts-info:hover,
.counts-info:focus-visible {
    background: #dcf4ef;
    border-color: #95d5ca;
    color: #1d6b60;
    outline: none;
}

/* الأعداد داخل النافذة المنبثقة: الاسم يساراً والرقم يميناً */
.counts-pop { min-width: 160px; }
.counts-pop > div { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; }
.counts-pop span { color: #6c757d; }
.counts-pop strong { font-weight: 600; }
