/* ================================================================
   Al-Basheer CRMS — Simplified PeopleSoft-Style Theme (v6)
   Matches the plain, minimal Oracle PeopleSoft / AIOU reference:
   dark navy header, plain white content, light-green active state,
   no gradients, no card shadows, no decorative icon boxes.
   ================================================================ */

@font-face {
    font-family: 'Jameel Noori Nastaleeq';
    src: url('../fonts/JameelNooriNastaleeq.woff2') format('woff2'),
         url('../fonts/JameelNooriNastaleeq.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --ps-navy:        #003366;
    --ps-navy-d:      #002244;
    --ps-navy-m:      #04518c;
    --ps-navy-l:      #0a6cb8;
    --ps-header-h:    46px;
    --ps-subnav-w:    220px;
    --ps-white:       #ffffff;
    --ps-bg:          #ffffff;
    --ps-border:      #c0c0c0;
    --ps-border-l:    #dcdcdc;
    --ps-text:        #1a1a1a;
    --ps-text-m:      #333333;
    --ps-text-l:      #6e6e6e;
    --ps-green-active:#d4ebd0;
    --ps-link:        #0645ad;
    --ps-link-h:      #003366;
    --ps-row-alt:     #f7f7f7;
    --ps-row-hover:   #eef4fb;
    --ps-input-bg:    #ffffff;
    --ps-shadow-sm:   none;
    --font-en:        Arial, Helvetica, 'Liberation Sans', sans-serif;
    --font-urdu:      'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
    --radius:         3px;
    --radius-md:      3px;
}

body.dark-mode {
    --ps-bg:       #15171c;
    --ps-white:    #1e2128;
    --ps-border:   #383b42;
    --ps-border-l: #2c2f36;
    --ps-text:     #e6e6e6;
    --ps-text-m:   #c7c7c7;
    --ps-text-l:   #8b8b8b;
    --ps-row-alt:  #1a1d23;
    --ps-row-hover:#22262d;
    --ps-input-bg: #1a1d23;
    --ps-green-active: #294a2a;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-en);
    font-size: 13px;
    color: var(--ps-text);
    background: var(--ps-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ps-link); text-decoration: none; }
a:hover { color: var(--ps-link-h); text-decoration: underline; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--ps-bg); }
::-webkit-scrollbar-thumb { background: #b8b8b8; }
::-webkit-scrollbar-thumb:hover { background: #989898; }

/* ================================================================
   TOP HEADER BAR — plain dark navy, centered title
   ================================================================ */
.ps-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--ps-header-h);
    background: linear-gradient(180deg, #135590 0%, #0a3e6e 55%, #07315a 100%);
    display: flex;
    align-items: center;
    z-index: 1050;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.ps-header-back {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 14px;
    color: #fff;
    font-size: 13px;
    text-decoration: none;
    flex-shrink: 0;
}
.ps-header-back:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.ps-header-back i { font-size: 16px; }

.ps-header-brand {
    flex: 1;
    text-align: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 0.3px;
    pointer-events: none;
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ps-header-right {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    padding-right: 4px;
}

.ps-header-icon-btn {
    height: 100%;
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    border: none;
    background: none;
    text-decoration: none;
    position: relative;
}
.ps-header-icon-btn:hover { background: rgba(255,255,255,0.1); }

.ps-search-wrap { padding: 0 8px; }
.ps-search-box {
    display: flex;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.12);
    width: 190px;
}
.ps-search-box i { padding: 0 6px; color: rgba(255,255,255,0.75); font-size: 13px; }
.ps-search-box input {
    border: none; outline: none; background: transparent;
    color: #fff; font-size: 12px; padding: 5px 6px 5px 0; width: 100%;
    font-family: var(--font-en);
}
.ps-search-box input::placeholder { color: rgba(255,255,255,0.6); }

.ps-notif-badge {
    position: absolute;
    top: 5px; right: 5px;
    min-width: 15px; height: 15px;
    background: #c0392b;
    border-radius: 50%;
    font-size: 9px;
    font-weight: bold;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    padding: 0 2px;
}

.ps-hamburger {
    display: none;
    width: 42px; height: 100%;
    align-items: center; justify-content: center;
    color: #fff; font-size: 19px;
    border: none; background: none;
    cursor: pointer;
    flex-shrink: 0;
}

/* ================================================================
   BODY LAYOUT
   ================================================================ */
.ps-body { padding-top: var(--ps-header-h); min-height: 100vh; }

/* ================================================================
   DASHBOARD HOMEPAGE — plain module list/grid, no decoration
   ================================================================ */
.ps-dashboard { padding: 22px 28px; max-width: 1300px; margin: 0 auto; }

.ps-dashboard-welcome {
    padding: 0 0 14px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--ps-border-l);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.ps-dashboard-welcome .welcome-text { font-size: 13px; color: var(--ps-text-m); }
.ps-dashboard-welcome .welcome-text strong { color: var(--ps-navy); font-size: 15px; }
.ps-dashboard-welcome .urdu { font-family: var(--font-urdu); font-size: 16px; direction: rtl; color: var(--ps-navy); }

.ps-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0;
    margin-bottom: 26px;
    border-top: 1px solid var(--ps-border-l);
    border-left: 1px solid var(--ps-border-l);
}

.ps-module-card {
    background: var(--ps-white);
    border-right: 1px solid var(--ps-border-l);
    border-bottom: 1px solid var(--ps-border-l);
    padding: 22px 14px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: var(--ps-text);
    display: block;
}
.ps-module-card:hover { background: var(--ps-row-hover); color: var(--ps-text); text-decoration: none; }

.ps-module-icon {
    width: 40px; height: 40px;
    margin: 0 auto 10px;
    display: flex; align-items: center; justify-content: center;
}
.ps-module-icon svg { width: 30px; height: 30px; }
.ps-module-label { font-size: 12.5px; font-weight: bold; color: var(--ps-navy); line-height: 1.35; margin-bottom: 2px; }
.ps-module-sub { font-size: 10.5px; color: var(--ps-text-l); }

.ps-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0;
    margin-bottom: 22px;
    border-top: 1px solid var(--ps-border-l);
    border-left: 1px solid var(--ps-border-l);
}
.ps-stat-box {
    background: var(--ps-white);
    border-right: 1px solid var(--ps-border-l);
    border-bottom: 1px solid var(--ps-border-l);
    padding: 12px 14px;
    text-align: left;
}
.ps-stat-box .val { font-size: 20px; font-weight: bold; color: var(--ps-navy); line-height: 1.1; }
.ps-stat-box .lbl { font-size: 10.5px; color: var(--ps-text-l); margin-top: 3px; }

