/* ============================================================
   AIO Digital Library Management System - Main Stylesheet
   ============================================================ */

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

:root {
  --primary: #1a3a5c;
  --primary-light: #2563a8;
  --accent: #d4a017;
  --accent-light: #f5c842;
  --dark: #0d1f35;
  --text: #2d3748;
  --text-muted: #718096;
  --bg: #f7f9fc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --sidebar-w: 260px;
  --header-h: 64px;
  --shadow: 0 2px 16px rgba(26,58,92,0.10);
  --shadow-lg: 0 8px 32px rgba(26,58,92,0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
a { text-decoration: none; color: inherit; transition: var(--transition); }
img { max-width: 100%; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; }

/* ---- TYPOGRAPHY ---- */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.25; color: var(--dark); }
.display-font { font-family: 'Playfair Display', serif; }

/* ---- UTILITIES ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-white { color: #fff; }
.fw-600 { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-primary { background: #dbeafe; color: var(--primary); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: var(--transition); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,58,92,0.3); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover  { background: var(--accent-light); color: var(--dark); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-light   { background: #f1f5f9; color: var(--text); }
.btn-light:hover { background: var(--border); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; color: var(--text); background: #fff; transition: var(--transition); outline: none; }
.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,168,0.12); }
.form-control::placeholder { color: #a0aec0; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ---- CARDS ---- */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h4 { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: #f8fafc; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { background: #f1f5f9; padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #dcfce7; border-left: 4px solid var(--success); color: #15803d; }
.alert-danger  { background: #fee2e2; border-left: 4px solid var(--danger);  color: #b91c1c; }
.alert-warning { background: #fef3c7; border-left: 4px solid var(--warning); color: #92400e; }
.alert-info    { background: #dbeafe; border-left: 4px solid var(--info);    color: #1e40af; }

/* ---- STAT CARDS ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; border-left: 4px solid transparent; transition: var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.blue   { border-color: var(--primary-light); }
.stat-card.green  { border-color: var(--success); }
.stat-card.orange { border-color: var(--warning); }
.stat-card.red    { border-color: var(--danger); }
.stat-card.gold   { border-color: var(--accent); }
.stat-icon { width: 52px; height: 52px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-card.blue   .stat-icon { background: #dbeafe; }
.stat-card.green  .stat-icon { background: #dcfce7; }
.stat-card.orange .stat-icon { background: #fef3c7; }
.stat-card.red    .stat-icon { background: #fee2e2; }
.stat-card.gold   .stat-icon { background: #fef9c3; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--dark); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 4px; }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 4px; justify-content: flex-end; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 6px; font-size: 13px; border: 1px solid var(--border); color: var(--text); }
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- MODAL ---- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.active { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius); width: 100%; max-width: 580px; box-shadow: var(--shadow-lg); animation: modalIn 0.2s ease; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h4 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
@keyframes modalIn { from { opacity:0; transform: scale(0.95); } to { opacity:1; transform: scale(1); } }

/* ---- DASHBOARD SIDEBAR ---- */
.dash-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--dark); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; transition: transform 0.3s ease; }
.sidebar-logo { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo .logo-name { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; color: var(--accent); line-height: 1.2; }
.sidebar-logo .logo-sub  { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 3px; }
.sidebar-section { padding: 8px 0; }
.sidebar-section-title { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(255,255,255,0.35); padding: 12px 20px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; font-size: 13.5px; color: rgba(255,255,255,0.7); cursor: pointer; border-left: 3px solid transparent; transition: var(--transition); }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,0.08); border-left-color: var(--accent); }
.nav-item .nav-icon { font-size: 17px; min-width: 22px; }
.sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }

/* ---- DASHBOARD TOPBAR ---- */
.dash-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: var(--header-h); background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.08); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 17px; font-weight: 700; color: var(--dark); }
.hamburger { display: none; background: none; border: none; cursor: pointer; font-size: 22px; }
.user-badge { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.user-info .user-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.user-info .user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.dash-content { flex: 1; padding: 24px; }
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; }
.page-header p  { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.breadcrumb { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a:hover { color: var(--primary); }

/* ---- NOTIFICATION BELL ---- */
.notif-btn { position: relative; background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-muted); padding: 4px; }
.notif-badge { position: absolute; top: 0; right: 0; width: 16px; height: 16px; background: var(--danger); border-radius: 50%; font-size: 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* ---- SEARCH BAR ---- */
.search-bar { display: flex; align-items: center; background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; padding: 0 12px; gap: 8px; }
.search-bar input { border: none; background: none; outline: none; padding: 8px 0; font-size: 14px; min-width: 200px; }
.search-bar span { color: var(--text-muted); }

/* ---- PROGRESS BAR ---- */
.progress { background: var(--border); border-radius: 100px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 100px; background: var(--primary-light); transition: width 0.3s; }

/* ---- RFID READER ---- */
.rfid-card { background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: var(--radius); padding: 24px; color: #fff; text-align: center; }
.rfid-card .rfid-icon { font-size: 48px; margin-bottom: 12px; }
.rfid-status { display: inline-block; padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,0.2); margin-top: 10px; }

/* ---- BOOK CARD ---- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; }
.book-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: var(--transition); }
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.book-cover { height: 220px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 48px; }
.book-info { padding: 12px; }
.book-title { font-size: 13px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { font-size: 12px; color: var(--text-muted); }
.book-avail { font-size: 11px; margin-top: 8px; }

/* ---- CHART WRAPPER ---- */
.chart-wrap { position: relative; height: 250px; }

/* ---- QUICK ACTIONS ---- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 12px; }
.quick-btn { background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer; transition: var(--transition); }
.quick-btn:hover { border-color: var(--primary-light); background: #f0f6ff; }
.quick-btn .q-icon { font-size: 28px; margin-bottom: 8px; display: block; }
.quick-btn .q-label { font-size: 12px; font-weight: 600; color: var(--text); }

/* ---- TABS ---- */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 4px; }
.tab-btn { padding: 9px 18px; font-size: 13px; font-weight: 600; color: var(--text-muted); border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .dash-main { margin-left: 0; }
  .hamburger { display: block; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: repeat(3,1fr); }
  .search-bar input { min-width: 100px; }
}
