/* ==========================================================================
   VARIABLES
   ========================================================================== */
:root {
  /* Primary palette */
  --clr-primary: #164a5c;
  --clr-primary-dark: #0f3b4b;
  --clr-secondary: #91a9a9;
  --clr-secondary-dark: #718282;
  /* Status & actions */
  --clr-success: #10b981;
  --clr-success-dark: #059669;
  --clr-danger: #ef4444;
  --clr-danger-dark: #dc2626;
  /* Neutral / accents */
  --clr-grey: #6b7280;
  --clr-grey-dark: #4b5563;
  --clr-bg-light: #f5f7fa;
  --clr-bg-alt: #f9fafb;
  --clr-bg-accent: #eef2ff;
  --clr-border: #e5e7eb;
  --clr-text: #333;
  /* Typography */
  --font-base: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   IMPORT FONT
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font-base);
  background: var(--clr-bg-light);
  color: var(--clr-text);
  line-height: 1.5;
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--clr-primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  position: relative;
  z-index: 1100;
}
.navbar .brand {
  font-size: 1.5rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}
.nav-links li a {
  color: #f0f0f0;
  text-decoration: none;
  font-weight: 500;
  padding: 0.25rem;
  transition: color 0.2s;
}
.nav-links li a:hover,
.nav-links li a.active {
  color: #fff;
  border-bottom: 2px solid #fff;
}
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.user-menu img {
  width: 32px !important;
  height: 32px !important;
  max-width: none !important;
  object-fit: cover;   /* preserve aspect ratio and crop if needed */
  border-radius: 50%;
}
.user-menu .dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: none;
  min-width: 160px;
  overflow: hidden;
  z-index: 1150;
}
.user-menu:hover .dropdown {
  display: block;
}
.user-menu .dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  color: var(--clr-text);
}
.user-menu .dropdown a:hover {
  background: var(--clr-bg-accent);
}
.hamburger {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
}

/* ──────────────────────────────────────────────────────────────
   MOBILE NAVIGATION
─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links {
    display: none;             /* hide by default */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--clr-primary);
    flex-direction: column;
    gap: 0;
  }
  .nav-links.open {
    display: flex;             /* show when .open is toggled */
  }
  .nav-links li {
    border-top: 1px solid rgba(255,255,255,0.2);
  }
  .nav-links li a {
    padding: 1rem;
  }
  .hamburger {
    display: block;            /* ensure it’s visible */
  }
}

/* ──────────────────────────────────────────────────────────────
   HORIZONTAL SCROLL FOR TABLES
─────────────────────────────────────────────────────────────── */
#tableSection {
  overflow-x: auto;                   /* allow scrolling */
  -webkit-overflow-scrolling: touch;   /* smooth on iOS */
}
/* Optional: prevent the rest of the body from overflowing */
body {
  overflow-x: hidden;
}

/* ──────────────────────────────────────────────────────────────
   Mobile: Show only Name, Status, More, Delete columns
─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* hide: Edit, ID, GC Name, Start Date, Type */
  #jobsTable thead th:nth-child(1),
  #jobsTable tbody td:nth-child(1),
  #jobsTable thead th:nth-child(2),
  #jobsTable tbody td:nth-child(2),
  #jobsTable thead th:nth-child(4),
  #jobsTable tbody td:nth-child(4),
  #jobsTable thead th:nth-child(5),
  #jobsTable tbody td:nth-child(5),
  #jobsTable thead th:nth-child(6),
  #jobsTable tbody td:nth-child(6) {
    display: none;
  }

  /* you may also want to shrink the table’s padding/spacing */
  #jobsTable th,
  #jobsTable td {
    padding: 0.5rem;
    font-size: 0.9rem;
  }

  /* ensure horizontal scroll if needed */
  #tableSection {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ==========================================================================
   DETAILS OVERLAY BACKDROP
   ========================================================================== */
.details-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 900;
  opacity: 0;
  /* Prevent it from catching clicks when hidden: */
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.details-overlay.visible {
  opacity: 1;
  /* Now that it’s visible, allow clicks (so you can click to dismiss, etc) */
  pointer-events: auto;
}

/* ==========================================================================
   HEADER & LOGOUT (OLD)
   ========================================================================== */
