/* ============================================================
   نظام إدارة القضايا — main.css
   Design: Authoritative Legal — Deep Navy + Gold Accent
   Font: Cairo (Arabic), Amiri (headings)
   ============================================================ */

:root {
  --navy:        #0D1B2A;
  --navy-mid:    #1A2B40;
  --navy-light:  #253550;
  --gold:        #C9A84C;
  --gold-light:  #E8C97A;
  --gold-pale:   #FDF3DA;
  --cream:       #F7F4EF;
  --white:       #FFFFFF;
  --text-dark:   #0D1B2A;
  --text-mid:    #3A4A5C;
  --text-muted:  #7A8A9C;
  --border:      #E0D8CC;
  --success:     #1A7A4A;
  --danger:      #B52626;
  --warning:     #C97820;
  --info:        #1A5F8A;
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --shadow-sm:   0 1px 3px rgba(13,27,42,.08);
  --shadow-md:   0 4px 16px rgba(13,27,42,.12);
  --shadow-lg:   0 8px 32px rgba(13,27,42,.18);
  --transition:  0.2s ease;
}

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;scroll-behavior:smooth}
body{
  font-family:'Cairo',system-ui,sans-serif;
  background:var(--cream);color:var(--text-dark);
  direction:rtl;min-height:100vh;display:flex;overflow-x:hidden;
}
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--navy-light);border-radius:99px}

/* SIDEBAR */
.sidebar{
  width:var(--sidebar-w);min-height:100vh;background:var(--navy);
  display:flex;flex-direction:column;position:fixed;top:0;right:0;bottom:0;
  z-index:1000;transition:transform var(--transition);overflow:hidden;
}
.sidebar::before{content:'';position:absolute;top:0;right:0;width:3px;height:100%;
  background:linear-gradient(to bottom,var(--gold),transparent 70%);}
.sidebar-brand{display:flex;align-items:center;gap:12px;padding:24px 20px 20px;
  border-bottom:1px solid rgba(201,168,76,.15);}
.brand-logo{width:44px;height:44px;background:linear-gradient(135deg,var(--gold),var(--gold-light));
  border-radius:var(--radius-md);display:flex;align-items:center;justify-content:center;
  font-size:20px;color:var(--navy);flex-shrink:0;box-shadow:0 4px 12px rgba(201,168,76,.35);}
.brand-text{display:flex;flex-direction:column;line-height:1.2}
.brand-name{font-family:'Amiri',serif;font-size:18px;font-weight:700;color:var(--white);letter-spacing:.5px}
.brand-sub{font-size:11px;color:var(--text-muted);font-weight:400}
.sidebar-nav{flex:1;padding:16px 12px;overflow-y:auto}
.nav-list{list-style:none;display:flex;flex-direction:column;gap:3px}
.sidebar-link{display:flex;align-items:center;gap:12px;padding:11px 14px;
  border-radius:var(--radius-sm);color:rgba(255,255,255,.65);text-decoration:none;
  font-size:14px;font-weight:500;transition:all var(--transition);position:relative;white-space:nowrap;}
.sidebar-link i{font-size:17px;width:20px;flex-shrink:0}
.sidebar-link:hover{background:rgba(201,168,76,.12);color:var(--gold-light)}
.sidebar-link.active{background:rgba(201,168,76,.18);color:var(--gold);font-weight:600}
.sidebar-link.active::after{content:'';position:absolute;left:0;top:25%;height:50%;
  width:3px;background:var(--gold);border-radius:0 2px 2px 0;}
.sidebar-footer{display:flex;align-items:center;padding:16px 16px 20px;
  border-top:1px solid rgba(255,255,255,.08);gap:10px;}
.user-info{flex:1;display:flex;align-items:center;gap:10px;min-width:0}
.user-avatar{width:36px;height:36px;background:linear-gradient(135deg,var(--navy-light),var(--gold));
  border-radius:50%;display:flex;align-items:center;justify-content:center;
  font-size:15px;font-weight:700;color:var(--white);flex-shrink:0;}
.user-meta{min-width:0}
.user-name{font-size:13px;font-weight:600;color:var(--white);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.user-role{font-size:11px;color:var(--gold)}
.logout-btn{width:34px;height:34px;border-radius:var(--radius-sm);background:rgba(181,38,38,.15);
  color:#ff8080;display:flex;align-items:center;justify-content:center;
  text-decoration:none;font-size:16px;transition:all var(--transition);flex-shrink:0;}
.logout-btn:hover{background:rgba(181,38,38,.3);color:var(--white)}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:999}

