/* --------------------------------- */
/*  RESET                          */
/* --------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --------------------------------- */
/*  DESIGN TOKENS                  */
/* --------------------------------- */
:root {
  /* Brand Palette */
  --clr-bg-body:       #f8fafc;
  --clr-bg-sidebar:    #0f172a;
  --clr-bg-content:    #ffffff;
  --clr-bg-input:      #f1f5f9;
  --clr-bg-card:       #ffffff;

  /* Modern Card Styling (Books Looper) */
  --card-bg:           #ffffff;
  --secondary-bg:      #f8fafc;
  --border-color:      #e2e8f0;
  --text-primary:      #1e293b;
  --accent-color:      #3b82f6;

  /* Accent Colors */
  --clr-accent:        #3b82f6;
  --clr-accent-hover:  #2563eb;
  --clr-accent-light:  #60a5fa;
  --clr-accent-dark:   #1d4ed8;

  /* Success/Warning/Error */
  --clr-success:       #10b981;
  --clr-warning:       #f59e0b;
  --clr-error:         #ef4444;
  --clr-info:          #06b6d4;

  /* Text Colors */
  --clr-text-main:     #1e293b;
  --clr-text-light:    #e2e8f0;
  --clr-text-muted:    #64748b;
  --clr-text-heading:  #0f172a;

  /* Borders & Shadows */
  --clr-border:        #e2e8f0;
  --clr-border-light:  #f1f5f9;
  --shadow-xs:         0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm:         0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md:         0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:         0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl:         0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-focus:      0 0 0 3px rgba(59, 130, 246, 0.25);

  /* Gradients */
  --gradient-primary:  linear-gradient(135deg, var(--clr-accent) 0%, var(--clr-accent-light) 100%);
  --gradient-sidebar:  linear-gradient(180deg, #0f172a 0%, #1e293b 100%);

  /* Radii & Durations */
  --radius-xs:         2px;
  --radius-sm:         4px;
  --radius-md:         8px;
  --radius-lg:         12px;
  --radius-xl:         16px;
  --radius-2xl:        20px;
  --duration-fast:     0.15s;
  --duration:          0.3s;
  --duration-slow:     0.5s;

  /* Z-index scale */
  --z-dropdown:        1000;
  --z-sticky:          1020;
  --z-fixed:           1030;
  --z-modal:           1040;
  --z-popover:         1050;
  --z-tooltip:         1060;
}

/* --------------------------------- */
/*  GLOBAL                         */
/* --------------------------------- */
html, body {
  height: 100%;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--clr-text-main);
  background: var(--clr-bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------- */
/*  LAYOUT                         */
/* --------------------------------- */
.layout {
  display: flex;
  min-height: 100vh;
}

.content {
  flex: 1;
  padding: 0.5rem;
  overflow-x: hidden;
  max-width: calc(100vw - 200px);
}

/* Index page 2-column layout - More landscape oriented */
.index-layout {
  display: grid;
  grid-template-columns: 35% 65%; /* Better balance between columns */
  gap: 1rem;
  height: calc(100vh - 80px); /* Use more vertical space with less header */
  overflow: hidden;
}

.prompt-column {
  overflow-y: auto;
  padding-right: 0.5rem;
}

.responses-column {
  overflow-y: auto;
  padding-left: 0.5rem;
}

/* --------------------------------- */
/*  SIDEBAR                        */
/* --------------------------------- */
.sidebar {
  width: 200px; /* Reduced sidebar width for more content space */
  flex-shrink: 0;
  background: var(--gradient-sidebar);
  border-right: 1px solid var(--clr-border);
  transition: all var(--duration) ease;
  overflow: hidden;
  position: relative;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

/* header inside sidebar for toggle + title */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all var(--duration) ease;
}

/* the “☰” button */
.sidebar-toggle {
  background: var(--clr-accent);
  border: none;
  color: #fff;
  font-size: 0.9rem; /* Smaller font */
  width: 2rem; /* Smaller button */
  height: 2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--duration);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--clr-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.sidebar-toggle:active {
  transform: translateY(0);
}

.sidebar-toggle:focus {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Toggle button icon animation */
body.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-toggle:hover {
  transform: rotate(180deg) translateY(-1px);
}

/* branding section */
.sidebar-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all var(--duration) ease;
  overflow: hidden;
}
.sidebar-icon {
  font-size: 1.75rem;
  color: var(--clr-accent-light);
  animation: pulse 3s infinite;
  flex-shrink: 0;
}

/* the "VAIS" title */
.sidebar-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  transition: all var(--duration) ease;
  white-space: nowrap;
}

/* nav links */
.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem;
}
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--clr-text-light);
  text-decoration: none;
  transition: all var(--duration);
  overflow: hidden;
}
.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--clr-accent);
  transform: scaleY(0);
  transition: transform var(--duration);
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(2px);
}
.nav-link:hover::before {
  transform: scaleY(1);
}
.nav-link.active {
  background: var(--clr-accent);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.nav-link.active::before {
  transform: scaleY(1);
  background: rgba(255, 255, 255, 0.3);
}

/* optional: show icons only when collapsed */
/* .nav-link::before {
  content: attr(data-icon);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  opacity: 0;
  transition: opacity var(--duration);
}
body.sidebar-collapsed .nav-link::before {
  opacity: 1;
}
body.sidebar-collapsed .nav-link {
  text-indent: -9999px;
  white-space: nowrap;
  overflow: hidden;
} */

/* Sidebar Sections */
.sidebar-section {
  margin: 0.5rem 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  position: relative;
}

.section-header h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-badge {
  background: var(--clr-accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-xs);
  min-width: 1.2rem;
  text-align: center;
}

.section-description {
  color: var(--clr-text-light);
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
  line-height: 1.3;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-indicator.online {
  background: var(--clr-success);
}

.status-text {
  color: var(--clr-text-light);
  font-size: 0.7rem;
}

/* --------------------------------- */
/*  LOADING SCREEN                 */
/* --------------------------------- */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 1;
  transition: opacity var(--duration-slow) ease;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.loading-logo i {
  font-size: 3rem;
  animation: pulse 2s infinite;
}

.loading-logo h2 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* --------------------------------- */
/*  DASHBOARD HEADER               */
/* --------------------------------- */
.dashboard-header {
  background: linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--clr-border);
  position: relative;
  overflow: hidden;
}

.dashboard-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.page-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--clr-text-heading);
  letter-spacing: -0.025em;
}

