/* VSU Branding Variables */
:root {
  /* --- Primary Brand Colors --- */
  --vsu-black: #000000;
  --vsu-red: #da1a32; /* Bonfire Red (PMS 186 C) */
  --vsu-embers: #a00c30; /* Embers (PMS 7427 C) */
  --vsu-magnolia: #ffffff;

  /* --- Secondary Colors --- */
  --vsu-flame: #f58025; /* Flame (PMS 1585 C) - Accent */
  --vsu-sky: #a3dad6; /* Sky (PMS 7464 C) - Accent */
  --vsu-lake: #00a39d; /* Lake (PMS 7716 C) - Accent */
  --vsu-pine: #00463c; /* Pine (PMS 330 C) - Deep Accent */

  /* --- Neutral/Gray Scale --- */
  --vsu-stone: #d1d1ce; /* Stone (PMS 420 C) */
  --vsu-stone-light: #f5f5f5; /* Light Gray */
  --vsu-gray-dark: #333333;

  /* --- Semantic Mappings --- */
  --color-primary: var(--vsu-black);
  --color-action: var(--vsu-red);
  --color-action-dark: #b9152b; /* A darker shade for hover */
  --color-accent: var(--vsu-flame);

  --text-main: var(--vsu-gray-dark);
  --text-light: #666666;
  --text-on-dark: #ffffff;

  --bg-body: var(--vsu-stone-light);
  --bg-card: #ffffff;
  --border-color: #e5e5e5;

  /* --- Typography --- */
  /* Fallback stack: Acumin Pro (Adobe) -> Oswald (Google) -> System */
  --font-primary:
    "acumin-pro", "Oswald", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Fallback stack: Acumin Pro (Adobe) -> Source Sans 3 (Google) -> System */
  --font-body:
    "acumin-pro", "Source Sans 3", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Fallback: Publico (Adobe) -> EB Garamond (Google) -> serif */
  --font-serif:
    "publico-text", "EB Garamond", Georgia, "Times New Roman", serif;

  /* --- Geometry --- */
  --angle-brand: 24deg; /* Official 18-24 degree range */
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  /* --- Compatibility Aliases (for base_search.html & Legacy) --- */
  --vsu-gray-light: var(--vsu-stone-light);
  --vsu-gray-medium: var(--vsu-stone);

  --color-bonfire-red: var(--vsu-red); /* Critical Fix for Base Header */

  --color-bg: var(--vsu-magnolia);
  --color-surface: var(--bg-card);
  --color-text-muted: var(--text-light);
  --color-border: #e5e5e5;
  --color-hover: #f5f5f5;
}

/* --- Brand Utilities --- */

/* Halftone Pattern (Reuse this class) */
.bg-halftone {
  background-image: radial-gradient(var(--vsu-stone) 15%, transparent 16%);
  background-size: 10px 10px;
  background-position: 0 0;
  opacity: 0.15;
}

