/* assets/css/app.css */

/* =========================
   Base / Layout
   ========================= */
:root{
  --sidebar-w: 260px;
  --topbar-h: 56px;

  --brand: #0a72d8;
  --brand-2: #0b5ed7;

  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;

  --border: #e5e7eb;

  --radius: 14px;
  --shadow: 0 10px 26px rgba(0,0,0,.06);

  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #0ea5e9;
}

html, body{
  height: 100%;
}

body{
  font-family: Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* RTL helpers */
[dir="rtl"] .text-end { text-align: left !important; }
[dir="rtl"] .ms-auto { margin-left: 0 !important; margin-right: auto !important; }
[dir="rtl"] .me-auto { margin-right: 0 !important; margin-left: auto !important; }

/* =========================
   Sidebar
   ========================= */
.app-shell{
  min-height: 100vh;
  display: flex;
}

.sidebar{
  width: var(--sidebar-w);
  background: #0b1220;
  color: #e5e7eb;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
}

.sidebar .brand{
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  gap: 10px;
}

.sidebar .brand .logo{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #d8f2ff 0%, var(--brand) 70%);
  box-shadow: 0 10px 20px rgba(10,114,216,.25);
}

.sidebar .brand .title{
  font-weight: 700;
  letter-spacing: .2px;
}

.sidebar .nav{
  padding: 10px;
}

.sidebar .nav a{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #e5e7eb;
  text-decoration: none;
  border-radius: 12px;
  margin-bottom: 6px;
  transition: all .15s ease;
  border: 1px solid transparent;
}

.sidebar .nav a:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.06);
}

.sidebar .nav a.active{
  background: rgba(10,114,216,.20);
  border-color: rgba(10,114,216,.28);
}

.sidebar .nav .nav-section{
  color: rgba(255,255,255,.55);
  font-size: 12px;
  padding: 10px 12px 6px;
  text-transform: none;
}

.sidebar .nav .badge{
  margin-inline-start: auto;
}

/* =========================
   Main / Topbar
   ========================= */
.main{
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar{
  height: var(--topbar-h);
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.content{
  padding: 14px;
}

/* responsive sidebar */
@media (max-width: 991px){
  :root{ --sidebar-w: 0px; }
  .sidebar{
    display: none;
  }
  .content{
    padding: 12px;
  }
}

/* =========================
   Cards / Tables
   ========================= */
.card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header{
  border-bottom: 1px solid var(--border);
}

.table{
  margin-bottom: 0;
}

.table thead th{
  font-weight: 700;
  font-size: 13px;
}

.table td, .table th{
  vertical-align: middle;
}

.table-hover tbody tr:hover{
  background: rgba(10,114,216,.05);
}

/* =========================
   Buttons (match brand)
   ========================= */
.btn-primary{
  background: var(--brand);
  border-color: var(--brand);
}
.btn-primary:hover{
  background: var(--brand-2);
  border-color: var(--brand-2);
}

.btn-outline-primary{
  color: var(--brand);
  border-color: rgba(10,114,216,.4);
}
.btn-outline-primary:hover{
  background: rgba(10,114,216,.08);
  border-color: rgba(10,114,216,.6);
  color: var(--brand);
}

/* =========================
   Forms
   ========================= */
.form-control, .form-select{
  border-radius: 12px;
  border-color: var(--border);
}
.form-control:focus, .form-select:focus{
  border-color: rgba(10,114,216,.45);
  box-shadow: 0 0 0 .2rem rgba(10,114,216,.15);
}

/* =========================
   Tree UI (centers.php)
   ========================= */
.tree-root ul{
  margin: 0;
  padding: 0;
}

.tree-root li{
  position: relative;
  padding-inline-start: 10px;
}

.tree-root li::before{
  content: "";
  position: absolute;
  top: 12px;
  inset-inline-start: 0px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(10,114,216,.55);
}

/* =========================
   Helpers
   ========================= */
.small-muted{
  font-size: 12px;
  color: var(--muted);
}

.shadow-sm{
  box-shadow: var(--shadow) !important;
}

.rounded-2xl{
  border-radius: 18px !important;
}

/* =========================
   Print
   ========================= */
@media print{
  body{
    background: #fff !important;
  }
  .no-print, .sidebar, .topbar{
    display: none !important;
  }
  .content{
    padding: 0 !important;
  }
  .card{
    box-shadow: none !important;
    border: 0 !important;
  }

  /* Footer for printed reports (system requirement) */
  .print-footer{
    position: fixed;
    left: 0; right: 0; bottom: 6px;
    text-align: center;
    font-size: 11px;
    color: #111;
  }
}
