/* =========================================
   BiblioUni - Custom Styles
   University Library Management System
   ========================================= */

:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --secondary: #7C3AED;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #06B6D4;
  --sidebar-width: 260px;
  --sidebar-bg: #1E1B4B;
  --topbar-height: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
body { font-family: var(--font); background: #F1F5F9; color: #1E293B; margin: 0; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width); height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1000; overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: white; flex-shrink: 0;
  overflow: hidden;
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; }
.brand-title { color: #fff; font-size: 1rem; font-weight: 700; line-height: 1.2; }
.brand-subtitle { color: rgba(255,255,255,0.45); font-size: 0.68rem; line-height: 1; }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 12px 10px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.nav-section-title {
  color: rgba(255,255,255,0.35); font-size: 0.65rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 8px 10px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.65); text-decoration: none;
  padding: 8px 12px; border-radius: 8px; margin-bottom: 2px;
  font-size: 0.875rem; font-weight: 500;
  transition: all 0.15s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-link.active { background: rgba(79,70,229,0.35); color: #fff; }
.nav-link i { width: 18px; font-size: 1rem; flex-shrink: 0; }

.nav-link-action {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.85); text-decoration: none;
  padding: 7px 12px; border-radius: 8px; margin-bottom: 2px;
  font-size: 0.875rem; font-weight: 600;
  background: rgba(79,70,229,0.2);
  border: 1px solid rgba(79,70,229,0.35);
  transition: all 0.15s ease;
}
.nav-link-action:hover { background: rgba(79,70,229,0.4); color: #fff; }
.nav-link-action i { width: 18px; font-size: 1rem; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.user-avatar { color: rgba(255,255,255,0.7); font-size: 1.8rem; flex-shrink: 0; }
.user-name { color: #fff; font-size: 0.8rem; font-weight: 600; }
.user-role { color: rgba(255,255,255,0.45); font-size: 0.68rem; }

/* ===================== MAIN CONTENT ===================== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }
.main-content.expanded { margin-left: 0; }

/* ===================== TOPBAR ===================== */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 900;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.topbar-time {
  background: #F8FAFC; border: 1px solid #E2E8F0;
  padding: 4px 12px; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600; color: #475569;
  font-family: 'Courier New', monospace;
}
.btn-icon {
  background: none; border: none; color: #64748B;
  padding: 4px 8px; border-radius: 6px;
  cursor: pointer; transition: all 0.15s ease;
}
.btn-icon:hover { background: #F1F5F9; color: var(--primary); }

/* ===================== PAGE CONTENT ===================== */
.page-content { flex: 1; padding: 24px; }
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px;
}
.page-title { font-size: 1.4rem; font-weight: 700; color: #0F172A; margin: 0; }
.page-subtitle { color: #64748B; font-size: 0.875rem; margin: 4px 0 0; }

/* ===================== KPI CARDS ===================== */
.kpi-card {
  border-radius: 16px; padding: 20px; color: #fff;
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.kpi-primary { background: linear-gradient(135deg, #4F46E5, #7C3AED); }
.kpi-success { background: linear-gradient(135deg, #059669, #10B981); }
.kpi-warning { background: linear-gradient(135deg, #D97706, #F59E0B); }
.kpi-danger  { background: linear-gradient(135deg, #DC2626, #EF4444); }
.kpi-info    { background: linear-gradient(135deg, #0891B2, #06B6D4); }
.kpi-purple  { background: linear-gradient(135deg, #6D28D9, #8B5CF6); }
.kpi-teal    { background: linear-gradient(135deg, #0F766E, #14B8A6); }
.kpi-secondary { background: linear-gradient(135deg, #475569, #64748B); }
.kpi-icon { font-size: 1.8rem; opacity: 0.7; margin-bottom: 8px; }
.kpi-value { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.kpi-label { font-size: 0.8rem; opacity: 0.85; font-weight: 500; }
.kpi-sub { font-size: 0.72rem; opacity: 0.75; margin-top: 6px; }

/* ===================== CHART CARDS ===================== */
.chart-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 2px 12px rgba(0,0,0,0.04);
  overflow: hidden;
}
.chart-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 8px;
  border-bottom: 1px solid #F1F5F9;
}
.chart-title { font-size: 0.9rem; font-weight: 700; color: #0F172A; margin: 0; }
.chart-subtitle { font-size: 0.72rem; color: #94A3B8; margin: 2px 0 0; }
.chart-body { padding: 16px; }

/* ===================== DATA CARDS ===================== */
.data-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 2px 12px rgba(0,0,0,0.04);
  overflow: hidden;
}
.data-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #F1F5F9;
  background: #FAFAFA;
}
.data-card-body { }

/* ===================== FILTER BAR ===================== */
.filter-bar {
  background: #fff; border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* ===================== BOOK CARDS ===================== */
.book-card { transition: transform 0.15s ease, box-shadow 0.15s ease; border-radius: 12px!important; }
.book-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.12)!important; }
.book-cover-mini {
  width: 60px; height: 80px; flex-shrink: 0;
}
.book-cover-mini img { width: 60px; height: 80px; object-fit: cover; }
.cover-placeholder {
  width: 60px; height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.cover-large {
  width: 160px; height: 220px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.featured-cover {
  width: 90px; height: 120px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.text-truncate-2 {
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ===================== RANK BADGES ===================== */
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 0.72rem; font-weight: 700;
}
.rank-1 { background: #FEF08A; color: #713F12; }
.rank-2 { background: #E2E8F0; color: #334155; }
.rank-3 { background: #FED7AA; color: #7C2D12; }
.rank-4, .rank-5, .rank-6, .rank-7, .rank-8, .rank-9, .rank-10 { background: #F1F5F9; color: #64748B; }

/* ===================== HERO SECTION ===================== */
.hero-section {
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4338CA 100%);
}

/* ===================== CATEGORY CARDS ===================== */
.category-card { transition: transform 0.15s ease; border-radius: 12px!important; }
.category-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.12)!important; }

/* ===================== BUTTONS & MISC ===================== */
.btn-xs { padding: 2px 8px; font-size: 0.72rem; border-radius: 5px; }
.hover-bg:hover { background: #F8FAFC!important; }
.min-w-0 { min-width: 0; }
.border { border-color: #E2E8F0!important; }

.card { border-radius: 12px!important; }
.table th { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #64748B; }
.breadcrumb { font-size: 0.82rem; }
.alert { border-radius: 10px; border: none; }

/* ===================== STATUS BADGES SOFT ===================== */
.bg-primary-subtle { background: rgba(79,70,229,0.1)!important; }
.bg-success-subtle { background: rgba(16,185,129,0.1)!important; }
.bg-warning-subtle { background: rgba(245,158,11,0.1)!important; }
.bg-danger-subtle  { background: rgba(239,68,68,0.1)!important; }
.bg-info-subtle    { background: rgba(6,182,212,0.1)!important; }
.bg-secondary-subtle { background: rgba(100,116,139,0.1)!important; }
.table-danger-subtle  { background: rgba(239,68,68,0.05)!important; }
.table-warning-subtle { background: rgba(245,158,11,0.05)!important; }

/* ===================== PUBLIC LAYOUT ===================== */
.public-layout { min-height: 100vh; background: #F8FAFC; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .kpi-value { font-size: 1.5rem; }
  .page-header { flex-direction: column; gap: 12px; }
}

/* ===================== PRINT ===================== */
@media print {
  .sidebar, .topbar { display: none; }
  .main-content { margin: 0; }
  .page-content { padding: 0; }
}