.page-title i {
  font-size: 1.25rem;
  color: var(--clr-accent);
  animation: pulse 3s infinite;
}

.page-subtitle {
  color: var(--clr-text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  max-width: 600px;
}

.header-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.8);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border-light);
  box-shadow: var(--shadow-xs);
  min-width: 100px;
  transition: all var(--duration);
}

.stat-card:hover {
  background: white;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.stat-icon.books {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.stat-icon.models {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.stat-icon.queries {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.stat-number {
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-text-heading);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  line-height: 1;
}

/* --------------------------------- */
/*  RESPONSES SECTION              */
/* --------------------------------- */
.responses-section {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.responses-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  background: var(--secondary-bg, linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%));
  border: 1px solid var(--border-color, var(--clr-border));
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.responses-section .section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--clr-text-heading);
  margin: 0;
  flex: 1;
  justify-content: center;
}

.responses-section .section-title i {
  color: var(--accent-color, var(--clr-accent));
  font-size: 1.125rem;
}

.section-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-content);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration);
  color: var(--clr-text-muted);
  font-size: 0.8rem;
}

.icon-btn:hover {
  background: var(--accent-color, var(--clr-accent));
  color: white;
  border-color: var(--accent-color, var(--clr-accent));
  transform: translateY(-1px);
}

/* --------------------------------- */
/*  RESPONSES GRID                 */
/* --------------------------------- */
.responses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--card-bg, var(--clr-bg-content));
  border: 1px solid var(--border-color, var(--clr-border));
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
}

.responses-grid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary, linear-gradient(90deg, var(--clr-accent) 0%, var(--clr-accent-light, #60a5fa) 100%));
  border-radius: 12px 12px 0 0;
}

/* Responsive grid columns */
@media (max-width: 767px) {
  .responses-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .responses-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) and (max-width: 1439px) {
  .responses-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1440px) and (max-width: 1799px) {
  .responses-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1800px) {
  .responses-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.response {
  background: var(--card-bg, var(--clr-bg-content));
  border: 1px solid var(--border-color, var(--clr-border));
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
  height: fit-content;
  min-height: 150px;
  font-size: 0.9rem;
  margin: 0.5rem;
  position: relative;
  resize: both;
  min-width: 260px;
  width: 100%;
}

.response:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
  border-color: var(--accent-color, var(--clr-accent));
}

.response.dragging {
  transform: rotate(2deg) scale(1.02);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0.9;
}

.response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color, var(--clr-border));
  background: var(--secondary-bg, linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%));
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, var(--clr-text-heading));
  cursor: grab;
  user-select: none;
  position: relative;
}

.response-header:active {
  cursor: grabbing;
}

.response-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-color, var(--clr-accent));
  opacity: 0.7;
}

.response-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.response-header-info i {
  color: var(--accent-color, var(--clr-accent));
  font-size: 1.1rem;
}

.response-title {
  font-weight: 600;
  color: var(--text-primary, var(--clr-text-heading));
  font-size: 0.95rem;
}

.response-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity var(--duration);
}

.response:hover .response-actions {
  opacity: 1;
}

.response-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-content);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration);
  color: var(--clr-text-muted);
  font-size: 0.85rem;
}

.response-btn:hover {
  background: var(--accent-color, var(--clr-accent));
  color: white;
  border-color: var(--accent-color, var(--clr-accent));
  transform: scale(1.1);
}

.response-collapse-btn {
  width: 32px;
  height: 32px;
  border: 2px solid var(--clr-border);
  background: var(--clr-bg-content);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration);
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  box-shadow: var(--shadow-xs);
}