/* MAIN */
.main-wrap{flex:1;margin-right:var(--sidebar-w);display:flex;flex-direction:column;min-height:100vh;transition:margin var(--transition)}

/* TOPBAR */
.topbar{height:var(--topbar-h);background:var(--white);border-bottom:1px solid var(--border);
  display:flex;align-items:center;padding:0 24px;gap:16px;position:sticky;top:0;z-index:100;box-shadow:var(--shadow-sm);}
.topbar-toggle{display:none;border:none;background:none;font-size:22px;color:var(--navy);cursor:pointer;padding:4px 8px}
.topbar-title{flex:1;font-family:'Amiri',serif;font-size:20px;font-weight:700;color:var(--navy)}
.topbar-actions{display:flex;align-items:center;gap:12px}
.topbar-icon-btn{width:38px;height:38px;border:1px solid var(--border);border-radius:var(--radius-sm);
  background:var(--white);color:var(--text-mid);display:flex;align-items:center;justify-content:center;
  cursor:pointer;font-size:17px;position:relative;transition:all var(--transition);}
.topbar-icon-btn:hover{border-color:var(--gold);color:var(--gold)}
.topbar-icon-btn .badge{position:absolute;top:-5px;right:-5px;min-width:18px;height:18px;font-size:10px;padding:2px 4px}
.topbar-user{font-size:13px;font-weight:600;color:var(--text-mid);padding:6px 12px;background:var(--cream);border-radius:var(--radius-sm)}
.page-content{flex:1;padding:28px 28px 40px}

/* NOTIFICATIONS */
.notif-wrap{position:relative}
.notif-dropdown{display:none;position:absolute;top:calc(100% + 8px);left:0;width:340px;
  background:var(--white);border:1px solid var(--border);border-radius:var(--radius-md);
  box-shadow:var(--shadow-lg);z-index:500;overflow:hidden;}
.notif-dropdown.open{display:block;animation:fadeDown .15s ease}
@keyframes fadeDown{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}
.notif-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;
  border-bottom:1px solid var(--border);font-size:14px;font-weight:600;color:var(--navy);}
.mark-all{font-size:12px;font-weight:400;color:var(--gold);text-decoration:none}
.notif-list{max-height:320px;overflow-y:auto}
.notif-loading{padding:24px;text-align:center;color:var(--text-muted);font-size:13px}
.notif-item{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;
  border-bottom:1px solid var(--border);cursor:pointer;transition:background var(--transition);}
.notif-item:hover{background:var(--cream)}
.notif-item.unread{background:var(--gold-pale)}
.notif-icon{width:36px;height:36px;border-radius:50%;background:var(--navy);color:var(--gold);
  display:flex;align-items:center;justify-content:center;font-size:15px;flex-shrink:0;}
.notif-body{flex:1;min-width:0}
.notif-title{font-size:13px;font-weight:600;color:var(--navy)}
.notif-msg{font-size:12px;color:var(--text-muted);margin-top:2px}
.notif-time{font-size:11px;color:var(--text-muted);margin-top:4px}

/* STAT CARDS */
.stat-card{background:var(--white);border-radius:var(--radius-md);padding:24px;border:1px solid var(--border);
  display:flex;align-items:center;gap:18px;transition:all var(--transition);box-shadow:var(--shadow-sm);}
.stat-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-md)}
.stat-icon{width:56px;height:56px;border-radius:var(--radius-md);display:flex;align-items:center;justify-content:center;font-size:24px;flex-shrink:0}
.stat-icon.gold{background:rgba(201,168,76,.12);color:var(--gold)}
.stat-icon.navy{background:rgba(13,27,42,.08);color:var(--navy)}
.stat-icon.green{background:rgba(26,122,74,.1);color:var(--success)}
.stat-icon.red{background:rgba(181,38,38,.1);color:var(--danger)}
.stat-icon.blue{background:rgba(26,95,138,.1);color:var(--info)}
.stat-body{flex:1}
.stat-value{font-size:28px;font-weight:800;color:var(--navy);line-height:1}
.stat-label{font-size:13px;color:var(--text-muted);margin-top:4px}
.stat-delta{font-size:12px;color:var(--success);font-weight:600;margin-top:4px}