header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  position: relative;
  background: var(--clr-primary);
  color: var(--clr-bg-alt);
}
header h1 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.75rem;
}
.index-logo-top {
  width: 36px;
  height: auto;
}
.logout-btn {
  position: absolute;
  top: 1rem; right: 1rem;
  border: 2px solid #fff;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
}
.logout-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* ==========================================================================
   LAYOUT & CARDS
   ========================================================================== */
main {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Full-width table section */
#tableSection {
  position: relative;
  left: 50%;
  right: 50%;
  margin: 0 -50vw;
  width: 100vw;
  padding: 0 1rem;
}
#tableSection .card {
  margin: 2rem auto;
  padding: 1.5rem;
  max-width: none;
}

/* ==========================================================================
   FORM
   ========================================================================== */
#jobForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
#jobForm input,
#jobForm select {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
}

#jobForm button {
   grid-column: 1 / -1;        /* span all columns */
   width: 100%;                /* fill container */
   margin: 0;                  /* reset any offsets */
   padding: 0.75rem;
   background: var(--clr-primary);
   color: #fff;
   border: none;
   cursor: pointer;
   transition: background 0.2s;
}
#jobForm fieldset {
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  padding: 0.75rem;
}
#jobForm legend {
  padding: 0 0.5rem;
}
#jobForm button {
  background: var(--clr-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
#jobForm button:hover {
  background: var(--clr-primary-dark);
}


/* Sorting indicators */
.sortable {
  cursor: pointer;
  position: relative;
  user-select: none;
}
.sortable::after {
  content: ' ↕';
  font-size: 0.8rem;
  color: var(--clr-bg-light);
  position: absolute;
  right: 0.5rem;
}
.sortable.asc::after { content: ' ↑'; }
.sortable.desc::after { content: ' ↓'; }

/* ==========================================================================
   GLOBAL TABLE STYLES
   ========================================================================== */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--clr-border);
  vertical-align: middle;
}
thead {
  background: var(--clr-bg-accent);
}
tbody tr:nth-child(even) {
  background: var(--clr-bg-alt);
}

/* ==========================================================================
   JOBS TABLE
   ========================================================================== */
#jobsTable {
  border: 1px solid var(--clr-border);
}
#jobsTable thead th {
  background: var(--clr-primary);
  color: #fff;
  font-weight: 600;
  border: none;
}
#jobsTable td .edit-btn,
#jobsTable td .more-btn,
#jobsTable td .delete-btn {
  display: block;
  margin: auto;
  font-size: 1.2rem;
  width: 50%;
}
/* ==========================================================================
   TABLE ACTION ICONS — reset the old neon blocks
   ========================================================================== */
/* Make the two buttons share the same cell and line up nicely */
#jobsTable td:last-child,
#jobsTable td:nth-last-child(2) {
  padding: 0.5rem;
  /* ensure they don’t wrap or get squashed */
  white-space: nowrap;
}

/* Base icon-only button */
.action-btn {
  background: none;              /* no block fill */
  border: none;
  color: var(--clr-text);        /* default icon color */
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.4rem;
  margin: 0 0.25rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

/* Hover “bubble” & slight pop */
.action-btn:hover {
  background: rgba(0,0,0,0.05);
  transform: scale(1.1);
}

/* EDIT (✎) */
.edit-btn {
  color: var(--clr-primary-dark);
}
.edit-btn:hover {
  color: var(--clr-primary);
}

/* MORE INFO (⤵) */
.more-btn {
  color: var(--clr-secondary-dark);
}
.more-btn:hover {
  color: var(--clr-secondary);
}

/* DELETE (🗑) */
.delete-btn {
  color: var(--clr-danger-dark);
}
.delete-btn:hover {
  color: var(--clr-danger);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
}
.edit-btn {
  background: var(--clr-primary);
  color: #fff; border: none;
}
.edit-btn:hover { background: var(--clr-primary-dark); }
.more-btn {
  background: var(--clr-success);
  color: #fff; border: none;
}
.more-btn:hover { background: var(--clr-success-dark); }
.delete-btn {
  background: var(--clr-danger);
  color: #fff; border: none;
}
.delete-btn:hover { background: var(--clr-danger-dark); }

/* ==========================================================================
   DETAILS PANEL
   ========================================================================== */
.details-row td {
  background: var(--clr-bg-alt);
  padding: 1rem;
}
#detailsPanel {
  position: fixed;
  top: 0; right: -100%;
  width: 80%; max-width: 1600px;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 12px rgba(0,0,0,0.1);
  overflow-y: auto;
  transition: right 0.3s ease;
  padding: 1.5rem;
  z-index: 1000;
}
#detailsPanel.visible {
  right: 0;
}
#detailsPanel .close-btn {
  position: absolute;
  top: 5rem; right: 3rem;
  font-size: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