.response-collapse-btn:hover {
  background: var(--accent-color, var(--clr-accent));
  color: white;
  border-color: var(--accent-color, var(--clr-accent));
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.response-collapse-btn i {
  transition: transform var(--duration) ease;
  font-weight: bold;
}

.response-header.collapsed .response-collapse-btn i {
  transform: rotate(180deg);
}

.drag-handle {
  color: var(--clr-text-muted);
  cursor: grab;
  transition: color var(--duration);
  font-size: 1rem;
  margin-right: 0.5rem;
}

.drag-handle:hover {
  color: var(--accent-color, var(--clr-accent));
}

.drag-handle:active {
  cursor: grabbing;
}

.response-content {
  padding: 1.5rem;
  max-height: none;
  overflow: visible;
  transition: all var(--duration, 0.3s ease);
  opacity: 1;
}

.response-content.collapsed {
  max-height: 0;
  padding: 0 1.5rem;
  opacity: 0;
  overflow: hidden;
}

.response-text {
  display: block;
  background: var(--secondary-bg, var(--clr-bg-input));
  border: 1px solid var(--border-color, var(--clr-border));
  border-left: 4px solid var(--accent-color, var(--clr-accent));
  border-radius: 8px;
  padding: 1.25rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
  margin: 0;
  color: var(--text-primary, var(--clr-text-main));
  transition: all var(--duration, 0.3s ease);
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.response-text::-webkit-scrollbar {
  width: 8px;
}

.response-text::-webkit-scrollbar-track {
  background: var(--clr-bg-input);
  border-radius: var(--radius-sm);
}

.response-text::-webkit-scrollbar-thumb {
  background: var(--clr-border);
  border-radius: var(--radius-sm);
  transition: background var(--duration) ease;
}

.response-text::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color, var(--clr-accent));
}

.response-text:empty::before {
  content: "Waiting for response...";
  color: var(--clr-text-muted);
  font-style: italic;
}

.response-text.loading {
  background: linear-gradient(90deg, var(--clr-bg-input) 25%, #f0f0f0 50%, var(--clr-bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Drag and drop states */
.responses-grid.drag-over {
  background-color: rgba(59, 130, 246, 0.05);
  border-radius: var(--radius-lg);
}

.response.drag-placeholder {
  opacity: 0.5;
  border: 2px dashed var(--clr-accent);
  background: rgba(59, 130, 246, 0.05);
}

/* --------------------------------- */
/*  RESPONSIVE LAYOUT              */
/* --------------------------------- */
@media (max-width: 1200px) {
  .index-layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    height: auto;
  }
  
  .prompt-column,
  .responses-column {
    padding: 0;
  }
  
  .responses-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 180px;
  }
  
  .content {
    padding: 0.5rem;
    max-width: calc(100vw - 180px);
  }
  
  .index-layout {
    gap: 0.5rem;
  }
  
  .responses-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .response {
    min-height: 130px;
  }
  
  .response-content {
    padding: 0.6rem;
  }
  
  .response-text {
    padding: 0.5rem;
    min-height: 60px;
    font-size: 0.75rem;
  }
  
  .dashboard-header {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .page-title {
    font-size: 1.25rem;
  }
  
  .page-title i {
    font-size: 1.125rem;
  }
}

/* Sidebar collapse adjustments */
/* Default expanded state - ensure smooth transitions */
.sidebar {
  transition: width var(--duration) ease;
}

.sidebar-branding {
  opacity: 1;
  transform: translateX(0);
  transition: all var(--duration) ease;
}

.sidebar-title {
  opacity: 1;
  transition: opacity var(--duration) ease;
}

.nav-text {
  opacity: 1;
  transform: translateX(0);
  transition: all var(--duration) ease;
}

.sidebar-section {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  transition: all var(--duration) ease;
}

.sidebar-header {
  transition: all var(--duration) ease;
}

.sidebar-footer {
  transition: all var(--duration) ease;
}

.status-text {
  opacity: 1;
  transition: opacity var(--duration) ease;
}

.content {
  transition: max-width var(--duration) ease;
}

.index-layout {
  transition: grid-template-columns var(--duration) ease;
}

/* Collapsed state overrides */
body.sidebar-collapsed .sidebar {
  width: 60px;
}

body.sidebar-collapsed .sidebar-branding {
  opacity: 0;
  transform: translateX(-20px);
}

body.sidebar-collapsed .sidebar-title {
  opacity: 0;
}

body.sidebar-collapsed .nav-text {
  opacity: 0;
  transform: translateX(-10px);
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0.75rem;
}

body.sidebar-collapsed .nav-link:hover {
  transform: none;
}

body.sidebar-collapsed .sidebar-section {
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
}

body.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 1.5rem 0.5rem;
}

body.sidebar-collapsed .sidebar-footer {
  justify-content: center;
}

body.sidebar-collapsed .status-text {
  opacity: 0;
}

body.sidebar-collapsed .content {
  max-width: calc(100vw - 60px);
}

body.sidebar-collapsed .index-layout {
  grid-template-columns: 35% 65%;
}

