/* ============================================================
   iPad Borrowing Management System — Custom CSS
   Theme: Navy Blue + White + Sky Blue
   ============================================================ */

:root {
  --navy:       #0d2137;
  --navy-light: #1565C0;
  --navy-mid:   #163d6e;
  --sky:        #29b6f6;
  --sky-light:  #e3f2fd;
  --white:      #ffffff;
  --sidebar-w:  260px;
  --topnav-h:   60px;
  --body-bg:    #f0f4f8;
  --card-shadow:0 2px 12px rgba(0,0,0,.08);
  --radius:     12px;
  --transition: .25s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Sarabun', sans-serif;
  font-size: 15px;
  background: var(--body-bg);
  color: #333;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f0f0f0; }
::-webkit-scrollbar-thumb { background: var(--navy-light); border-radius: 3px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-mid) 100%);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo {
  width: 44px; height: 44px;
  background: var(--sky);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--white);
  flex-shrink: 0;
}

.sidebar-title h6 {
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
.sidebar-title small {
  color: rgba(255,255,255,.55);
  font-size: 11px;
}

/* Nav */
.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-label {
  color: rgba(255,255,255,.4);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 14px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  font-size: 14.5px;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,.07);
  border-left-color: var(--sky);
}

.nav-item.active {
  color: var(--white);
  background: rgba(41,182,246,.15);
  border-left-color: var(--sky);
  font-weight: 600;
}

.nav-item i { width: 20px; text-align: center; font-size: 15px; }

.text-danger-nav { color: rgba(255,100,100,.8) !important; }
.text-danger-nav:hover { color: #ff5252 !important; background: rgba(255,82,82,.08) !important; }

/* ============================================================
   TOP NAV
   ============================================================ */
.topnav {
  height: var(--topnav-h);
  background: var(--white);
  border-bottom: 1px solid #e8eef4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.btn-sidebar-toggle {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--navy);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--transition);
}
.btn-sidebar-toggle:hover { background: var(--sky-light); }

.topnav-title {
  flex: 1;
  font-weight: 600;
  font-size: 16px;
  color: var(--navy);
}

.topnav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  background: var(--navy-light);
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.user-name { font-weight: 600; font-size: 13.5px; color: var(--navy); line-height: 1.2; }
.user-role { font-size: 11px; color: #888; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

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

/* ============================================================
   CARDS
   ============================================================ */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-weight: 600;
  font-size: 15px;
}

/* ── Stat Cards ── */
.stat-card {
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  color: inherit;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  color: inherit;
}

.stat-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-icon.navy   { background: rgba(13,33,55,.1);  color: var(--navy); }
.stat-icon.blue   { background: rgba(21,101,192,.1); color: var(--navy-light); }
.stat-icon.sky    { background: rgba(41,182,246,.12); color: #0288d1; }
.stat-icon.green  { background: rgba(46,125,50,.1);  color: #2e7d32; }
.stat-icon.orange { background: rgba(230,81,0,.1);   color: #e65100; }
.stat-icon.red    { background: rgba(183,28,28,.1);  color: #b71c1c; }
.stat-icon.purple { background: rgba(106,27,154,.1); color: #6a1b9a; }

.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: 13px; color: #666; margin-top: 2px; }

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header-title h4 {
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}
.page-header-title p {
  font-size: 13px;
  color: #777;
  margin: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { border-radius: 8px; font-weight: 500; }
.btn-navy { background: var(--navy); color: #fff; border: none; }
.btn-navy:hover { background: var(--navy-mid); color: #fff; }

/* ============================================================
   TABLES / DATATABLES
   ============================================================ */
.table { font-size: 14px; }
.table th { font-weight: 600; background: #f8fafc; color: var(--navy); white-space: nowrap; }
.table td { vertical-align: middle; }

div.dataTables_wrapper div.dataTables_filter input {
  border-radius: 8px;
  border: 1px solid #ddd;
  padding: 6px 12px;
}

div.dataTables_wrapper div.dataTables_length select {
  border-radius: 8px;
  border: 1px solid #ddd;
  padding: 4px 8px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid #e0e7ee;
  font-size: 14px;
  padding: 9px 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}

.form-label { font-weight: 600; font-size: 13.5px; color: #444; margin-bottom: 4px; }

/* ============================================================
   BADGE
   ============================================================ */
.badge { font-size: 12px; font-weight: 500; border-radius: 6px; padding: 4px 10px; }
.bg-purple { background: #7b1fa2 !important; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-overlay.open {
    display: block;
  }
}

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container { position: relative; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, var(--navy-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo .logo-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--navy-light), var(--sky));
  border-radius: 18px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
}
.login-logo h4 { font-weight: 700; color: var(--navy); font-size: 16px; text-align: center; }
.login-logo small { color: #888; font-size: 13px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp .4s ease forwards; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topnav, .btn, .dataTables_filter, .dataTables_length, .dataTables_paginate { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card { box-shadow: none !important; }
}