/* Section & form controls inside panel */
#detailsPanel .section {
  margin-bottom: 1.5rem;
}
#detailsPanel .section h4 {
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--clr-border);
  padding-bottom: 0.25rem;
  color: var(--clr-primary);
}
#detailsPanel input,
#detailsPanel select,
#detailsPanel textarea {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
  text-align: center;
}

/* + Add Material & Save Details */
#det-addMat {
  background: var(--clr-primary);
  color: #fff;
  border: none;
  padding: 0.75rem;
  font-weight: 600;
  width: 100%;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
#det-addMat:hover { background: var(--clr-primary-dark); }
#det-save {
  background: var(--clr-success);
  color: #fff;
  border: none;
  padding: 0.75rem;
  font-weight: 600;
  width: 100%;
  border-radius: 4px;
  cursor: pointer;
}
#det-save:hover { background: var(--clr-success-dark); }
/* stick Save button on long panels */
#det-save { position: sticky; bottom: 0; margin-top: 1rem; }

/* ==========================================================================
   MATERIALS TABLE INSIDE PANEL
   ========================================================================== */
.materials-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
.materials-table thead th {
  background: var(--clr-secondary);
  color: var(--clr-text);
  padding: 0.75rem;
  border-bottom: 2px solid var(--clr-border);
  font-weight: 600;
}
.materials-table tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--clr-border);
  vertical-align: middle;
}
.materials-table tbody tr:nth-child(even) {
  background: var(--clr-bg-accent);
}
/* Inputs & selects in materials */
.materials-table input,
.materials-table select {
  text-align: center;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

/* give the ‘Name’ column (2nd column) about 40% of the table width */
.materials-table thead th:nth-child(2),
.materials-table tbody td:nth-child(2) {
  width: 40%;
}
/* now make the input fill the cell and scroll */
.materials-table td input[data-field="name"] {
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow-x: auto;
}
/* “Action” header for remove buttons */
.materials-table thead th:last-child {
  text-align: center;
  width: 80px;
}
/* Remove button cell */
.remove-material-btn {
  background: var(--clr-danger);
  color: #fff;
  border: none;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}
.remove-material-btn:hover {
  background: var(--clr-danger-dark);
}
/* 1) Allow the Name input to grow & wrap */
.materials-table td input[data-field="name"] {
  flex: 1;                /* fill available space */
  min-width: 120px;       /* never shrink below this */
  padding: 0.5em;         /* more comfortable touch target */
  font-size: 0.9rem;
}

/* 2) Turn table rows into stacked cards on narrow screens */
@media (max-width: 600px) {
  .materials-table,
  .materials-table thead,
  .materials-table tbody,
  .materials-table tr,
  .materials-table td {
    display: block;
    width: 100%;
  }
  .materials-table thead {
    /* hide the header row on mobile */
    display: none;
  }
  .materials-table tr {
    margin-bottom: 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5em;
  }
  .materials-table td {
    /* label each field for clarity */
    position: relative;
    padding-left: 50%;
    margin-bottom: 0.5em;
  }
  .materials-table td:nth-of-type(1)::before { content: "Type"; }
  .materials-table td:nth-of-type(2)::before { content: "Name"; }
  .materials-table td:nth-of-type(3)::before { content: "Qty"; }
  .materials-table td:nth-of-type(4)::before { content: "Unit Price"; }
  .materials-table td:nth-of-type(5)::before { content: "Total Cost"; }
  .materials-table td:nth-of-type(6)::before { content: "Status"; }
  .materials-table td:nth-of-type(7)::before { content: ""; } /* remove "Remove" label */
  .materials-table td::before {
    position: absolute;
    left: 0.5em;
    width: 45%;
    font-weight: bold;
  }
}

/* ==========================================================================
   STATUS DROPDOWN COLORS
   ========================================================================== */
.status-select {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
}
.status-select.status-take-off          { background: var(--clr-primary); }
.status-select.status-take-off-finished { background: var(--clr-success); }
.status-select.status-bidding           { background: var(--clr-secondary); color: var(--clr-text); }
.status-select.status-bidding-accepted  { background: var(--clr-success); }
.status-select.status-bidding-declined  { background: var(--clr-danger); }
.status-select.status-materials         { background: var(--clr-secondary-dark); }
.status-select.status-on-going          { background: var(--clr-grey); }

/* ==========================================================================
   SQUARE FOOTAGE CONTROLS
   ========================================================================== */
.sqft-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  margin: 1rem 0;
}
.sqft-row label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
}
.sqft-row input {
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 800px) {
  #jobForm {
    grid-template-columns: 1fr !important;
  }
  th, td {
    font-size: 0.85rem;
    padding: 0.5rem;
  }
  #jobForm button[type="submit"] {
    grid-column: 1 / -1;       /* span that one column */
    width: 100%;               /* fill the column */
    max-width: 100%;           /* never exceed its parent */
    box-sizing: border-box;    /* include any padding/borders */
    left: 0%;
  }
}