@media (max-width: 1200px) {
  body.sidebar-collapsed .index-layout {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------- */
/*  PROMPT AREA                    */
/* --------------------------------- */
.prompt-area {
  background: var(--clr-bg-content);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--clr-border);
  position: relative;
  overflow: hidden;
  height: fit-content;
}

.prompt-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

.prompt-area .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.prompt-area .section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--clr-text-heading);
  margin: 0;
}

.prompt-area .section-title i {
  color: var(--clr-accent);
  font-size: 1.1rem;
}

.prompt-input-container {
  position: relative;
  margin-bottom: 1rem;
}

#promptInput {
  width: 100%;
  min-height: 100px;
  padding: 0.75rem;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  resize: vertical;
  background: var(--clr-bg-content);
  font-size: 0.9rem;
  line-height: 1.5;
  transition: all var(--duration);
  font-family: inherit;
  margin-bottom: 0.5rem;
}

#promptInput:focus {
  outline: none;
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-focus);
  background: white;
}

#promptInput::placeholder {
  color: var(--clr-text-muted);
  font-style: italic;
}

.prompt-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.prompt-stats {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
}

.prompt-buttons {
  display: flex;
  gap: 0.5rem;
}

.main-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--clr-accent) 0%, var(--clr-accent-light) 100%);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.primary-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-sm);
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  background: var(--clr-bg-content);
  color: var(--clr-text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration);
}

.secondary-btn:hover {
  border-color: var(--clr-accent);
  color: var(--clr-accent);
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-1px);
}

.loader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--clr-text-muted);
  font-size: 0.9rem;
}

.loader-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--clr-border);
  border-top: 2px solid var(--clr-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* --------------------------------- */
/*  MODEL OPTIONS IN SIDEBAR       */
/* --------------------------------- */
.model-group {
  margin-bottom: 1rem;
}

.model-group:last-child {
  margin-bottom: 0;
}

.model-group h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.model-group h4 i {
  font-size: 0.7rem;
  opacity: 0.8;
}

.model-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem;
  margin-bottom: 0.3rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all var(--duration);
  cursor: pointer;
}

.model-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(1px);
}

.model-option:last-child {
  margin-bottom: 0;
}

.model-option input[type="checkbox"] {
  width: 0.9rem;
  height: 0.9rem;
  accent-color: var(--clr-accent);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--duration);
  margin-top: 0.05rem;
  flex-shrink: 0;
}

.model-option input[type="checkbox"]:checked {
  transform: scale(1.1);
}

.model-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.model-name {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.model-description {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.65rem;
  line-height: 1.3;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Book items styling */
.books-list {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-md);
}

.book-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all var(--duration);
  cursor: pointer;
}

.book-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(1px);
}

.book-item:last-child {
  margin-bottom: 0;
}

.book-item input[type="checkbox"] {
  width: 0.9rem;
  height: 0.9rem;
  accent-color: var(--clr-accent);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--duration);
  flex-shrink: 0;
}

.book-item input[type="checkbox"]:checked {
  transform: scale(1.1);
}

.book-item label {
  flex: 1;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.3;
  transition: color var(--duration);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-item:hover label {
  color: white;
}

/* Button group for select/deselect all */
.button-group {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.button-group button {
  flex: 1;
  padding: 0.4rem 0.6rem;
  font-size: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration);
}

.button-group button:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* --------------------------------- */
/*  METADATA SECTION               */
/* --------------------------------- */
.metadata-section {
  margin: 1rem 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  background: var(--clr-bg-content);
}

.metadata-toggle {
  width: 100%;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%);
  border: 1px solid var(--clr-border);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--clr-text-heading);
  cursor: pointer;
  transition: all var(--duration) ease;
  position: relative;
}

.metadata-toggle::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--clr-accent);
  transform: scaleY(0);
  transition: transform var(--duration) ease;
}

.metadata-toggle:hover {
  background: linear-gradient(135deg, var(--clr-bg-input) 0%, #e2e8f0 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.metadata-toggle:hover::before {
  transform: scaleY(1);
}

.metadata-toggle[aria-expanded="true"] {
  background: var(--clr-accent);
  color: white;
  border-bottom-color: var(--clr-accent);
}

.metadata-toggle[aria-expanded="true"]::before {
  transform: scaleY(1);
  background: rgba(255, 255, 255, 0.3);
}

.metadata-toggle[aria-expanded="true"] .toggle-icon {
  transform: rotate(-180deg);
  color: white;
}

.toggle-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-icon {
  transition: all var(--duration) ease;
  opacity: 0.7;
}

.metadata-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--duration) ease-in-out, padding var(--duration) ease;
  border: 1px solid var(--clr-border);
  border-top: none;
  background: var(--clr-bg-content);
}

.metadata-panel.open {
  padding: 1rem;
  max-height: 800px;
  border-color: var(--clr-accent);
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 0;
}

.metadata-field {
  display: flex;
  flex-direction: column;
  background: var(--clr-bg-input);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
  transition: box-shadow var(--duration), transform var(--duration);
  min-width: 0;
}