/* ================================================================
   TWO-COLUMN INNER PAGE LAYOUT
   ================================================================ */
.ps-inner { display: flex; min-height: calc(100vh - var(--ps-header-h)); align-items: flex-start; }

.ps-subnav {
    width: var(--ps-subnav-w);
    flex-shrink: 0;
    background: var(--ps-white);
    border-right: 1px solid var(--ps-border-l);
    min-height: calc(100vh - var(--ps-header-h));
    position: sticky;
    top: var(--ps-header-h);
    overflow-y: auto;
    padding-bottom: 24px;
}

/* Plain header row, no navy/green block — small icon + bold text, thin bottom border */
.ps-subnav-header {
    padding: 13px 16px;
    font-size: 13px;
    font-weight: bold;
    color: var(--ps-text);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--ps-border-l);
    background: var(--ps-white);
}
.ps-subnav-header i { font-size: 15px; color: var(--ps-navy); }

.ps-subnav-section {
    font-size: 10px;
    font-weight: bold;
    color: var(--ps-text-l);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 16px 4px;
}

/* Plain rows — active = light green background + bold black text (matches reference exactly) */
.ps-subnav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 12.5px;
    color: var(--ps-text-m);
    text-decoration: none;
    border-bottom: 1px solid var(--ps-border-l);
}
.ps-subnav-link i { font-size: 14px; color: var(--ps-navy); width: 16px; text-align: center; flex-shrink: 0; }
.ps-subnav-link:hover { background: var(--ps-row-hover); text-decoration: none; color: var(--ps-text-m); }
.ps-subnav-link.active {
    background: var(--ps-green-active);
    color: var(--ps-text);
    font-weight: bold;
}

.ps-subnav-divider { height: 1px; background: var(--ps-border-l); margin: 6px 0; }

