/* ==========================================================
   CSS DESIGN SYSTEM: DARK ACADEMIA & GLASSMORPHISM
   ========================================================== */

/* Font & Global Variables */
:root {
  /* Fonts */
  --font-ui: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-scholarly: "Lora", Georgia, Cambria, "Times New Roman", serif;

  /* HSL Color Tokens (Light Mode - Warm Parchment & Prussian Blue) */
  --hue-accent: 30; /* Cognac / Antique Copper */
  --hue-primary: 210; /* Deep Prussian Blue */

  --bg-primary: #FAF9F6; /* Warm Ivory Parchment */
  --bg-secondary: #F4F2EB; /* Soft Linen */
  --bg-card: rgba(255, 255, 255, 0.75);
  
  --text-primary: #1A2E40; /* Dark Prussian Blue */
  --text-secondary: #4A5D6E;
  --text-muted: #7E90A2;
  
  --accent: hsl(var(--hue-accent), 45%, 43%);
  --accent-hover: hsl(var(--hue-accent), 50%, 33%);
  --accent-light: hsl(var(--hue-accent), 40%, 93%);
  
  --success: #2E6A4F;
  --success-light: #EBF5F0;
  --warning: #B37D14;
  --warning-light: #FDF7EB;
  --danger: #A83232;
  --danger-light: #FDF2F2;

  --border-color: rgba(26, 46, 64, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: rgba(26, 46, 64, 0.05);

  --shadow-sm: 0 2px 8px var(--glass-shadow);
  --shadow-lg: 0 10px 30px rgba(26, 46, 64, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dark Mode Overrides (Mystic Slate & Antiqued Gold) */
body.dark-mode {
  --bg-primary: #12151C; /* Ink Black */
  --bg-secondary: #181C26; /* Dark Slate */
  --bg-card: rgba(24, 28, 38, 0.75);
  
  --text-primary: #E2E6EE; /* Silver Grey */
  --text-secondary: #A0ABB8;
  --text-muted: #647385;
  
  --accent: #D4AF37; /* Antiqued Gold */
  --accent-hover: #F3E5AB;
  --accent-light: rgba(212, 175, 55, 0.1);
  
  --success: #52B788;
  --success-light: rgba(82, 183, 136, 0.1);
  --warning: #F4A261;
  --warning-light: rgba(244, 162, 97, 0.1);
  --danger: #E63946;
  --danger-light: rgba(230, 57, 70, 0.1);

  --border-color: rgba(226, 230, 238, 0.08);
  --glass-bg: rgba(18, 21, 28, 0.45);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: rgba(0, 0, 0, 0.3);

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* ==========================================================
   RESET & FOUNDATIONS
   ========================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.5s ease, color 0.3s ease;
}

/* Background animated glow orbs */
.bg-orbs {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  transition: var(--transition-smooth);
}

body.dark-mode .orb {
  opacity: 0.08;
}

.orb-1 {
  width: 45vw;
  height: 45vw;
  background: var(--accent);
  top: -10vw;
  right: -10vw;
  animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-2 {
  width: 55vw;
  height: 55vw;
  background: var(--text-primary);
  bottom: -15vw;
  left: -15vw;
  animation: floatOrb 25s infinite alternate-reverse ease-in-out;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5vw, 5vw) scale(1.1); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ==========================================================
   TYPOGRAPHY & ACCENTS
   ========================================================== */
h1, h2, h3, h4 {
  font-family: var(--font-scholarly);
  font-weight: 700;
  line-height: 1.25;
}

h2 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

p {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition-smooth);
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

code {
  font-family: Consolas, Monaco, monospace;
  background: var(--bg-secondary);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9rem;
}

code.block {
  display: block;
  padding: 12px;
  margin: 12px 0;
  overflow-x: auto;
  border-left: 3px solid var(--accent);
}

/* Badge */
.badge {
  font-family: var(--font-ui);
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 30px;
  background: var(--accent-light);
  color: var(--accent);
  margin-left: 8px;
  vertical-align: middle;
}

/* Alert System */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.alert-info {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--border-color);
}

.alert-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(168, 50, 50, 0.2);
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(46, 106, 79, 0.2);
}

.hidden {
  display: none !important;
}

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background-color: var(--accent);
  color: #FFF;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(154, 107, 67, 0.2);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn-outline:hover {
  background-color: var(--accent-light);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.icon-btn:hover {
  background: var(--border-color);
  transform: scale(1.05);
}

/* ==========================================================
   LOADER & GLOBAL SPINNER
   ========================================================== */
.loader-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================
   AUTH CARD & CONTAINER
   ========================================================== */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  text-align: center;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header {
  margin-bottom: 30px;
}

.logo-text {
  font-family: var(--font-scholarly);
  font-size: 2.5rem;
  letter-spacing: -0.5px;
}

.logo-sub {
  font-family: var(--font-ui);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 2px;
  margin-top: 4px;
  color: var(--text-muted);
}

/* Forms & Inputs */
.input-group {
  text-align: left;
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.input-group input,
.input-group textarea,
.select-box select,
.filter-bar input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.input-group input:focus,
.input-group textarea:focus,
.select-box select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.auth-footer {
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ==========================================================
   APP HEADER & LAYOUT
   ========================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-header {
  height: 72px;
  padding: 0 32px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-left .logo-icon {
  font-size: 1.8rem;
}
.header-left .logo-text {
  font-size: 1.6rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 12px;
  border-right: 1px solid var(--border-color);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFF;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  flex-direction: column;
}
.user-info .username {
  font-weight: 600;
  font-size: 0.9rem;
}
.user-info .role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================
   APP LAYOUT: SIDEBAR + MAIN CONTENT
   ========================================================== */
.app-layout {
  display: flex;
  flex: 1;
}

.sidebar {
  width: 260px;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  transition: var(--transition-smooth);
}
.nav-item:hover {
  background: var(--border-color);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.sidebar-stats {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.sidebar-stats h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.stat-row:last-child {
  margin-bottom: 0;
}
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* MAIN PANES */
.main-content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease;
}
.tab-pane.active {
  display: block;
}

.content-header {
  margin-bottom: 32px;
}
.content-header h2 {
  margin-bottom: 4px;
}
.content-header p {
  font-size: 1.05rem;
}

/* ==========================================================
   TAB 1: CATALOG VIEW - SEARCH & TABLE
   ========================================================== */
.filter-bar {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  max-width: 800px;
}

.search-box {
  flex: 1;
  position: relative;
}
.search-box .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-box input {
  padding-left: 44px;
}

.select-box select {
  width: 200px;
  cursor: pointer;
}

/* Catalog Table Design */
.books-container {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.books-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.books-table th {
  background: var(--bg-secondary);
  padding: 16px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.books-table th.sortable {
  cursor: pointer;
  position: relative;
  user-select: none;
  padding-right: 28px;
  transition: var(--transition-smooth);
}

.books-table th.sortable:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.books-table th.sortable::after {
  content: '↕';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.4;
  transition: var(--transition-smooth);
}

.books-table th.sortable.asc::after {
  content: '↑';
  color: var(--accent);
  opacity: 1;
}

.books-table th.sortable.desc::after {
  content: '↓';
  color: var(--accent);
  opacity: 1;
}

.books-table td {
  padding: 18px 20px;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  transition: var(--transition-smooth);
}

.books-table tr:last-child td {
  border-bottom: none;
}

.books-table tr {
  cursor: pointer;
  transition: var(--transition-smooth);
}

.books-table tr:hover td {
  background: var(--bg-secondary);
}

.book-title-cell {
  font-family: var(--font-scholarly);
  font-weight: 700;
  font-size: 1.05rem;
}

.table-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
}

.badge-available {
  background: var(--success-light);
  color: var(--success);
}
.badge-borrowed {
  background: var(--warning-light);
  color: var(--warning);
}

/* Pagination */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid var(--border-color);
}

.page-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.page-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}
.page-btn.active {
  background: var(--accent);
  color: #FFF;
  border-color: var(--accent);
}

/* ==========================================================
   TAB 2: DASHBOARD VIEW
   ========================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
}

.card {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-color);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 12px;
}

.my-borrows-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.borrow-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.borrow-item-info h4 {
  font-family: var(--font-scholarly);
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.borrow-item-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.guide-content ol {
  padding-left: 20px;
  margin-bottom: 20px;
}
.guide-content li {
  font-size: 0.95rem;
  margin-bottom: 12px;
  line-height: 1.6;
}

.mattermost-tip {
  margin-top: 24px;
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent);
}
.mattermost-tip h4 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.mattermost-tip code {
  display: block;
  margin-top: 6px;
}

/* ==========================================================
   TAB 3: NOTES WALL VIEW (Shared Notes Feed)
   ========================================================== */
.notes-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  align-items: start;
}

.note-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: var(--transition-smooth);
}
.note-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.note-card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
}

.note-card-body {
  font-family: var(--font-scholarly);
  font-size: 1.05rem;
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 16px;
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.note-author {
  font-weight: 600;
  font-size: 0.85rem;
}

.note-book-link {
  font-size: 0.8rem;
  font-weight: 700;
}

/* ==========================================================
   TAB 4: ADMIN PANELS
   ========================================================== */
.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
}

/* ==========================================================
   BOOK DETAIL SLIDE PANEL (DRAWER)
   ========================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  transition: opacity 0.3s ease;
}

.drawer {
  width: 100%;
  max-width: 560px;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  height: 100vh;
  box-shadow: -10px 0 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  padding: 40px;
  overflow-y: auto;
  animation: slideLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideLeft {
  0% { transform: translateX(100%); }
  100% { transform: translateX(0); }
}

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

.drawer-category {
  font-family: var(--font-ui);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 600;
}

#drawer-title {
  font-size: 2rem;
  margin-bottom: 8px;
}

.drawer-author {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.drawer-metadata {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}
.meta-label {
  color: var(--text-muted);
  font-weight: 500;
}
.meta-val {
  font-weight: 600;
}

.drawer-edit-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  margin: 4px 0;
  transition: var(--transition-smooth);
}

.drawer-edit-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

#edit-drawer-title {
  font-family: var(--font-scholarly);
  font-size: 1.6rem;
  font-weight: 700;
  border-color: var(--accent);
}

#edit-drawer-author {
  font-size: 1rem;
  border-color: var(--accent);
}

#edit-drawer-category {
  font-size: 0.75rem;
  border-radius: 4px;
  padding: 4px 8px;
  width: auto;
  min-width: 120px;
  display: inline-block;
  font-weight: 600;
  text-transform: uppercase;
  border-color: var(--accent);
}

.drawer-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.drawer-actions .btn {
  flex: 1;
}

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

/* Notes in Drawer */
.drawer-notes-section h3 {
  margin-bottom: 20px;
}

#add-note-form textarea {
  width: 100%;
  height: 100px;
  resize: vertical;
  margin-bottom: 12px;
}

.note-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.checkbox-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.notes-tip {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.drawer-notes-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.drawer-note-item {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.drawer-note-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drawer-note-content {
  font-family: var(--font-scholarly);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ==========================================================
   TOAST SYSTEM
   ========================================================== */
.toast-container {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease, fadeOut 0.3s 2.7s ease;
  min-width: 200px;
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}
.toast.toast-error {
  border-left: 4px solid var(--danger);
}

@keyframes slideIn {
  0% { transform: translateX(-100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ==========================================================
   RESPONSIVE DESIGN
   ========================================================== */
@media (max-width: 1024px) {
  .dashboard-grid, .admin-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 80px;
    padding: 24px 8px;
  }
  .nav-label, .sidebar-stats {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
}

@media (max-width: 768px) {
  .main-header {
    padding: 0 16px;
  }
  .main-content {
    padding: 20px;
  }
  .filter-bar {
    flex-direction: column;
  }
  .select-box select {
    width: 100%;
  }
  .drawer {
    padding: 20px;
  }
}

/* ==========================================================
   ANIMATIONS
   ========================================================== */
@keyframes fadeInUp {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ==========================================================
   PHASE 8: USER REGISTRATION & USER MANAGEMENT STYLES
   ========================================================== */

/* Sub-navigation inside Admin Panel */
.admin-subnav {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.subnav-btn {
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.subnav-btn::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.subnav-btn:hover {
  color: var(--text-primary);
  background: var(--accent-light);
}

.subnav-btn.active {
  color: var(--accent);
}

.subnav-btn.active::after {
  transform: scaleX(1);
}

/* User management specific card and table */
.admin-users-card {
  padding: 32px;
  margin-top: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  animation: fadeIn 0.4s ease;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  text-align: left;
}

.users-table th {
  padding: 14px 18px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.users-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-ui);
}

.users-table tr:hover {
  background: var(--accent-light);
}

/* Badge for user roles */
.role-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.role-admin {
  background: rgba(212, 163, 89, 0.15); /* Warm academic gold */
  color: #d4a359;
  border: 1px solid rgba(212, 163, 89, 0.3);
}

.role-badge.role-member {
  background: rgba(74, 144, 226, 0.15); /* Muted intelligence blue */
  color: #4a90e2;
  border: 1px solid rgba(74, 144, 226, 0.3);
}

/* Table action buttons */
.users-table .actions-cell {
  display: flex;
  gap: 8px;
}

.btn-danger-outline {
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.btn-danger-outline:hover {
  background: var(--danger) !important;
  color: white !important;
  border-color: var(--danger) !important;
}

/* Auth view transitions */
#login-form, #register-form {
  animation: fadeIn 0.4s ease;
}