.metadata-field:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.metadata-field label {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--clr-text-heading);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.metadata-field select {
  padding: 0.75rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  background: var(--clr-bg-content);
  font-size: 0.9rem;
  color: var(--clr-text-main);
  transition: border-color var(--duration), box-shadow var(--duration);
  cursor: pointer;
}

.metadata-field select:focus {
  outline: none;
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-focus);
}

.metadata-field select:hover {
  border-color: var(--clr-accent-light);
}

.nav-icon {
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  font-size: 0.8rem;
}

.nav-text {
  transition: all var(--duration) ease;
  white-space: nowrap;
}

/* --------------------------------- */
/*  COLLAPSIBLE SIDEBAR SECTIONS   */
/* --------------------------------- */
.section-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
  transition: all var(--duration) ease;
}

.collapsible-header:hover {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
  margin: -0.25rem;
}

.collapse-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: all var(--duration) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  z-index: 10;
  position: relative;
}

.collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  transform: scale(1.1);
}

.collapse-toggle:active {
  background: var(--clr-accent) !important;
  color: white !important;
}

/* Make sure the chevron is visible */
.collapse-toggle i {
  font-size: 0.75rem;
  transition: transform var(--duration) ease;
  pointer-events: none;
}

/* Debug border for collapsible headers */
.collapsible-header {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.collapsible-header:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height var(--duration) ease-in-out, opacity var(--duration) ease;
  max-height: 1000px; /* Increased for subgroups */
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0 !important;
  opacity: 0;
  margin: 0;
  padding: 0;
}

/* Ensure smooth transitions for books and models lists */
.sidebar-section.collapsed .section-description,
.sidebar-section.collapsed .books-list,
.sidebar-section.collapsed .button-group,
.sidebar-section.collapsed #modelOptions {
  transition: opacity var(--duration) ease;
}

/* Hide subgroups when parent is collapsed */
.collapsible-content.collapsed .model-subgroup {
  display: none !important;
}

/* Add visual feedback when section is collapsible */
.collapsible-header {
  border-radius: var(--radius-sm);
  transition: background-color var(--duration) ease;
}

.collapsible-header:focus {
  outline: 2px solid var(--clr-accent);
  outline-offset: 2px;
}

/* Model subgroups for single-choice options */
.model-subgroup {
  margin-top: 0.75rem;
  margin-left: 1rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--clr-accent);
}

.model-subgroup h5 {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.model-subgroup h5 i {
  font-size: 0.6rem;
  opacity: 0.7;
}

.radio-option {
  margin-bottom: 0.25rem;
}

.radio-option:last-child {
  margin-bottom: 0;
}

.radio-checkmark {
  border-radius: 50% !important;
}

.radio-option input[type="radio"] {
  width: 0.9rem;
  height: 0.9rem;
  accent-color: var(--clr-accent);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--duration);
  margin-top: 0.05rem;
  flex-shrink: 0;
}

.radio-option input[type="radio"]:checked {
  transform: scale(1.1);
}

.radio-option .model-name {
  font-size: 0.7rem;
}

.radio-option .model-description {
  font-size: 0.6rem;
}

/* ====== BOOKS LOOPER MAIN CONTENT STYLES ====== */

/* Main content wrapper */
.main-content-wrapper {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.query-card,
.results-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
}

.query-card:hover,
.results-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--accent-color);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--secondary-bg);
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-header h2 i {
  color: var(--accent-color);
  font-size: 0.9rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.query-content,
.results-content {
  padding: 0.5rem;
}

.prompt-section {
  margin-bottom: 1.5rem;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--clr-text-heading);
}

.input-label i {
  color: var(--clr-accent);
  font-size: 0.85rem;
}

.prompt-section textarea {
  width: 100%;
  min-height: 120px;
  padding: 1rem;
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-md);
  background: var(--clr-bg-input);
  color: var(--clr-text-main);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  transition: all var(--duration);
  box-sizing: border-box;
}

.prompt-section textarea:focus {
  outline: none;
  border-color: var(--clr-accent);
  background: var(--clr-bg-content);
  box-shadow: var(--shadow-focus);
}

.prompt-section textarea::placeholder {
  color: var(--clr-text-muted);
  line-height: 1.5;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
}

.char-counter {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  font-weight: 500;
}

.action-section {
  padding-top: 1rem;
  border-top: 1px solid var(--clr-border);
  margin-top: 1.5rem;
}

.action-section .primary-btn {
  width: 100%;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.results-container {
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  background: var(--clr-bg-body);
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border-light);
  padding: 1rem;
  position: relative;
}

.results-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--clr-text-muted);
  min-height: 340px;
  background: var(--clr-bg-content);
  border-radius: var(--radius-md);
  border: 2px dashed var(--clr-border);
  transition: all var(--duration);
}

.empty-state:hover {
  border-color: var(--clr-accent-light);
  background: rgba(59, 130, 246, 0.02);
}

.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.empty-icon i {
  font-size: 2rem;
  color: var(--clr-accent);
  opacity: 0.7;
}

.empty-state h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--clr-text-heading);
}

.empty-state p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--clr-text-muted);
  max-width: 400px;
  line-height: 1.5;
}

/* Result items styling */
.result-item {
  background: var(--clr-bg-input);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: all var(--duration) ease;
}