.ps-content { flex: 1; min-width: 0; padding: 20px 26px; background: var(--ps-bg); }

.ps-breadcrumb {
    font-size: 11.5px;
    color: var(--ps-link);
    margin-bottom: 14px;
}
.ps-breadcrumb a { color: var(--ps-link); }
.ps-breadcrumb .sep { color: var(--ps-text-l); margin: 0 4px; }

/* ================================================================
   PAGE TITLE — plain bold navy text + thin bottom rule
   ================================================================ */
.ps-page-title {
    border-bottom: 1px solid var(--ps-border-l);
    padding-bottom: 10px;
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.ps-page-title h1 {
    font-size: 18px;
    font-weight: bold;
    color: var(--ps-navy);
    margin: 0;
}
.ps-page-title-sub { font-size: 13px; color: var(--ps-text-l); font-family: var(--font-urdu); direction: rtl; }

/* Sub-section bar — like "National Identification Number" in reference */
.ps-section-bar {
    background: var(--ps-row-alt);
    border: 1px solid var(--ps-border-l);
    color: var(--ps-navy);
    font-weight: bold;
    font-size: 12.5px;
    padding: 8px 12px;
    margin: 16px 0 10px;
}

/* ================================================================
   PANELS — flat, no shadow, thin border only
   ================================================================ */
.ps-panel {
    background: var(--ps-white);
    border: 1px solid var(--ps-border-l);
    margin-bottom: 16px;
}
.ps-panel-header {
    background: var(--ps-row-alt);
    border-bottom: 1px solid var(--ps-border-l);
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ps-panel-header .title { font-size: 12.5px; font-weight: bold; color: var(--ps-navy); display: flex; align-items: center; gap: 6px; }
.ps-panel-body { padding: 16px; }

/* ================================================================
   KEY-VALUE DISPLAY (PeopleSoft "Demographic Information" style)
   ================================================================ */
.ps-kv-row { display: flex; gap: 14px; padding: 4px 0; font-size: 13px; }
.ps-kv-label { font-weight: bold; color: var(--ps-text); min-width: 160px; text-align: right; }
.ps-kv-value { color: var(--ps-text-m); flex: 1; }

/* ================================================================
   TABLES — plain, thin borders, no header gradient
   ================================================================ */
.ps-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ps-table th {
    background: var(--ps-row-alt);
    color: var(--ps-navy);
    font-weight: bold;
    padding: 7px 10px;
    text-align: left;
    border: 1px solid var(--ps-border-l);
    font-size: 11.5px;
}
.ps-table td { padding: 6px 10px; border: 1px solid var(--ps-border-l); vertical-align: middle; }
.ps-table tr:nth-child(even) td { background: var(--ps-row-alt); }
.ps-table tr:hover td { background: var(--ps-row-hover); }

/* ================================================================
   FORMS — plain inputs, no glow shadows
   ================================================================ */
.ps-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 20px; margin-bottom: 12px; }
.ps-form-group { display: flex; flex-direction: column; gap: 3px; }
.ps-label { font-size: 11.5px; font-weight: bold; color: var(--ps-text-m); }
.ps-label .req { color: #cc0000; margin-left: 2px; }
.ps-label.urdu { font-family: var(--font-urdu); font-size: 13px; direction: rtl; text-align: right; }

.ps-input, .ps-select, .ps-textarea {
    padding: 5px 8px;
    border: 1px solid var(--ps-border);
    border-radius: var(--radius);
    font-size: 12.5px;
    font-family: var(--font-en);
    color: var(--ps-text);
    background: var(--ps-input-bg);
    width: 100%;
}
.ps-input:focus, .ps-select:focus, .ps-textarea:focus { outline: 1px solid var(--ps-navy); border-color: var(--ps-navy); }
.ps-input.invalid { border-color: #cc0000; }
.ps-input-error { font-size: 10.5px; color: #cc0000; display: none; margin-top: 2px; }
.ps-input-error.show { display: block; }
.ps-select { cursor: pointer; }
.ps-textarea { resize: vertical; min-height: 60px; }

/* ================================================================
   BUTTONS — flat, thin border, small (matches "Return to Search")
   ================================================================ */
.ps-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    font-size: 12.5px;
    font-family: var(--font-en);
    font-weight: bold;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid;
    text-decoration: none;
}
.ps-btn:hover { text-decoration: none; }

.ps-btn-primary { background: #eef4fb; color: var(--ps-navy); border-color: var(--ps-navy); }
.ps-btn-primary:hover { background: var(--ps-navy); color: #fff; }

.ps-btn-secondary { background: #f5f5f0; color: #5a4a1a; border-color: #c8b878; }
.ps-btn-secondary:hover { background: #ece0bc; color: #5a4a1a; }

.ps-btn-success { background: #eef8ee; color: #1a5a1a; border-color: #5a9e4f; }
.ps-btn-success:hover { background: #5a9e4f; color: #fff; }

.ps-btn-danger { background: #fdeeee; color: #8a1a1a; border-color: #c05050; }
.ps-btn-danger:hover { background: #c05050; color: #fff; }

.ps-btn-warning { background: #fff7ea; color: #7a5000; border-color: #d0a030; }
.ps-btn-warning:hover { background: #d0a030; color: #fff; }

.ps-btn-sm { padding: 3px 9px; font-size: 11.5px; }
.ps-btn-xs { padding: 2px 6px; font-size: 11px; }
.ps-btn i { font-size: 13px; }

/* ================================================================
   BADGES — plain, small, thin border (status only — meaningful color)
   ================================================================ */
.ps-badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 2px; font-size: 10.5px; font-weight: bold; border: 1px solid; }
.ps-badge-pending   { background: #fdf6e3; color: #7a5000; border-color: #d0b050; }
.ps-badge-process   { background: #eaf2fb; color: #003366; border-color: #80aad0; }
.ps-badge-completed { background: #eaf7ea; color: #1a5a1a; border-color: #80c080; }
.ps-badge-delivered { background: #f3eafb; color: #4a1a8a; border-color: #a070e0; }
.ps-badge-rejected  { background: #fbeaea; color: #880000; border-color: #d08080; }
.ps-badge-paid      { background: #eaf7ea; color: #1a5a1a; border-color: #80c080; }
.ps-badge-unpaid    { background: #fdf2ea; color: #804000; border-color: #d0a060; }
.ps-badge-active    { background: #eaf7ea; color: #1a5a1a; border-color: #80c080; }
.ps-badge-inactive  { background: #f0f0f0; color: #555; border-color: #c0c0c0; }

/* ================================================================
   TOOLBAR / SEARCH
   ================================================================ */
.ps-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ps-search-box.ps-toolbar-search { max-width: 240px; border: 1px solid var(--ps-border); background: var(--ps-white); }
.ps-search-box.ps-toolbar-search input { color: var(--ps-text); }
.ps-search-box.ps-toolbar-search input::placeholder { color: var(--ps-text-l); }
.ps-search-box.ps-toolbar-search i { color: var(--ps-text-l); }

/* ================================================================
   PAGINATION
   ================================================================ */
.ps-pagination { display: flex; align-items: center; gap: 2px; margin-top: 12px; justify-content: flex-end; }
.ps-page-btn { padding: 3px 8px; font-size: 11.5px; border: 1px solid var(--ps-border); background: var(--ps-white); color: var(--ps-navy); cursor: pointer; }
.ps-page-btn:hover, .ps-page-btn.active { background: var(--ps-navy); color: #fff; }
.ps-page-info { font-size: 11px; color: var(--ps-text-l); margin: 0 8px; }

/* ================================================================
   DROPDOWNS (notifications / user)
   ================================================================ */
.ps-notif-panel, .ps-user-dropdown {
    position: absolute;
    top: calc(var(--ps-header-h) + 1px);
    right: 0;
    background: var(--ps-white);
    border: 1px solid var(--ps-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    z-index: 2000;
    display: none;
}
.ps-notif-panel { width: 300px; }
.ps-user-dropdown { width: 190px; z-index: 2001; }
.ps-notif-panel.open, .ps-user-dropdown.open { display: block; }

.ps-notif-panel-header {
    padding: 9px 12px; border-bottom: 1px solid var(--ps-border-l);
    font-size: 12px; font-weight: bold; color: var(--ps-navy);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--ps-row-alt);
}
.ps-link-btn { font-size: 11px; background: none; border: none; cursor: pointer; color: var(--ps-link); }
.ps-notif-item { padding: 9px 12px; border-bottom: 1px solid var(--ps-border-l); font-size: 12px; cursor: pointer; }
.ps-notif-item:hover { background: var(--ps-row-hover); }
.ps-notif-item.unread { background: #f0f6ff; }
.ps-notif-time { font-size: 10.5px; color: var(--ps-text-l); margin-top: 2px; }

.ps-user-info { padding: 10px 12px; border-bottom: 1px solid var(--ps-border-l); background: var(--ps-row-alt); }
.ps-user-info .name { font-size: 12.5px; font-weight: bold; color: var(--ps-navy); }
.ps-user-info .role { font-size: 10.5px; color: var(--ps-text-l); text-transform: uppercase; }
.ps-user-dropdown-item { display: flex; align-items: center; gap: 7px; padding: 8px 12px; font-size: 12.5px; color: var(--ps-text); border-bottom: 1px solid var(--ps-border-l); text-decoration: none; }
.ps-user-dropdown-item:hover { background: var(--ps-row-hover); color: var(--ps-text); text-decoration: none; }
.ps-user-dropdown-item.danger { color: #aa0000; }
.ps-user-dropdown-item i { font-size: 13px; width: 16px; }

/* ================================================================
   MOBILE RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .ps-hamburger { display: flex; }
    .ps-header-back span { display: none; }
    .ps-subnav {
        position: fixed; top: var(--ps-header-h); left: -100%; bottom: 0;
        z-index: 1040; width: 250px; transition: left 0.25s;
        box-shadow: 4px 0 14px rgba(0,0,0,0.15);
    }
    .ps-subnav.open { left: 0; }
    .ps-subnav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1039; }
    .ps-subnav-overlay.open { display: block; }
    .ps-content { padding: 14px; }
    .ps-dashboard { padding: 14px; }
    .ps-module-grid { grid-template-columns: repeat(2, 1fr); }
    .ps-form-row { grid-template-columns: 1fr; }
    .ps-inner { flex-direction: column; }
    .ps-kv-label { min-width: 110px; }
}

/* ================================================================
   ALERTS / TOASTS
   ================================================================ */
.ps-alert { padding: 8px 12px; font-size: 12.5px; border: 1px solid; margin-bottom: 12px; display: flex; align-items: flex-start; gap: 7px; }
.ps-alert i { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.ps-alert-success { background: #eef8ee; border-color: #80c080; color: #1a5a1a; }
.ps-alert-error   { background: #fdeeee; border-color: #d08080; color: #880000; }
.ps-alert-warning { background: #fffaf0; border-color: #e0c060; color: #7a5000; }
.ps-alert-info    { background: #eef4fb; border-color: #80a8d0; color: #003366; }

/* ================================================================
   URDU TEXT
   ================================================================ */
.urdu { font-family: var(--font-urdu) !important; direction: rtl; font-size: 14px; line-height: 1.8; }
.urdu-sm { font-family: var(--font-urdu) !important; font-size: 12px; direction: rtl; line-height: 1.7; }

/* ================================================================
   LOADING OVERLAY
   ================================================================ */
#ps-loading { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(255,255,255,0.8); align-items: center; justify-content: center; flex-direction: column; gap: 10px; }
#ps-loading.show { display: flex; }
.ps-spinner { width: 30px; height: 30px; border: 3px solid #d0d8e8; border-top-color: var(--ps-navy); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    .ps-header, .ps-subnav, .ps-toolbar, .ps-hamburger, .ps-btn, #ps-loading, .no-print { display: none !important; }
    .ps-inner { display: block; }
    .ps-content { padding: 0; }
    body { background: #fff; }
}

/* ================================================================
   MISC
   ================================================================ */
.ps-divider { height: 1px; background: var(--ps-border-l); margin: 14px 0; }
.ps-text-navy { color: var(--ps-navy); }
.ps-text-muted { color: var(--ps-text-l); }
.ps-fw-bold { font-weight: bold; }
.ps-mono { font-family: 'Courier New', monospace; }
.ps-flex { display: flex; align-items: center; gap: 8px; }
.ps-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.ps-btn-wa { background: #eafaf0; color: #128c45; border-color: #25d366; }
.ps-btn-wa:hover { background: #25d366; color: #fff; }
