/* ===================================================
   OneMiracles Library - Main Stylesheet
   Mobile-First Responsive Design
   =================================================== */

/* CSS Custom Properties */
:root {
  --primary: #6C3FC5;
  --primary-dark: #4A2A9A;
  --primary-light: #9B6FE8;
  --secondary: #F5A623;
  --accent: #00C9A7;
  --danger: #FF4757;
  --warning: #FFA502;
  --info: #2196F3;
  --success: #2ED573;
  --dark: #1A1A2E;
  --dark2: #16213E;
  --dark3: #0F3460;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 64px rgba(0,0,0,0.5);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --nav-height: 64px;
  --bottom-nav-height: 72px;
  --sidebar-width: 280px;
  --font-main: 'Noto Sans Lao', 'Inter', sans-serif;
  --font-display: 'Noto Sans Lao', 'Poppins', sans-serif;
}

/* Light Theme */
[data-theme="light"] {
  --dark: #F0F2F8;
  --dark2: #E4E9F5;
  --dark3: #D0D9EF;
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(0, 0, 0, 0.08);
  --text-primary: #1A1A2E;
  --text-secondary: rgba(26, 26, 46, 0.7);
  --text-muted: rgba(26, 26, 46, 0.4);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.1);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-main);
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 50%, var(--dark3) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ===== LAYOUT ===== */
.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.main-content {
  flex: 1;
  padding: calc(var(--nav-height) + 16px) 16px calc(var(--bottom-nav-height) + 16px);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Desktop sidebar layout */
@media (min-width: 1024px) {
  .app-wrapper { flex-direction: row; }
  .main-content {
    margin-left: var(--sidebar-width);
    padding: 80px 32px 32px;
  }
}

/* ===== GLASS MORPHISM ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition);
}
.glass-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ===== TOP NAVBAR ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.topbar-logo img { width: 36px; height: 36px; border-radius: 8px; }
.topbar-logo span {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--primary); transform: scale(1.05); }
.badge {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px;
  background: var(--danger);
  border-radius: var(--radius-full);
  font-size: 0.6rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: white;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0; left: -100%;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  z-index: 999;
  transition: var(--transition);
  overflow-y: auto;
  padding: var(--nav-height) 0 var(--bottom-nav-height);
}
.sidebar.open { left: 0; }
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  opacity: 0; visibility: hidden;
  transition: var(--transition);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }
.sidebar-nav { padding: 16px 0; }
.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 20px 4px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  border-radius: 0;
  font-size: 0.9rem;
  position: relative;
}
.sidebar-link:hover, .sidebar-link.active {
  color: var(--text-primary);
  background: rgba(108, 63, 197, 0.2);
}
.sidebar-link.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.sidebar-link .icon { font-size: 1.1rem; width: 24px; text-align: center; }
.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .sidebar { left: 0; }
  .sidebar-overlay { display: none !important; }
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 1000;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  min-width: 52px;
  position: relative;
  font-size: 0.65rem;
  font-weight: 500;
}
.bottom-nav-item .icon { font-size: 1.3rem; transition: var(--transition-fast); }
.bottom-nav-item.active { color: var(--primary-light); }
.bottom-nav-item.active .icon { transform: scale(1.15); }
.bottom-nav-item.active::after {
  content: '';
  position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
}
.bottom-nav-item.center-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white !important;
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 20px rgba(108, 63, 197, 0.5);
  padding: 0;
  font-size: 1.5rem;
  margin-bottom: 8px;
}
@media (min-width: 1024px) { .bottom-nav { display: none; } }

/* ===== CARDS & GRID ===== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
@media (min-width: 481px) and (max-width: 768px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

/* Book Card */
.book-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.book-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-md); }
.book-cover {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary), var(--dark3));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-info { padding: 12px; }
.book-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; line-clamp: 2; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { font-size: 0.75rem; color: var(--text-muted); }
.book-badge {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 8px; border-radius: var(--radius-full);
  font-size: 0.65rem; font-weight: 600;
  backdrop-filter: blur(8px);
}
.badge-new { background: var(--accent); color: var(--dark); }
.badge-popular { background: var(--secondary); color: var(--dark); }
.badge-loan { background: var(--danger); color: white; }

