@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', 'Outfit', system-ui, sans-serif;
  
  /* Curated Light Theme (Clean slate/blue tones) */
  --background: 210 40% 98%;
  --card: 0 0% 100%;
  --card-border: 214 32% 91%;
  --card-hover-border: 214 32% 80%;
  
  --text-primary: 222 47% 11%;
  --text-secondary: 215 16% 47%;
  --text-muted: 215 13% 63%;
  
  --primary: 221 83% 53%;
  --primary-glow: 221 83% 53% / 0.08;
  --primary-hover: 221 83% 45%;
  
  --accent: 262 83% 58%;
  --accent-glow: 262 83% 58% / 0.08;
  
  --success: 142 72% 29%;
  --success-glow: 142 72% 29% / 0.08;
  --danger: 346 84% 50%;
  --danger-glow: 346 84% 50% / 0.08;
  --warning: 38 92% 50%;
  --warning-glow: 38 92% 50% / 0.08;
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.1);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.01);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--text-primary));
  overflow-x: hidden;
  min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: hsl(var(--background));
}
::-webkit-scrollbar-thumb {
  background: hsl(var(--card-border));
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--card-hover-border));
}

/* Base Layout Classes */
.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.glass-panel-interactive {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

.glass-panel-interactive:hover {
  border-color: hsl(var(--card-hover-border));
  box-shadow: var(--shadow-glow), var(--shadow-card);
  transform: translateY(-2px);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Layout Utilities */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

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

/* Custom Table Styles */
.custom-table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid hsl(var(--card-border));
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.custom-table th {
  background: rgba(241, 245, 249, 0.8);
  padding: 14px 18px;
  font-weight: 600;
  color: hsl(var(--text-secondary));
  border-bottom: 1px solid hsl(var(--card-border));
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: hsl(var(--text-primary));
  transition: var(--transition-smooth);
}

.custom-table tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue {
  background: hsla(217, 91%, 60%, 0.1);
  color: hsl(217, 91%, 70%);
  border: 1px solid hsla(217, 91%, 60%, 0.2);
}

.badge-purple {
  background: hsla(262, 83%, 58%, 0.1);
  color: hsl(262, 83%, 70%);
  border: 1px solid hsla(262, 83%, 58%, 0.2);
}

.badge-emerald {
  background: hsla(142, 76%, 36%, 0.1);
  color: hsl(142, 76%, 50%);
  border: 1px solid hsla(142, 76%, 36%, 0.2);
}

.badge-rose {
  background: hsla(346, 84%, 50%, 0.1);
  color: hsl(346, 84%, 65%);
  border: 1px solid hsla(346, 84%, 50%, 0.2);
}

.badge-amber {
  background: hsla(38, 92%, 50%, 0.1);
  color: hsl(38, 92%, 65%);
  border: 1px solid hsla(38, 92%, 50%, 0.2);
}

/* Form inputs styling */
.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid hsl(var(--card-border));
  color: hsl(var(--text-primary));
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.form-input:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

/* Primary Button Styling */
.btn-primary {
  background: hsl(var(--primary));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  background: hsl(var(--primary-hover));
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.03);
  color: hsl(var(--text-primary));
  border: 1px solid hsl(var(--card-border));
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: hsl(var(--card-hover-border));
  transform: translateY(-1px);
}

.btn-danger {
  background: hsla(346, 84%, 50%, 0.15);
  color: hsl(346, 84%, 65%);
  border: 1px solid hsla(346, 84%, 50%, 0.3);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.btn-danger:hover {
  background: hsl(var(--danger));
  color: white;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 640px;
  padding: 30px;
  max-height: 90vh;
  overflow-y: auto;
}

/* ==========================================================================
   Responsive Mobile Overrides
   ========================================================================== */

@media (max-width: 992px) {
  .layout-container {
    flex-direction: column !important;
    padding: 12px !important;
    gap: 16px !important;
  }

  aside {
    width: 100% !important;
    margin: 0 !important;
    padding: 16px 20px !important;
    border-radius: var(--radius-md) !important;
  }

  main {
    padding: 10px 0 !important;
    gap: 20px !important;
  }

  .nav-links {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .nav-button {
    width: auto !important;
    flex: 1 1 auto;
    font-size: 0.8rem;
    padding: 8px 12px !important;
  }

  .aside-user {
    margin-bottom: 15px !important;
  }

  .aside-header {
    margin-bottom: 20px !important;
  }

  aside .btn-danger {
    margin-top: 10px !important;
    width: 100% !important;
    justify-content: center !important;
    padding: 10px !important;
  }

  .header-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .header-bar div {
    width: 100%;
  }

  .header-bar .btn-primary, 
  .header-bar .btn-secondary,
  .header-bar a {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Form & layout grids */
  .form-grid, .blast-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
}

@media (max-width: 576px) {
  /* Search input layout wrapper (index.php) */
  form#search-form > div[style*="display: flex; gap: 12px"],
  form#search-form > div[style*="display: flex; gap: 12px;"] {
    flex-direction: column !important;
    gap: 8px !important;
  }

  form#search-form > div[style*="display: flex; gap: 12px"] > button,
  form#search-form > div[style*="display: flex; gap: 12px"] > a,
  form#search-form > div[style*="display: flex; gap: 12px;"] > button,
  form#search-form > div[style*="display: flex; gap: 12px;"] > a {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Pagination container styling */
  .pagination-container {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: center !important;
  }

  /* Stack inline 2 or 3-column grids inside modal or forms */
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr;"],
  div[style*="grid-template-columns: 1fr 1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr 1fr;"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}
