/* =====================================================
   LibAdmin Pro - Main Stylesheet
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary:       #1a3a5c;
  --primary-light: #2563a8;
  --primary-dark:  #0f2235;
  --accent:        #e6a817;
  --accent-light:  #f5c842;
  --success:       #2e7d32;
  --danger:        #c62828;
  --warning:       #f57f17;
  --info:          #0277bd;
  --bg:            #f0f4f8;
  --sidebar-w:     260px;
  --sidebar-bg:    #0f2235;
  --card-bg:       #ffffff;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --shadow:        0 2px 16px rgba(15,34,53,0.10);
  --radius:        10px;
  --font-display:  'Playfair Display', serif;
  --font-body:     'DM Sans', sans-serif;
  --navbar-h:      60px;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
}

/* ---- Login Page ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2235 0%, #1a3a5c 50%, #2563a8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28);
}

.login-card .brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-card .brand-icon {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 28px;
  color: #fff;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--primary-dark);
}

.login-card p.sub {
  color: var(--text-muted);
  font-size: 0.87rem;
  margin-top: 4px;
}

.form-label { font-weight: 500; color: var(--text); margin-bottom: 5px; }

.form-control {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14.5px;
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,0.15);
  outline: none;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  font-family: var(--font-body);
  margin-top: 6px;
}

.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,168,0.35); }

/* ---- Layout ---- */
.wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
}

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

.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand .brand-text small {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  display: block;
  font-weight: 300;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 14px 22px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 22px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: all .2s;
}

.sidebar-nav a i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.07);
  border-left-color: var(--accent);
}

.sidebar-nav a.active { font-weight: 600; }

.sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color .2s;
}

.sidebar-footer a:hover { color: #fff; }

/* ---- Main Content ---- */
#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Navbar ---- */
.top-navbar {
  height: var(--navbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.navbar-toggler {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.navbar-toggler:hover { background: var(--bg); }

.top-navbar .page-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  flex: 1;
}

.navbar-actions { display: flex; align-items: center; gap: 10px; }

.admin-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 50px;
  background: var(--bg);
  cursor: pointer;
  transition: background .2s;
}

.admin-badge:hover { background: var(--border); }

.admin-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.admin-badge .admin-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

/* ---- Page Content ---- */
.page-content {
  padding: 28px 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--primary-dark);
}

.page-header .breadcrumb-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Stat Cards ---- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(15,34,53,0.13); }
.stat-card.primary { border-left-color: var(--primary-light); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-card.info    { border-left-color: var(--info); }
.stat-card.accent  { border-left-color: var(--accent); }

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

.stat-card.primary .stat-icon { background: rgba(37,99,168,0.12); color: var(--primary-light); }
.stat-card.success .stat-icon { background: rgba(46,125,50,0.12);  color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(245,127,23,0.12); color: var(--warning); }
.stat-card.danger  .stat-icon { background: rgba(198,40,40,0.12);  color: var(--danger); }
.stat-card.info    .stat-icon { background: rgba(2,119,189,0.12);  color: var(--info); }
.stat-card.accent  .stat-icon { background: rgba(230,168,23,0.12); color: var(--accent); }

.stat-body .stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary-dark);
}