/* Stat Card */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; right: -10px; top: -10px;
  width: 80px; height: 80px;
  border-radius: var(--radius-full);
  opacity: 0.1;
}
.stat-card.blue::before { background: var(--info); }
.stat-card.purple::before { background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--secondary); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: rgba(33, 150, 243, 0.2); color: var(--info); }
.stat-icon.purple { background: rgba(108, 63, 197, 0.2); color: var(--primary-light); }
.stat-icon.green { background: rgba(46, 213, 115, 0.2); color: var(--success); }
.stat-icon.orange { background: rgba(245, 166, 35, 0.2); color: var(--secondary); }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.stat-change { font-size: 0.75rem; font-weight: 600; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
  margin-bottom: 20px;
}
.search-input {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  padding: 12px 48px 12px 48px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-main);
  outline: none;
  transition: var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--primary); background: var(--glass-bg); box-shadow: 0 0 0 3px rgba(108,63,197,0.2); }
.search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1rem; pointer-events: none;
}
.search-action {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: var(--primary); border: none; color: white;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition-fast);
}
.search-action:hover { background: var(--primary-light); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none; cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.9rem; font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; box-shadow: 0 4px 16px rgba(108,63,197,0.4); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,63,197,0.5); }
.btn-secondary { background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text-primary); }
.btn-secondary:hover { background: var(--glass-bg); border-color: var(--primary); }
.btn-success { background: linear-gradient(135deg, var(--success), #27ae60); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #c0392b); color: white; }
.btn-warning { background: linear-gradient(135deg, var(--warning), var(--secondary)); color: var(--dark); }
.btn-accent { background: linear-gradient(135deg, var(--accent), #00a085); color: var(--dark); }
.btn-icon { padding: 10px; border-radius: var(--radius-full); width: 40px; height: 40px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn:active { transform: scale(0.97) !important; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-control {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-main);
  outline: none;
  transition: var(--transition);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,63,197,0.2); background: var(--glass-bg); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
.form-select { position: relative; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }
.form-control.error { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; border-radius: var(--radius-md); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: rgba(108, 63, 197, 0.15);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--card-border); font-size: 0.85rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(108, 63, 197, 0.05); }

/* ===== BADGES / CHIPS ===== */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 600;
}
.chip-primary { background: rgba(108,63,197,0.2); color: var(--primary-light); }
.chip-success { background: rgba(46,213,115,0.2); color: var(--success); }
.chip-danger { background: rgba(255,71,87,0.2); color: var(--danger); }
.chip-warning { background: rgba(255,165,2,0.2); color: var(--warning); }
.chip-info { background: rgba(33,150,243,0.2); color: var(--info); }
.chip-muted { background: rgba(255,255,255,0.1); color: var(--text-muted); }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.5rem; font-weight: 700; font-family: var(--font-display); }
.page-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ===== SECTION HEADER ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 1rem; font-weight: 700; }
.section-link { font-size: 0.8rem; color: var(--primary-light); text-decoration: none; font-weight: 500; }
.section-link:hover { color: var(--accent); }

/* ===== HORIZONTAL SCROLL ===== */
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex-shrink: 0; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; background: var(--card-bg); border-radius: var(--radius-md); padding: 4px; margin-bottom: 20px; overflow-x: auto; }
.tab-btn {
  flex: 1; min-width: max-content;
  padding: 8px 16px;
  border: none; background: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: var(--transition-fast);
  white-space: nowrap;
}
.tab-btn.active { background: var(--primary); color: white; box-shadow: var(--shadow-sm); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--dark2);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
  padding: 0 0 32px;
  transform: translateY(100%);
  transition: var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-handle { width: 40px; height: 4px; background: var(--card-border); border-radius: 2px; margin: 12px auto; }
.modal-header { padding: 0 20px 16px; border-bottom: 1px solid var(--card-border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer { padding: 0 20px; display: flex; gap: 12px; }
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius-xl); transform: scale(0.9) translateY(20px); }
  .modal-overlay.active .modal { transform: scale(1) translateY(0); }
}

/* ===== TOAST ===== */
.toast-container { position: fixed; top: calc(var(--nav-height) + 8px); right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--dark2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 280px; max-width: 380px;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease forwards;
}
.toast.hide { animation: slideOutRight 0.3s ease forwards; }
.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-text { flex: 1; font-size: 0.85rem; }
.toast-close { cursor: pointer; color: var(--text-muted); font-size: 1rem; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

/* ===== PROGRESS / RATING ===== */
.progress-bar { height: 6px; background: var(--card-bg); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); transition: width 1s ease; }
.rating { display: flex; gap: 2px; }
.rating .star { color: var(--secondary); font-size: 0.9rem; }

