/* ============================================================
   LitQuest - Admin Panel Styles
   ============================================================ */

:root {
  --admin-bg: #0f172a;
  --admin-sidebar: #1e293b;
  --admin-card: #1e293b;
  --admin-border: rgba(255,255,255,0.08);
  --admin-text: #e2e8f0;
  --admin-muted: #94a3b8;
  --admin-accent: #e94560;
  --admin-gold: #d4af37;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-info: #3b82f6;
  --sidebar-width: 260px;
  --font: 'Inter', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body.admin-body {
  font-family: var(--font);
  background: var(--admin-bg);
  color: var(--admin-text);
  min-height: 100vh;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-layout,
.admin-main,
.admin-content,
.admin-card,
.admin-modal,
.admin-table-wrapper {
  min-width: 0;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--admin-sidebar);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: all 0.3s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--admin-accent), #c73652);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: white;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-text span {
  color: var(--admin-accent);
}

.sidebar-logo .logo-sub {
  font-size: 0.65rem;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.nav-section-title {
  padding: 0.75rem 1.5rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  color: var(--admin-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
  overflow-wrap: break-word;
  word-break: break-word;
}

.sidebar-nav-item:hover {
  color: var(--admin-text);
  background: rgba(255,255,255,0.04);
}

.sidebar-nav-item.active {
  color: var(--admin-accent);
  background: rgba(233, 69, 96, 0.08);
  border-left-color: var(--admin-accent);
}

.sidebar-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--admin-accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  white-space: nowrap;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--admin-border);
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  min-width: 0;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--admin-accent), #c73652);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}

.admin-user-name,
.admin-user-role {
  overflow-wrap: break-word;
  word-break: break-word;
}

.admin-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-text);
}

.admin-user-role {
  font-size: 0.7rem;
  color: var(--admin-muted);
}

.sidebar-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--admin-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.sidebar-logout:hover {
  color: var(--admin-danger);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: var(--admin-sidebar);
  border-bottom: 1px solid var(--admin-border);
  padding: 0 2rem;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1,
.topbar-title p,
.admin-card-title,
.table-book-title,
.table-book-author,
.upload-meta strong,
.upload-status,
.badge,
.btn-admin {
  overflow-wrap: break-word;
  word-break: break-word;
}

.topbar-title h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-text);
}

.topbar-title p {
  font-size: 0.75rem;
  color: var(--admin-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--admin-text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 0 0.75rem;
  min-width: 0;
}

.topbar-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--admin-text);
  font-size: 0.85rem;
  padding: 0.5rem 0;
  width: 200px;
  min-width: 0;
  font-family: var(--font);
}

.topbar-search input::placeholder {
  color: var(--admin-muted);
}

.topbar-search i {
  color: var(--admin-muted);
  font-size: 0.85rem;
}

.admin-content {
  padding: 2rem;
  flex: 1;
  width: 100%;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.red::before { background: var(--admin-accent); }
.stat-card.green::before { background: var(--admin-success); }
.stat-card.gold::before { background: var(--admin-gold); }
.stat-card.blue::before { background: var(--admin-info); }
.stat-card.purple::before { background: #8b5cf6; }
.stat-card.orange::before { background: #f97316; }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-icon.red { background: rgba(233, 69, 96, 0.15); color: var(--admin-accent); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--admin-success); }
.stat-icon.gold { background: rgba(212, 175, 55, 0.15); color: var(--admin-gold); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--admin-info); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.stat-icon.orange { background: rgba(249, 115, 22, 0.15); color: #f97316; }

.stat-trend {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 50px;
  white-space: nowrap;
}

.stat-trend.up {
  background: rgba(16, 185, 129, 0.15);
  color: var(--admin-success);
}

.stat-trend.down {
  background: rgba(239, 68, 68, 0.15);
  color: var(--admin-danger);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--admin-text);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--admin-muted);
}

/* ============================================================
   TABLES
   ============================================================ */
.admin-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.admin-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--admin-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-card-title i {
  color: var(--admin-accent);
  flex-shrink: 0;
}

.admin-card-body {
  padding: 1.5rem;
}

.admin-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--admin-muted);
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--admin-text);
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table td .badge,
.admin-table td .btn-admin,
.admin-table td .btn-icon {
  white-space: nowrap;
}

.table-book-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 220px;
}

.table-book-cover {
  width: 40px;
  height: 55px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.table-book-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--admin-text);
  margin-bottom: 0.2rem;
}