.result-item:hover {
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.result-item:last-child {
  margin-bottom: 0;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--clr-bg-content);
  border-bottom: 1px solid var(--clr-border);
  cursor: pointer;
  user-select: none;
  transition: all var(--duration) ease;
}

.result-header:hover {
  background: var(--clr-bg-input);
}

.result-header.error {
  background: rgba(239, 68, 68, 0.05);
  border-bottom-color: rgba(239, 68, 68, 0.2);
}

.result-header.error:hover {
  background: rgba(239, 68, 68, 0.08);
}

.result-book-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.result-book-info i {
  color: var(--clr-accent);
  font-size: 1.1rem;
}

.result-header.error .result-book-info i {
  color: #e74c3c;
}

.result-book-title {
  font-weight: 600;
  color: var(--clr-text-heading);
  font-size: 0.95rem;
}

.result-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--clr-border);
  background: var(--clr-bg-content);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration) ease;
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  margin-right: 0.5rem;
  box-shadow: var(--shadow-xs);
}

.result-collapse-toggle:hover {
  background: var(--clr-accent);
  color: white;
  border-color: var(--clr-accent);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.result-collapse-toggle i {
  transition: transform var(--duration) ease;
  font-weight: bold;
}

.result-header.collapsed .result-collapse-toggle i {
  transform: rotate(180deg);
}

.result-actions {
  display: flex;
  gap: 0.5rem;
}

.result-content {
  padding: 1.25rem;
  max-height: none;
  overflow: visible;
  transition: all var(--duration) ease;
  opacity: 1;
}

.result-content.collapsed {
  max-height: 0;
  padding: 0 1.25rem;
  opacity: 0;
  overflow: hidden;
}

.result-section {
  margin-bottom: 1.5rem;
  background: var(--clr-bg-content);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--duration) ease;
}

.result-section:last-child {
  margin-bottom: 0;
}

.result-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%);
  border-bottom: 1px solid var(--clr-border);
  cursor: pointer;
  user-select: none;
  transition: all var(--duration) ease;
  position: relative;
}

.result-section-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--clr-accent);
  opacity: 0;
  transition: opacity var(--duration) ease;
}

.result-section-header:hover {
  background: linear-gradient(135deg, var(--clr-bg-input) 0%, #e2e8f0 100%);
}

.result-section-header:hover::before {
  opacity: 0.7;
}

.result-section-header.collapsed {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-bottom-color: transparent;
}

.result-section-header.collapsed::before {
  opacity: 1;
}

.result-section-header h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--clr-text-heading);
}

.result-section-header h4 i {
  color: var(--clr-accent);
  font-size: 0.85rem;
}

.section-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--clr-border);
  background: var(--clr-bg-content);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration) ease;
  color: var(--clr-text-muted);
  font-size: 0.8rem;
  box-shadow: var(--shadow-xs);
}

.section-collapse-toggle:hover {
  background: var(--clr-accent);
  color: white;
  border-color: var(--clr-accent);
  transform: scale(1.15);
  box-shadow: var(--shadow-md);
}

.section-collapse-toggle i {
  transition: transform var(--duration) ease;
  font-weight: bold;
}

.result-section-header.collapsed .section-collapse-toggle i {
  transform: rotate(180deg);
}

.result-section-content {
  padding: 1rem;
  max-height: none;
  overflow: visible;
  transition: all var(--duration) ease;
  opacity: 1;
}

.result-section-content.collapsed {
  max-height: 0;
  padding: 0 1rem;
  opacity: 0;
  overflow: hidden;
}

.result-text {
  background: var(--clr-bg-input);
  border: 1px solid var(--clr-border);
  border-left: 3px solid var(--clr-accent);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--clr-text-main);
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
}

.result-text::-webkit-scrollbar {
  width: 8px;
}

.result-text::-webkit-scrollbar-track {
  background: var(--clr-bg-input);
  border-radius: var(--radius-sm);
}

.result-text::-webkit-scrollbar-thumb {
  background: var(--clr-border);
  border-radius: var(--radius-sm);
  transition: background var(--duration) ease;
}

.result-text::-webkit-scrollbar-thumb:hover {
  background: var(--clr-accent);
}

.error-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e74c3c;
  font-style: italic;
  padding: 1rem;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
}

.error-message i {
  font-size: 1rem;
}

/* Loading state */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--clr-text-muted);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--clr-border);
  border-top: 3px solid var(--clr-accent);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

.loading-state h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--clr-text-heading);
}

.loading-state p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--clr-text-muted);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .looper-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .results-section {
    order: 2;
  }
  
  .query-section {
    order: 1;
  }
}

@media (max-width: 768px) {
  .looper-layout {
    gap: 1rem;
  }
  
  .query-content,
  .results-content {
    padding: 1rem;
  }
  
  .prompt-section textarea {
    min-height: 100px;
    padding: 0.75rem;
  }
  
  .empty-state {
    padding: 2rem 1rem;
  }
  
  .empty-icon {
    width: 60px;
    height: 60px;
  }
  
  .empty-icon i {
    font-size: 1.5rem;
  }
  
  .result-content {
    padding: 1rem;
  }
}