/* PANELS */
.panel{background:var(--white);border-radius:var(--radius-md);border:1px solid var(--border);box-shadow:var(--shadow-sm);overflow:hidden}
.panel-header{display:flex;align-items:center;justify-content:space-between;padding:18px 24px;border-bottom:1px solid var(--border);background:var(--white)}
.panel-title{font-family:'Amiri',serif;font-size:17px;font-weight:700;color:var(--navy);display:flex;align-items:center;gap:8px}
.panel-title i{color:var(--gold)}
.panel-body{padding:24px}

/* TABLE */
.table{margin-bottom:0;font-size:14px}
.table thead{background:var(--cream)}
.table thead th{font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.5px;
  color:var(--text-muted);border-bottom:2px solid var(--border);padding:12px 16px;white-space:nowrap;}
.table tbody td{padding:12px 16px;vertical-align:middle;border-bottom:1px solid var(--border)}
.table tbody tr:hover{background:var(--gold-pale)}
.table tbody tr:last-child td{border-bottom:none}

/* BADGES */
.badge{font-family:'Cairo',sans-serif;font-size:11px;font-weight:600;padding:4px 10px;border-radius:99px}
.bg-success{background-color:var(--success)!important}
.bg-danger{background-color:var(--danger)!important}
.bg-warning{background-color:var(--warning)!important;color:var(--white)!important}
.bg-info{background-color:var(--info)!important}
.bg-gold{background-color:var(--gold);color:var(--navy)}
.bg-navy{background-color:var(--navy)}

/* BUTTONS */
.btn{font-family:'Cairo',sans-serif;font-size:14px;font-weight:600;border-radius:var(--radius-sm);
  padding:8px 20px;transition:all var(--transition);display:inline-flex;align-items:center;gap:8px;}
.btn-primary{background:var(--navy);border-color:var(--navy);color:var(--white)}
.btn-primary:hover{background:var(--navy-light);border-color:var(--navy-light)}
.btn-gold{background:var(--gold);border:none;color:var(--navy);font-weight:700}
.btn-gold:hover{background:var(--gold-light);color:var(--navy)}
.btn-outline-gold{background:transparent;border:1.5px solid var(--gold);color:var(--gold)}
.btn-outline-gold:hover{background:var(--gold);color:var(--navy)}
.btn-sm{padding:5px 12px;font-size:12px}

/* FORMS */
.form-label{font-size:13px;font-weight:600;color:var(--text-mid);margin-bottom:6px}
.form-control,.form-select{font-family:'Cairo',sans-serif;font-size:14px;border:1.5px solid var(--border);
  border-radius:var(--radius-sm);padding:10px 14px;color:var(--text-dark);background:var(--white);transition:border-color var(--transition);}
.form-control:focus,.form-select:focus{border-color:var(--gold);box-shadow:0 0 0 3px rgba(201,168,76,.15);outline:none}
.form-section-title{font-family:'Amiri',serif;font-size:16px;font-weight:700;color:var(--navy);
  padding-bottom:10px;border-bottom:2px solid var(--gold);margin-bottom:20px;display:flex;align-items:center;gap:8px;}

/* UPLOAD */
.upload-zone{border:2px dashed var(--border);border-radius:var(--radius-md);padding:32px 20px;
  text-align:center;cursor:pointer;transition:all var(--transition);background:var(--cream);}
.upload-zone:hover,.upload-zone.drag-over{border-color:var(--gold);background:var(--gold-pale)}
.upload-zone i{font-size:36px;color:var(--gold);margin-bottom:8px;display:block}
.upload-zone p{font-size:14px;color:var(--text-muted);margin:0}

/* TIMELINE */
.stage-timeline{display:flex;align-items:center;padding:20px 0}
.stage-step{flex:1;display:flex;flex-direction:column;align-items:center;gap:8px;position:relative}
.stage-step:not(:last-child)::after{content:'';position:absolute;top:16px;left:-50%;
  width:100%;height:2px;background:var(--border);z-index:0;}
.stage-step.done::after{background:var(--gold)}
.stage-step.active::after{background:linear-gradient(to left,var(--border),var(--gold))}
.stage-dot{width:32px;height:32px;border-radius:50%;background:var(--border);display:flex;
  align-items:center;justify-content:center;font-size:13px;color:var(--text-muted);position:relative;z-index:1;transition:all .3s;}
.stage-step.done .stage-dot{background:var(--gold);color:var(--navy)}
.stage-step.active .stage-dot{background:var(--navy);color:var(--gold);border:2px solid var(--gold)}
.stage-label{font-size:12px;font-weight:600;color:var(--text-muted);text-align:center}
.stage-step.done .stage-label{color:var(--gold)}
.stage-step.active .stage-label{color:var(--navy)}