@media (max-width: 600px) {
  #detailsPanel {
    position: fixed;
    top:   0;
    right: -100%;           /* start hidden off-screen to the right */
    width: 100%;
    height: 100%;
    max-width: 100%;
    box-shadow: -4px 0 12px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
  }
  /* When JS toggles these classes… */
  #detailsPanel.hidden {
    right: -100%;          /* keep it off-screen */
  }
  #detailsPanel.visible {
    right: 0;              /* slide into view */
  }
}
  /* Bigger touch targets */
  body, button, input, select, textarea {
    font-size: 1rem;
  }
  button, .btn {
    padding: 0.75rem 1rem;
  }
}
/* ──────────────────────────────────────────────────────────────
   Contacts form: logical rows
─────────────────────────────────────────────────────────────── */
#contactForm {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  align-items: start;
}

/* 1st row: Full Name | Company */
/* 2nd row: Role | Email */
/* 3rd row: Phone spans both columns */
/* 4th row: Button spans both columns */
#contactForm .form-group:nth-child(5) { /* Phone is 5th .form-group */
  grid-column: 1 / -1;
}
#contactForm button {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
}

/* Tidy up labels & inputs */
#contactForm .form-group {
  display: flex;
  flex-direction: column;
}
#contactForm label {
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--clr-grey-dark);
}
#contactForm input {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  box-sizing: border-box;
}

/* Responsive: fall back to one column on mobile */
@media (max-width: 600px) {
  #contactForm {
    grid-template-columns: 1fr;
  }
  #contactForm .form-group:nth-child(5),
  #contactForm button {
    grid-column: 1 / -1;
  }
}
#contactForm button {
  background: var(--clr-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  /* span full width */
  grid-column: 1 / -1;
  transition: background 0.2s;
}
#contactForm button:hover {
  background: var(--clr-primary-dark);
}

/* ──────────────────────────────────────────────────────────────
   CONTACTS TABLE (same as #jobsTable)
─────────────────────────────────────────────────────────────── */
/* Contacts form grid & labels */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label {
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--clr-grey-dark);
}
.form-group input {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
}
.full-width {
  grid-column: 1 / -1;
  padding: 0.75rem;
  font-size: 1rem;
}

/* Table styling (same as jobs table) */
#contactsTable {
  border: 1px solid var(--clr-border);
}
#contactsTable thead th {
  background: var(--clr-primary);
  color: #fff;
  font-weight: 600;
  border: none;
}
#contactsTable td .edit-btn,
#contactsTable td .delete-btn {
  display: block;
  margin: auto;
  font-size: 1.2rem;
  width: 50%;
}

/* Responsive: one column on small screens */
@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   Contacts Search Bar
   ────────────────────────────────────────────────────────────────────────── */