/* ===== AVATAR ===== */
.avatar {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: white;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }

/* ===== ROLE COLORS ===== */
.role-superadmin { color: #FFD700; }
.role-admin { color: var(--primary-light); }
.role-office { color: var(--info); }
.role-staff { color: var(--accent); }
.role-member { color: var(--text-secondary); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-8px); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 20px rgba(108,63,197,0.4); } 50% { box-shadow: 0 0 40px rgba(108,63,197,0.8); } }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes countUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes waveEffect { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.5); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
.animate-slideUp { animation: slideUp 0.5s ease forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-bounce { animation: bounce 1s ease-in-out infinite; }

/* Stagger delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--card-bg) 25%, var(--glass-bg) 50%, var(--card-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ===== RIPPLE EFFECT ===== */
.ripple-container { position: relative; overflow: hidden; }
.ripple-effect {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0); animation: ripple 0.6s linear;
  pointer-events: none;
}

/* ===== SCROLLABLE FILTER PILLS ===== */
.filter-pills { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; margin-bottom: 16px; }
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--card-bg); color: var(--text-secondary);
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: var(--transition-fast);
  flex-shrink: 0;
}
.filter-pill.active { background: var(--primary); border-color: var(--primary); color: white; }
.filter-pill:hover:not(.active) { border-color: var(--primary-light); color: var(--primary-light); }

/* ===== LIST ITEM ===== */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
}
.list-item:hover { background: var(--glass-bg); border-color: var(--primary); }
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.5; display: block; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text { font-size: 0.85rem; }

/* ===== LOADING SPINNER ===== */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--dark);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 20px;
}

/* ===== NOTIFICATION DOT ===== */
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); display: inline-block;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--card-border); margin: 16px 0; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 0.8rem; margin: 16px 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--card-border); }

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.text-lg { font-size: 1.1rem; }
.text-xl { font-size: 1.3rem; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.p-2 { padding: 8px; } .p-3 { padding: 12px; } .p-4 { padding: 16px; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.justify-center { justify-content: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; } .w-full { width: 100%; }
.hidden { display: none !important; }
.block { display: block !important; }
.rounded-full { border-radius: var(--radius-full); }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; } .absolute { position: absolute; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; -webkit-user-select: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== AI CHAT BUBBLE ===== */
.ai-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(0,201,167,0.2), rgba(108,63,197,0.2));
  border: 1px solid rgba(0,201,167,0.3);
  font-size: 0.75rem; font-weight: 600; color: var(--accent);
  animation: glow 2s ease-in-out infinite;
}
.ai-typing { display: flex; align-items: center; gap: 4px; }
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); display: block;
  animation: waveEffect 1.2s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

/* ===== AR VIEWER ===== */
.ar-container {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #000510, #0a0a2e);
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid rgba(0,201,167,0.3);
}
.ar-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
}
.ar-corner {
  position: absolute; width: 20px; height: 20px;
  border-color: var(--accent); border-style: solid;
}
.ar-corner.tl { top: 10px; left: 10px; border-width: 2px 0 0 2px; }
.ar-corner.tr { top: 10px; right: 10px; border-width: 2px 2px 0 0; }
.ar-corner.bl { bottom: 10px; left: 10px; border-width: 0 0 2px 2px; }
.ar-corner.br { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; }
.ar-scan-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: arScan 2s ease-in-out infinite;
}
@keyframes arScan { 0% { top: 10%; } 100% { top: 90%; } }

/* ===== GRADIENT BACKGROUNDS ===== */
.bg-gradient-1 { background: linear-gradient(135deg, var(--primary), var(--dark3)); }
.bg-gradient-2 { background: linear-gradient(135deg, var(--accent), var(--dark3)); }
.bg-gradient-3 { background: linear-gradient(135deg, var(--secondary), var(--danger)); }
.hero-gradient {
  background: linear-gradient(-45deg, var(--dark), var(--dark3), var(--primary-dark), var(--dark2));
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 360px) {
  :root { --nav-height: 56px; --bottom-nav-height: 64px; }
  .page-title { font-size: 1.2rem; }
  .stat-value { font-size: 1.4rem; }
}
@media (min-width: 768px) {
  .main-content { padding-top: calc(var(--nav-height) + 24px); padding-left: 24px; padding-right: 24px; }
}