.table-book-author {
  font-size: 0.75rem;
  color: var(--admin-muted);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-danger { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-info { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-muted { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-gold { background: rgba(212,175,55,0.15); color: #d4af37; }
.badge-purple { background: rgba(139,92,246,0.15); color: #8b5cf6; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: var(--font);
  text-decoration: none;
  white-space: nowrap;
  min-width: 0;
}

.btn-admin-primary {
  background: var(--admin-accent);
  color: white;
}

.btn-admin-primary:hover {
  background: #c73652;
}

.btn-admin-success {
  background: var(--admin-success);
  color: white;
}

.btn-admin-success:hover {
  background: #059669;
}

.btn-admin-warning {
  background: var(--admin-warning);
  color: #1a1a2e;
}

.btn-admin-danger {
  background: rgba(239,68,68,0.15);
  color: var(--admin-danger);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-admin-danger:hover {
  background: var(--admin-danger);
  color: white;
}

.btn-admin-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--admin-muted);
  border: 1px solid var(--admin-border);
}

.btn-admin-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: var(--admin-text);
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.btn-icon-edit {
  background: rgba(59,130,246,0.15);
  color: #3b82f6;
}

.btn-icon-edit:hover {
  background: #3b82f6;
  color: white;
}

.btn-icon-delete {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}

.btn-icon-delete:hover {
  background: #ef4444;
  color: white;
}

.btn-icon-view {
  background: rgba(16,185,129,0.15);
  color: #10b981;
}

.btn-icon-view:hover {
  background: #10b981;
  color: white;
}

/* ============================================================
   FORMS
   ============================================================ */
input,
select,
textarea,
button {
  min-width: 0;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.admin-form-group {
  margin-bottom: 1.25rem;
  min-width: 0;
}

.admin-form-group.full-width {
  grid-column: 1 / -1;
}

.admin-form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--admin-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-text);
  font-size: 0.88rem;
  font-family: var(--font);
  outline: none;
  transition: all 0.2s;
}

.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus {
  border-color: var(--admin-accent);
  background: rgba(233, 69, 96, 0.04);
}

.admin-form-group select option {
  background: var(--admin-sidebar);
  color: var(--admin-text);
}

.admin-form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.admin-form-group input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 24px;
  transition: all 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s;
}

input:checked + .toggle-slider {
  background: var(--admin-success);
}

input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.admin-helper-text {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--admin-muted);
  line-height: 1.5;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px dashed rgba(255,255,255,0.16);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  width: 100%;
  min-width: 0;
}

.upload-panel input[type="file"] {
  width: 100%;
  padding: 0.75rem;
  cursor: pointer;
  min-width: 0;
}

.upload-panel input[type="file"]::file-selector-button {
  border: none;
  background: linear-gradient(135deg, var(--admin-accent), #c73652);
  color: white;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 0.75rem;
  font-weight: 600;
}

.upload-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.upload-meta strong {
  font-size: 0.9rem;
  color: var(--admin-text);
}

.upload-status {
  font-size: 0.8rem;
  line-height: 1.45;
}

.upload-status.info { color: var(--admin-muted); }
.upload-status.success { color: var(--admin-success); }
.upload-status.error { color: var(--admin-danger); }
.upload-status.loading { color: var(--admin-warning); }

.admin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.admin-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ============================================================
   MODALS
   ============================================================ */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  padding: 1rem;
}

.admin-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.admin-modal {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  width: min(100%, 700px);
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  transform: scale(0.95);
  transition: transform 0.3s;
}

.admin-modal-overlay.active .admin-modal {
  transform: scale(1);
}

.admin-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--admin-card);
  z-index: 1;
  gap: 1rem;
}

.admin-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--admin-text);
}

.admin-modal-close {
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--admin-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.admin-modal-close:hover {
  background: rgba(239,68,68,0.15);
  color: var(--admin-danger);
}

.admin-modal-body {
  padding: 1.5rem;
  overflow-x: hidden;
}

.admin-modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  padding: 1.25rem;
  border-top: 1px solid var(--admin-border);
  flex-wrap: wrap;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--admin-border);
  color: var(--admin-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.page-btn:hover,
.page-btn.active {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: white;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   CHARTS
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: stretch;
}

.quick-action-btn {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--admin-text);
  text-decoration: none;
  min-width: 0;
}

.quick-action-btn:hover {
  border-color: var(--admin-accent);
  background: rgba(233, 69, 96, 0.05);
  transform: translateY(-2px);
}