/* AUTH */
.auth-wrap{min-height:100vh;display:flex;background:var(--navy);position:relative;overflow:hidden}
.auth-side{width:45%;background:linear-gradient(160deg,var(--navy-mid) 0%,var(--navy) 100%);
  display:flex;flex-direction:column;justify-content:center;align-items:center;padding:60px 50px;position:relative;overflow:hidden;}
.auth-side::before{content:'';position:absolute;bottom:-100px;left:-100px;width:400px;height:400px;
  border-radius:50%;border:60px solid rgba(201,168,76,.07);}
.auth-side::after{content:'';position:absolute;top:-80px;right:-80px;width:300px;height:300px;
  border-radius:50%;border:50px solid rgba(201,168,76,.05);}
.auth-logo{width:80px;height:80px;background:linear-gradient(135deg,var(--gold),var(--gold-light));
  border-radius:20px;display:flex;align-items:center;justify-content:center;font-size:38px;color:var(--navy);
  margin-bottom:28px;box-shadow:0 8px 32px rgba(201,168,76,.35);position:relative;z-index:1;}
.auth-side-title{font-family:'Amiri',serif;font-size:30px;font-weight:700;color:var(--white);
  text-align:center;line-height:1.3;position:relative;z-index:1;margin-bottom:16px;}
.auth-side-sub{font-size:14px;color:rgba(255,255,255,.5);text-align:center;line-height:1.7;position:relative;z-index:1}
.auth-divider{width:60px;height:3px;background:var(--gold);border-radius:99px;margin:20px auto}
.auth-features{margin-top:40px;display:flex;flex-direction:column;gap:14px;position:relative;z-index:1}
.auth-feature{display:flex;align-items:center;gap:14px;color:rgba(255,255,255,.7);font-size:14px}
.auth-feature i{color:var(--gold);font-size:18px;width:24px;flex-shrink:0}
.auth-form-wrap{flex:1;display:flex;align-items:center;justify-content:center;padding:40px;background:var(--cream);overflow-y:auto}
.auth-form-box{width:100%;max-width:480px;background:var(--white);border-radius:var(--radius-lg);padding:40px;box-shadow:var(--shadow-lg)}
.auth-form-title{font-family:'Amiri',serif;font-size:24px;font-weight:700;color:var(--navy);margin-bottom:6px}
.auth-form-sub{font-size:13px;color:var(--text-muted);margin-bottom:28px}

/* PAGINATION */
.page-link{font-family:'Cairo',sans-serif;font-size:13px;color:var(--navy);border-color:var(--border);transition:all var(--transition)}
.page-link:hover{background:var(--gold);color:var(--navy);border-color:var(--gold)}
.page-item.active .page-link{background:var(--navy);border-color:var(--navy)}

/* UTILS */
.text-gold{color:var(--gold)!important}
.text-navy{color:var(--navy)!important}
.bg-cream{background:var(--cream)!important}
.fw-700{font-weight:700}
.fw-800{font-weight:800}
.font-amiri{font-family:'Amiri',serif}
.section-gap{margin-bottom:24px}
.action-btn{width:32px;height:32px;border-radius:var(--radius-sm);border:1px solid var(--border);
  background:var(--white);color:var(--text-mid);display:inline-flex;align-items:center;justify-content:center;
  font-size:14px;text-decoration:none;transition:all var(--transition);cursor:pointer;}
.action-btn:hover{border-color:var(--navy);color:var(--navy);background:var(--cream)}
.action-btn.danger:hover{border-color:var(--danger);color:var(--danger);background:rgba(181,38,38,.06)}
.action-btn.success:hover{border-color:var(--success);color:var(--success);background:rgba(26,122,74,.06)}
.action-btn.gold:hover{border-color:var(--gold);color:var(--gold);background:var(--gold-pale)}
.empty-state{text-align:center;padding:60px 24px;color:var(--text-muted)}
.empty-state i{font-size:52px;margin-bottom:16px;color:var(--border)}
.empty-state h5{font-size:16px;color:var(--text-mid);margin-bottom:8px}

/* Responsive */
@media(max-width:991px){
  .sidebar{transform:translateX(100%)}
  .sidebar.open{transform:translateX(0)}
  .sidebar-overlay.open{display:block}
  .main-wrap{margin-right:0}
  .topbar-toggle{display:flex}
  .auth-side{display:none}
  .auth-form-wrap{background:var(--navy)}
  .page-content{padding:20px 16px 32px}
}