/* ====== UPLOAD BOOKS PAGE STYLES ====== */

/* Upload Layout */
.upload-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  margin-top: 1rem;
}

.upload-main {
  min-height: 500px;
}

.upload-card {
  background: var(--clr-bg-content);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all var(--duration) ease;
}

.upload-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.upload-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%);
  border-bottom: 1px solid var(--clr-border);
  position: relative;
}

.upload-card .card-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.upload-card .card-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--clr-text-heading);
}

.upload-card .card-header h2 i {
  color: var(--clr-accent);
  font-size: 1rem;
}

/* Upload Progress */
.upload-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 200px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--clr-bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  transition: width var(--duration) ease;
  width: 0%;
}

.progress-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  white-space: nowrap;
}

/* Drag and Drop Zone */
.dropzone {
  position: relative;
  min-height: 300px;
  border: 3px dashed var(--clr-border);
  border-radius: var(--radius-lg);
  margin: 1.5rem;
  background: var(--clr-bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) ease;
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--clr-accent-light);
  background: rgba(59, 130, 246, 0.02);
  transform: scale(1.01);
}

.dropzone.dragover {
  border-color: var(--clr-accent);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: var(--shadow-lg);
}

.dropzone.error {
  border-color: var(--clr-error);
  background: rgba(239, 68, 68, 0.05);
}

.dropzone.success {
  border-color: var(--clr-success);
  background: rgba(16, 185, 129, 0.05);
}

.dropzone-content {
  text-align: center;
  padding: 2rem;
  max-width: 400px;
}

.dropzone-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-2xl);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  transition: all var(--duration) ease;
}

.dropzone:hover .dropzone-icon {
  transform: scale(1.1);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
}

.dropzone-icon i {
  font-size: 2rem;
  color: var(--clr-accent);
  opacity: 0.8;
}

.dropzone-text h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--clr-text-heading);
}

.dropzone-text p {
  margin: 0 0 1rem;
  color: var(--clr-text-muted);
  font-size: 0.95rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--clr-accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
  transition: color var(--duration) ease;
}

.link-btn:hover {
  color: var(--clr-accent-hover);
}

.dropzone-hint {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  opacity: 0.8;
}

.dropzone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

/* File List */
.file-list {
  margin: 1.5rem;
  margin-top: 0;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--clr-bg-content);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  transition: all var(--duration) ease;
}

.file-item:hover {
  border-color: var(--clr-accent);
  box-shadow: var(--shadow-sm);
}

.file-item:last-child {
  margin-bottom: 0;
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--clr-error) 0%, #dc2626 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  display: block;
  font-weight: 600;
  color: var(--clr-text-heading);
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--clr-text-muted);
}

.file-actions {
  display: flex;
  gap: 0.5rem;
}

.file-remove {
  width: 32px;
  height: 32px;
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-content);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration) ease;
  color: var(--clr-text-muted);
}

.file-remove:hover {
  background: var(--clr-error);
  color: white;
  border-color: var(--clr-error);
}

/* Upload Sidebar */
.upload-sidebar {
  background: var(--clr-bg-content);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  height: fit-content;
  border: 1px solid var(--clr-border);
  overflow: hidden;
}

.upload-sidebar .sidebar-header {
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%);
  border-bottom: 1px solid var(--clr-border);
  position: relative;
}

.upload-sidebar .sidebar-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.upload-sidebar .sidebar-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-text-heading);
}

.upload-sidebar .sidebar-header h3 i {
  color: var(--clr-accent);
  font-size: 0.9rem;
}

.upload-sidebar .sidebar-content {
  padding: 1.25rem;
}

.upload-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--clr-bg-input);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--clr-accent);
}

.upload-tip:last-child {
  margin-bottom: 0;
}

.tip-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--clr-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.tip-content h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--clr-text-heading);
}

.tip-content p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  line-height: 1.4;
}

/* Upload Actions */
.upload-actions {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem;
  margin-top: 0;
}

.upload-actions .primary-btn {
  flex: 1;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

/* ====== ASK BY EXCEL PAGE STYLES ====== */

/* Page Header */
.page-header {
  background: linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--clr-border);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.page-header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.8rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.page-header .page-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--clr-text-heading);
  letter-spacing: -0.025em;
}

.page-header .page-description {
  margin: 0;
  color: var(--clr-text-muted);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 600px;
}

/* Excel Container */
.excel-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  margin-top: 1rem;
}

.excel-card {
  background: var(--clr-bg-content);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all var(--duration) ease;
}

.excel-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* Excel Upload Section */
.upload-section {
  padding: 2rem;
}

.excel-card .dropzone {
  min-height: 250px;
  margin: 0;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.02);
}

.excel-card .dropzone:hover {
  border-color: #059669;
  background: rgba(16, 185, 129, 0.05);
}

.excel-card .dropzone.dragover {
  border-color: #047857;
  background: rgba(16, 185, 129, 0.1);
}

.excel-card .dropzone-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
}