.quick-action-btn i {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
  color: var(--admin-accent);
}

.quick-action-btn span {
  font-size: 0.8rem;
  font-weight: 600;
}

/* ============================================================
   LOADING & EMPTY
   ============================================================ */
.admin-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--admin-muted);
  gap: 0.75rem;
}

.admin-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--admin-accent);
  border-radius: 50%;
  animation: adminSpin 0.7s linear infinite;
}

@keyframes adminSpin {
  to { transform: rotate(360deg); }
}

.admin-empty {
  text-align: center;
  padding: 3rem;
  color: var(--admin-muted);
}

.admin-empty i {
  font-size: 2.5rem;
  opacity: 0.3;
  margin-bottom: 0.75rem;
  display: block;
}

/* ============================================================
   TOAST
   ============================================================ */
.admin-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
}

.admin-toast {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--admin-text);
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease;
  font-size: 0.85rem;
  width: 100%;
  max-width: 350px;
}

.admin-toast.success { border-left: 3px solid var(--admin-success); }
.admin-toast.error { border-left: 3px solid var(--admin-danger); }
.admin-toast.warning { border-left: 3px solid var(--admin-warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.admin-login-page {
  min-height: 100vh;
  background: var(--admin-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.admin-login-box {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.admin-login-header {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  padding: 2.5rem 2rem;
  text-align: center;
  border-bottom: 1px solid var(--admin-border);
}

.admin-login-header .logo {
  font-size: 2rem;
  font-weight: 900;
  color: white;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.admin-login-header .logo span {
  color: var(--admin-accent);
}

.admin-login-header .logo i {
  color: var(--admin-gold);
}

.admin-login-header p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

.admin-login-body {
  padding: 2rem;
}

.admin-login-footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--admin-border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--admin-muted);
}

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: #ef4444;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

.login-error.show {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-grid,
  .admin-two-col,
  .admin-mini-grid,
  .upload-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    width: min(82vw, 320px);
    max-width: 320px;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0,0,0,0.35);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    width: 100%;
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .admin-content {
    width: 100%;
    min-width: 0;
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-search {
    display: none;
  }

  .admin-topbar {
    height: auto;
    min-height: 65px;
    padding: 0.85rem 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 60;
  }

  .topbar-title {
    flex: 1 1 200px;
  }

  .topbar-title h1 {
    font-size: 1rem;
  }

  .topbar-title p {
    font-size: 0.72rem;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .topbar-actions .btn-admin {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  .stat-card {
    min-width: 0;
    padding: 1.1rem;
  }

  .stat-value {
    font-size: 1.6rem;
  }

  .admin-card-header {
    padding: 1rem;
  }

  .admin-card-body {
    padding: 1rem;
  }

  .admin-table-wrapper {
    font-size: 0.8rem;
  }

  .quick-actions {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  .admin-modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    border-radius: 12px;
  }

  .admin-modal-header {
    padding: 1rem;
  }

  .admin-modal-body,
  .admin-modal-footer {
    padding: 1rem;
  }

  .admin-modal-footer {
    flex-wrap: wrap;
  }

  .admin-modal-footer .btn-admin {
    flex: 1 1 100%;
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .admin-content {
    padding: 0.85rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-header {
    margin-bottom: 0.75rem;
  }

  .stat-value {
    font-size: 1.45rem;
  }

  .admin-topbar {
    padding: 0.75rem 0.85rem;
  }

  .topbar-title {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions .btn-admin,
  .topbar-actions .btn-icon,
  .btn-admin {
    width: 100%;
    justify-content: center;
  }

  .admin-card-header {
    padding: 0.9rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-card-body {
    padding: 0.9rem;
  }

  .admin-table {
    min-width: 640px;
  }

  .table-book-info {
    min-width: 180px;
  }

  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-action-btn {
    padding: 1rem 0.75rem;
  }

  .admin-login-page {
    padding: 1rem;
  }

  .admin-login-header,
  .admin-login-body,
  .admin-login-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .admin-toast-container {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }

  .admin-toast {
    max-width: 100%;
  }

  .upload-panel input[type="file"]::file-selector-button {
    width: 100%;
    margin: 0 0 0.5rem 0;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .sidebar-logo,
  .sidebar-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .sidebar-nav-item {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .nav-section-title {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .admin-card-title {
    font-size: 0.92rem;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .page-btn {
    width: 32px;
    height: 32px;
  }
}

@media (min-width: 1440px) {
  .admin-content {
    padding: 2rem 2.5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}