/* Diagonal Mask (e.g., for Hero or Card accents) */
.mask-angle-bottom {
  clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

.border-top-accent {
  border-top: 5px solid var(--color-action);
}

/* Gradients */
.gradient-bonfire {
  background: linear-gradient(135deg, var(--vsu-embers), var(--vsu-red));
}
.gradient-flame {
  background: linear-gradient(135deg, var(--vsu-red), var(--vsu-flame));
}
.gradient-lake {
  background: linear-gradient(135deg, var(--vsu-lake), var(--vsu-pine));
}
.gradient-pine {
  background: linear-gradient(135deg, var(--vsu-pine), var(--vsu-lake));
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-body);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Ensure main content expands */
body > .container {
  flex: 1;
  width: 100%; /* Ensure centering still works */
}

a {
  color: var(--vsu-black);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  text-decoration: underline;
  color: var(--vsu-red);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem; /* Reduced from 2rem 1rem */
}

/* Header */
header {
  background-color: var(--vsu-black);
  color: white;
  padding: 0.5rem 0; /* Reduced from 1rem */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header .container {
  padding: 0 1rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin: 0;
}

header .user-info {
  font-size: 0.9rem;
}

header .user-info a {
  color: white;
  text-decoration: underline;
  margin-left: 1rem;
}

/* Nav */
nav {
  background-color: var(--vsu-red);
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .container {
  padding: 0 1rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

nav a {
  color: white;
  font-weight: 600;
  padding: 1rem 0;
  display: block;
}

nav a:hover {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: white;
  min-width: 220px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  z-index: 200;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  color: var(--text-main);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
  transition: background 0.2s;
}

.dropdown-menu a:hover {
  background-color: var(--vsu-gray-light);
  color: var(--vsu-red);
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem; /* Reduced from 1.5rem */
  margin-bottom: 0.75rem; /* Reduced from 1rem */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card h2 {
  font-family: var(--font-serif);
  color: var(--vsu-black);
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--vsu-red);
  padding-bottom: 0.25rem; /* Reduced */
  display: inline-block;
  font-size: 1.25rem; /* Slightly smaller */
}

/* Grid */
.grid-container {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(280px, 1fr)
  ); /* Slightly tighter min width */
  gap: 1.5rem; /* Increased from 1rem */
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* First button (View Records) takes full width */
.card-actions > *:first-child {
  grid-column: span 2;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  text-align: center;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-primary {
  background-color: var(--vsu-black);
  color: white;
}

.btn-primary:hover {
  background-color: #333;
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background-color: var(--vsu-gray-medium);
  color: var(--vsu-black);
}

.btn-secondary:hover {
  background-color: #bbb;
  color: var(--vsu-black);
  text-decoration: none;
}

.btn-success {
  background-color: #28a745; /* Standard success green, VSU doesn't define one */
  color: white;
}

.btn-danger {
  background-color: var(--vsu-red);
  color: white;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

/* Forms & Inputs */
input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

input:focus,
select:focus {
  border-color: var(--vsu-black);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Tables (Responsive) */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: white;
}

th {
  background-color: var(--vsu-gray-light);
  text-align: left;
  padding: 0.75rem;
  border-bottom: 2px solid var(--vsu-red);
}

td {
  padding: 0.75rem;
  border-bottom: 1px solid #ddd;
}

tr:hover {
  background-color: #fafafa;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
}

.badge-published {
  background-color: #e6ffed; /* Light green bg */
  color: #1e7e34;
  border: 1px solid #1e7e34;
}

.badge-draft {
  background-color: #fff8c5; /* Light yellow bg */
  color: #856404;
  border: 1px solid #856404;
}

.badge-warning {
  background-color: #fff3cd;
  color: #856404;
}

/* Footer */
footer {
  background-color: var(--vsu-gray-dark);
  color: var(--vsu-gray-medium);
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
  font-size: 0.9rem;
}

/* Utilities */
.text-muted {
  color: var(--text-light);
}
.mt-1 {
  margin-top: 0.5rem;
}
.mb-1 {
  margin-bottom: 0.5rem;
}
.d-flex {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}

/* Dashboard Intro (Refactored) */
.dashboard-intro {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.dashboard-logo {
  height: 180px;
  width: auto;
  flex-shrink: 0;
}

.dashboard-text h2 {
  margin-top: 0;
  margin-bottom: 0.25rem;
  font-size: 2.5rem;
  line-height: 1;
}

.dashboard-text p {
  margin-bottom: 0;
  color: #666;
  font-size: 1.1rem;
  max-width: 600px;
}

.dashboard-actions {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.dashboard-actions label {
  font-size: 0.9rem;
  font-weight: bold;
  color: #555;
}

.dashboard-actions select {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 1rem;
  cursor: pointer;
  background: white;
  min-width: 250px;
}

/* --- Mobile Responsive (Admin Portal) --- */
@media (max-width: 768px) {
  /* Dashboard Intro Mobile */
  .dashboard-intro {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .dashboard-logo {
    height: 120px; /* Smaller on mobile */
    margin: 0 auto;
  }

  .dashboard-text h2 {
    font-size: 2rem;
  }

  .dashboard-actions {
    margin-left: 0;
    align-items: center;
    width: 100%;
  }

  .dashboard-actions select {
    width: 100%;
    min-width: 0;
  }

  /* Layout */
  .container {
    padding: 1rem;
    width: 100%;
  }

  /* Header */
  header .container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  header h1 {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
  }

  header .user-info {
    margin-left: 0;
    margin-top: 0.5rem;
    font-size: 0.85rem;
  }

  /* Navigation */
  nav .container {
    justify-content: center;
    padding: 0.5rem;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
  }

  nav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    text-align: center;
  }

  /* Dropdowns on Mobile */
  .dropdown:hover .dropdown-menu {
    position: static; /* Stack naturally on mobile */
    display: block;
    width: 100%;
    box-shadow: none;
    border: 1px solid #eee;
    margin-top: 0.5rem;
  }

  .dropdown-menu a {
    padding: 0.5rem;
    text-align: center;
  }

  /* Content */
  .grid-container {
    grid-template-columns: 1fr; /* Single column grid */
  }

  .card-actions {
    grid-template-columns: 1fr; /* Stack buttons */
  }
  .card-actions > *:first-child {
    grid-column: span 1;
  }

  /* Tables */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
}