.search-card {
  padding: 1rem;
  margin-bottom: 0.5rem;
}
#contactSearch {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--clr-grey-light);
  border-radius: 0.375rem;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
  transition: border-color 0.2s;
}
#contactSearch:focus {
  outline: none;
  border-color: var(--clr-primary);
}

/* ──────────────────────────────────────────────────────────────
   LOGIN PAGE STYLING
─────────────────────────────────────────────────────────────── */

/* 1) Full‐viewport background blur/image */
body.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--clr-bg-light);
}
body.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('../images/bg.jpg') center/cover no-repeat;
  filter: blur(6px) brightness(0.75);
  z-index: -1;
}

/* 2) Centered login card */
.login-container {
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-card {
  background: rgba(255,255,255,0.9);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.16);
}

/* 3) Logo or brand at top */
.login-logo-top {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 180px;
  width: 100%;
}

/* 4) Form fields */
.login-card .form-group {
  margin-bottom: 1rem;
  text-align: left;
}
.login-card .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.login-card .form-group input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
}

/* 5) Primary button */
.btn-primary {
  display: block;
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  background: var(--clr-primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover {
  background: var(--clr-primary-dark);
}

/* 6) Error messages */
.error {
  background: #fee2e2;
  color: var(--clr-danger);
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* 7) Helper links (e.g. “Forgot password?”) */
.helper-link {
  margin-top: 0.5rem;
}
.helper-link a {
  color: var(--clr-primary);
  text-decoration: none;
  font-size: 0.9rem;
}
.helper-link a:hover {
  text-decoration: underline;
}

/* ─────────────────────────────────────────────────────────────
   CUSTOM CONFIRM MODAL
───────────────────────────────────────────────────────────── */
.modal.hidden {
  display: none;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  text-align: center;
}
.modal-content p {
  margin-bottom: 1.25rem;
  font-size: 1rem;
}
.modal-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.modal-buttons .btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.9rem;
}
.modal-buttons .btn-danger {
  background: var(--clr-danger);
  color: #fff;
}
.modal-buttons .btn-danger:hover {
  background: var(--clr-danger-dark);
}

/* ───────────────────────────────────────────────────────────────────────── */
/* Profile page enhancements                                              */
/* ───────────────────────────────────────────────────────────────────────── */

.profile-card {
  max-width: 700px;
  margin: 2rem auto;
  padding: 2rem;
}

.profile-header {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 2rem;
}

.profile-header .avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #eef2f5;
  object-fit: cover;
}

.profile-info h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--text-dark);
}

.profile-info p {
  margin: 0.25rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.profile-stats .stat {
  background: var(--primary-dark);
  color: var(--primary) !important;
  padding: 1rem;
  border-radius: 4px;
  text-align: center;
}

.profile-stats .stat strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.profile-stats .stat span {
  font-size: 1.3rem;
  font-weight: bold;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px,1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  text-align: center;
}
.stat h5 {
  margin: 0;
  font-size: .9rem;
  color: #555;
}
.stat p {
  margin: .5rem 0 0;
  font-size: 1.5rem;
  font-weight: bold;
}

/* ---------------------------------- */
/*  users/add.php form refinements    */
/* ---------------------------------- */

.user-card {
  max-width: 800px;
  margin: 2rem auto;
  padding: 1.5rem;
}

.user-card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.25rem;
}

.user-card .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem 1.5rem;
}

.user-card .form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.user-card .form-group input,
.user-card .form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color .2s;
}
.user-card .form-group input:focus,
.user-card .form-group select:focus {
  outline: none;
  border-color: var(--primary-dark);
}

.user-card .required {
  color: var(--danger);
  margin-left: 2px;
}

.user-card .form-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

@media (max-width: 600px) {
  .user-card .form-actions {
    flex-direction: column;
  }
}

/* ── Dashboard / Admin Grid ────────────────────────────────────────── */

.container {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.admin-grid > h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.25rem;
}

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

.dash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .2s, transform .1s;
}

.dash-card i {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.dash-card span {
  font-weight: 600;
  text-align: center;
}

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

@media (max-width: 600px) {
  .admin-grid .grid {
    grid-template-columns: 1fr 1fr;
  }
}