.excel-card .dropzone-icon i {
  color: #10b981;
}

.excel-card .dropzone:hover .dropzone-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
}

/* File Preview */
.file-preview {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--clr-bg-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
}

.file-info-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.file-info-card .file-icon {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.file-info-card .file-details {
  flex: 1;
}

.file-info-card .file-name {
  font-weight: 600;
  color: var(--clr-text-heading);
  margin-bottom: 0.25rem;
}

.file-status {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

/* Data Preview */
.data-preview {
  margin-top: 1.5rem;
}

.data-preview h4 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-text-heading);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.data-preview h4 i {
  color: #10b981;
  font-size: 0.9rem;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-content);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.preview-table th {
  background: var(--clr-bg-input);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--clr-text-heading);
  border-bottom: 2px solid var(--clr-border);
}

.preview-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text-main);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-table tbody tr:hover {
  background: var(--clr-bg-input);
}

/* Process Section */
.process-section {
  padding: 2rem;
  border-top: 1px solid var(--clr-border);
  background: var(--clr-bg-input);
}

.process-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.process-actions .primary-btn {
  padding: 0.875rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.process-actions .primary-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.process-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--clr-text-muted);
  font-size: 0.9rem;
}

.process-info i {
  color: #10b981;
}

/* Excel Sidebar */
.excel-sidebar {
  background: var(--clr-bg-content);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  height: fit-content;
  border: 1px solid var(--clr-border);
  overflow: hidden;
}

.excel-sidebar .sidebar-header {
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--clr-bg-content) 0%, var(--clr-bg-input) 100%);
  border-bottom: 1px solid var(--clr-border);
  position: relative;
}

.excel-sidebar .sidebar-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.excel-sidebar .sidebar-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-text-heading);
}

.excel-sidebar .sidebar-header h3 i {
  color: #10b981;
  font-size: 0.9rem;
}

.excel-sidebar .sidebar-content {
  padding: 1.25rem;
}

.excel-sidebar .upload-tip {
  border-left-color: #10b981;
}

.excel-sidebar .tip-icon {
  background: #10b981;
}

/* Sample Download */
.sample-download {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--clr-bg-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
  text-align: center;
}

.sample-download h4 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--clr-text-heading);
}

.sample-download p {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  line-height: 1.4;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--duration) ease;
  box-shadow: var(--shadow-sm);
}

.download-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: white;
  text-decoration: none;
}

/* --------------------------------- */
/*  METADATA MANAGER                */
/* --------------------------------- */
.metadata-container {
  padding: 1.5rem;
  max-width: 100%;
}

.metadata-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-box {
  position: relative;
  width: 300px;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-color);
}

.search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.metadata-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.metadata-card {
  background: var(--card-bg);
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.metadata-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.metadata-card-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.metadata-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.metadata-card-actions {
  display: flex;
  gap: 0.5rem;
}

.metadata-card-body {
  padding: 0;
}

.metadata-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.metadata-item {
  border-bottom: 1px solid var(--border-color);
  padding: 0;
}

.metadata-item:last-child {
  border-bottom: none;
}

.metadata-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: background 0.2s;
}

.metadata-item-header:hover {
  background: var(--hover-bg);
}

.metadata-item-title {
  font-weight: 500;
  margin: 0;
}

.metadata-item-actions {
  display: flex;
  gap: 0.5rem;
  opacity: 0.6;
}

.metadata-item-header:hover .metadata-item-actions {
  opacity: 1;
}

.metadata-item-content {
  padding: 0 1.25rem 1.25rem;
  display: none;
  background: var(--bg-subtle);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-color);
  border-top: 1px dashed var(--border-color);
}

.metadata-item-content.active {
  display: block;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75); /* Increased opacity for better contrast */
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--bg-color, #ffffff);
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(0);
  transition: transform 0.3s ease;
  border: 2px solid var(--border-color, #e2e8f0);
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-subtle, #f8fafc);
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}

.modal-title {
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: var(--bg-subtle, #f8fafc);
  border-bottom-left-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--input-bg, #f8fafc);
  color: var(--text-color, #334155);
  transition: all 0.2s ease;
  font-size: 0.95rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) inset;
}

.form-control:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
  font-family: inherit;
}

/* Form check styles for checkboxes */
.form-check {
  display: flex;
  align-items: center;
  margin-top: 1rem;
}

.form-check-input {
  margin-right: 0.5rem;
  width: 1rem;
  height: 1rem;
}

.form-check-label {
  font-size: 0.95rem;
}

.form-text {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.alert-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.35rem;
  border-radius: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--hover-bg);
  color: var(--text-color);
}

.btn-add {
  color: var(--success-color);
}

.btn-edit {
  color: var(--primary-color);
}

.btn-delete {
  color: var(--danger-color);
}

.btn-export {
  color: var(--info-color);
}

.btn-import {
  color: var(--warning-color);
}

.no-items {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.category-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 41, 59, 0.85); /* Darker, less transparent background */
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s;
}

.loading-overlay.active {
  visibility: visible;
  opacity: 1;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-left-color: var(--primary-color, #3b82f6);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}