.stat-body .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: none;
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title-text {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.card-body { padding: 20px; }

/* ---- Tables ---- */
.table-responsive { border-radius: var(--radius); overflow: hidden; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table thead th {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.85);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 12px 16px;
  white-space: nowrap;
}

table.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

table.data-table tbody tr:last-child { border-bottom: none; }
table.data-table tbody tr:hover { background: #f8fafc; }

table.data-table tbody td {
  padding: 12px 16px;
  font-size: 0.875rem;
  vertical-align: middle;
}

/* ---- Badges ---- */
.badge-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-active   { background: #e8f5e9; color: var(--success); }
.badge-inactive { background: #f5f5f5; color: #757575; }
.badge-suspended{ background: #fff3e0; color: var(--warning); }
.badge-issued   { background: #e3f2fd; color: var(--info); }
.badge-returned { background: #e8f5e9; color: var(--success); }
.badge-overdue  { background: #ffebee; color: var(--danger); }
.badge-available{ background: #e8f5e9; color: var(--success); }
.badge-category { background: rgba(37,99,168,0.1); color: var(--primary-light); }

/* ---- Buttons ---- */
.btn {
  font-family: var(--font-body);
  font-weight: 500;
  border-radius: 7px;
  font-size: 0.855rem;
  padding: 8px 16px;
  transition: all .2s;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary { background: var(--primary-light); color: #fff; }
.btn-primary:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1b5e20; color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #b71c1c; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e65100; color: #fff; }
.btn-info    { background: var(--info); color: #fff; }
.btn-info:hover    { background: #01579b; color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; color: var(--text); }

.btn-sm { padding: 5px 11px; font-size: 0.78rem; border-radius: 6px; }
.btn-icon { padding: 6px 8px; }

.btn-outline-primary { border: 1.5px solid var(--primary-light); color: var(--primary-light); background: transparent; }
.btn-outline-primary:hover { background: var(--primary-light); color: #fff; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { font-weight: 500; font-size: 0.855rem; color: var(--text); display: block; margin-bottom: 6px; }
.form-label .required { color: var(--danger); }

.form-control, .form-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 13px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,0.12);
  outline: none;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.invalid-feedback { color: var(--danger); font-size: 0.78rem; margin-top: 4px; display: block; }
.form-text { color: var(--text-muted); font-size: 0.78rem; margin-top: 4px; }

.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: 8px 0 0 8px; }
.input-group .btn { border-radius: 0 8px 8px 0; flex-shrink: 0; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.alert-success { background: #e8f5e9; color: #1b5e20; border-left: 4px solid var(--success); }
.alert-danger  { background: #ffebee; color: #b71c1c; border-left: 4px solid var(--danger); }
.alert-warning { background: #fff8e1; color: #e65100; border-left: 4px solid var(--warning); }
.alert-info    { background: #e1f5fe; color: #01579b; border-left: 4px solid var(--info); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28);
  transform: scale(0.95);
  transition: transform .25s;
}

.modal-overlay.active .modal-box { transform: scale(1); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--primary-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color .2s, background .2s;
}

.modal-close:hover { color: var(--danger); background: #ffebee; }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- Search bar ---- */
.search-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-bar .form-control { max-width: 280px; min-width: 180px; }

/* ---- Pagination ---- */
.pagination-wrap { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.pagination-info { font-size: 0.82rem; color: var(--text-muted); }
.pagination { display: flex; gap: 4px; }

.page-btn {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  transition: all .15s;
}

.page-btn:hover, .page-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: #fff;
}

/* ---- Charts Placeholder ---- */
.chart-wrap { width: 100%; height: 260px; display: flex; align-items: center; justify-content: center; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state i { font-size: 52px; color: var(--border); margin-bottom: 16px; display: block; }
.empty-state h4 { font-family: var(--font-display); color: var(--text-muted); margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); font-size: 0.875rem; }

/* ---- Profile ---- */
.profile-avatar-wrap { position: relative; display: inline-block; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 38px; font-weight: 700; }
.avatar-upload-btn { position: absolute; bottom: 0; right: 0; background: var(--accent); border: 3px solid #fff; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--primary-dark); font-size: 12px; }

/* ---- Sidebar Overlay ---- */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 999; }

/* ---- Responsive ---- */
@media (max-width: 991px) {
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay { display: block; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
  .sidebar-overlay.active { opacity: 1; visibility: visible; }

  #main-content { margin-left: 0; }

  .navbar-toggler { display: block; }

  .page-content { padding: 18px 16px; }
}

@media (max-width: 576px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .search-bar .form-control { max-width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }
  table.data-table td, table.data-table th { padding: 10px 10px; font-size: 0.82rem; }
}

/* ---- Utility ---- */
.text-primary { color: var(--primary-light) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-accent  { color: var(--accent) !important; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 6px; }
.mb-0 { margin-bottom: 0; }

.row { display: flex; flex-wrap: wrap; gap: 20px; }
.col { flex: 1; min-width: 240px; }
.col-4 { flex: 0 0 calc(33.33% - 14px); min-width: 220px; }
.col-8 { flex: 0 0 calc(66.66% - 7px); min-width: 300px; }

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.fine-highlight { color: var(--danger); font-weight: 700; }

/* Print */
@media print {
  #sidebar, .top-navbar, .btn, .navbar-toggler { display: none !important; }
  #main-content { margin-left: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
