/*!
 * ═══════════════════════════════════════════════════════════════════════════
 *                        MATCHA ADMIN PANEL STYLES
 * ═══════════════════════════════════════════════════════════════════════════
 * 
 * A comprehensive CSS framework for the Admin Portal featuring:
 * - Matcha-inspired color palette with light/dark modes
 * - Responsive design patterns
 * - Modern component styling
 * - Accessibility-focused interactions
 * 
 * Author: Kevin Bissinger, Richard Hillman, Johnathan McGrath
 * Version: 2.1.0
 * Last Updated: August 15, 2025
 * ═══════════════════════════════════════════════════════════════════════════
 */

/*─────────────────────────────────────────────────────────────────────────────
  001: CSS CUSTOM PROPERTIES (VARIABLES)
─────────────────────────────────────────────────────────────────────────────*/
html[data-theme="light"],
:root {
  /* ── Color Palette: Light Mode ── */
  /* Backgrounds & Surfaces */
  --color-background: #f3f7f0; /* soft tea cream */
  --color-surface: #ffffff; /* white panels */
  --color-stripe: #edf1ea; /* subtle stripe background */
  --color-border: #91b96b; /* light sage border */

  /* Text Colors */
  --color-text: #333333; /* dark charcoal */
  --color-text-muted: #556b2f; /* moss green */
  --color-link: #2112a6; /* olive drab */

  /* Brand & State Colors */
  --color-primary: #455b19; /* olive drab */
  --color-primary-hover: #556b2f; /* darker olive */
  --color-primary-focus: #c3e4a2; /* pale matcha */
  --color-success: #2e8b57; /* sea green */
  --color-error: #d9534f; /* muted red */
  --color-danger: #c94a47; /* brighter red */

  /* Typography */
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

/*─────────────────────────────────────────────────────────────────────────────

  002: DARK THEME OVERRIDES
─────────────────────────────────────────────────────────────────────────────*/
html[data-theme="dark"] {
  /* ── Color Palette: Dark Mode ── */
  --color-background: #1a1a1a; /* deep charcoal */
  --color-surface: #2a2a2a; /* medium gray panels */
  --color-stripe: #3d3d3d; /* darker stripe background */
  --color-border: #314b1a; /* dark sage border */
  --color-text: #e0e0e0; /* light gray text */
  --color-text-muted: #a1ba77; /* muted green text */
  --color-link: #7db8ff; /* olive drab */
  --color-primary: #91b96b; /* lighter sage primary */
  --color-primary-hover: #6b8e23; /* olive green hover */
  --color-primary-focus: #c3e4a2; /* pale matcha focus */
  --color-success: #6fbf73; /* lighter success green */
  --color-error: #ef5a52; /* coral error color */
}

/*─────────────────────────────────────────────────────────────────────────────
  003: GLOBAL RESET & BASE STYLES
─────────────────────────────────────────────────────────────────────────────*/
/* ── Universal Reset ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Body & Root Styling ── */
body {
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.6;
  padding: 2rem;
  transition: var(--color-background) 0.5s ease, var(--color-text) 0.5s ease;
}

/* ── Focus Accessibility ── */
:focus-visible {
  outline: 3px solid var(--color-primary-focus);
  outline-offset: 2px;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

/*─────────────────────────────────────────────────────────────────────────────
  004: LAYOUT & CONTAINER COMPONENTS
─────────────────────────────────────────────────────────────────────────────*/
/* ── Main Containers ── */
#outer-container,
.container,
main {
  max-width: 1200px;
  margin: auto;
  padding: 2rem;
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ── Authentication Panel Layout ── */
#bigPane {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem;
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/*─────────────────────────────────────────────────────────────────────────────
  005: TYPOGRAPHY & HEADINGS
─────────────────────────────────────────────────────────────────────────────*/
/* ── Primary Headings ── */
h1 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--color-primary);
}

/* ── Secondary Headings in Panels ── */
#bigPane h2 {
  text-align: center;
  margin: 1rem 0 0.5rem;
  color: var(--color-text-muted);
}

/*─────────────────────────────────────────────────────────────────────────────
  006: NAVIGATION COMPONENTS
─────────────────────────────────────────────────────────────────────────────*/
/* ── Main Navigation ── */
#main-nav {
  margin-bottom: 1.5rem;
}

#main-nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 0;
}

#main-nav a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

#main-nav a:hover,
#main-nav a:focus {
  background: var(--color-border);
}

#main-nav a.active {
  background: var(--color-primary);
  color: var(--color-background);
}

/* ── General Navigation ── */
nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/*─────────────────────────────────────────────────────────────────────────────
  007: ADMIN BADGE & STATUS COMPONENTS
─────────────────────────────────────────────────────────────────────────────*/
/* ── Admin Badge Container ── */
#admin-badge,
.badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-stripe);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 2rem;
}

/* ── Status Indicator ── */
.status-dot {
  width: 0.75rem;
  height: 0.75rem;
  background: var(--color-primary);
  border-radius: 50%;
  margin-right: 0.5rem;
  display: inline-block;
}

/* ── Badge Information ── */
#badge-info {
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ── Logout Button ── */
#logout-btn {
  background: var(--color-primary);
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
}

#logout-btn:hover {
  background: var(--color-primary-hover);
}

#logout-btn:focus-visible {
  outline: 3px solid var(--color-primary-focus);
  outline-offset: 2px;
}

/*─────────────────────────────────────────────────────────────────────────────
  008: TABLE COMPONENTS & STYLING
─────────────────────────────────────────────────────────────────────────────*/
/* ── Base Table Structure ── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 1rem;
}

/* ── Table Headers ── */
th {
  background: var(--color-primary);
  color: #fff;
  text-align: left;
  font-weight: 600;
  padding: 0.75rem 1rem;
}

/* ── Table Data Cells ── */
td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

/* ── Table Row States ── */
tr:nth-child(even) {
  background: var(--color-stripe);
}

tr:hover {
  background: rgba(107, 142, 35, 0.1);
}

/* ── Table Wrapper & Scrolling ── */
.table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  border-radius: 6px;
}

.table-wrapper::-webkit-scrollbar {
  height: 20px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: var(--color-background);
}

.table-wrapper::-webkit-scrollbar-thumb {
  background-color: #969696;
  border-radius: 8px;
  border: 2px solid var(--color-surface);
}

/*─────────────────────────────────────────────────────────────────────────────
  009: FORM COMPONENTS & INPUT STYLING
─────────────────────────────────────────────────────────────────────────────*/
/* ── Form Layout ── */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Input Fields ── */
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="text"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-background);
  color: var(--color-text);
  font-size: 1rem;
}

/* ── Input Labels ── */
.form-labels {
  font-weight: 750;
  font-size: larger;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

/* ── Textarea Specific ── */
textarea {
  resize: vertical;
}

/* ── Input Focus States ── */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--color-primary-hover);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

/* ── Form Result Messages ── */
#login-result,
#signup-result {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  min-height: 1.25rem;
}

#login-result.danger,
#signup-result.danger {
  color: var(--color-error);
}

/* -- File Upload Styling -- */
input[type="file"] {
  display: block;
  margin-top: 1rem;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-background);
  color: var(--color-text);
}
input#file-upload-button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: var(--color-background);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
/*─────────────────────────────────────────────────────────────────────────────
  010: BUTTON COMPONENTS & INTERACTIONS
─────────────────────────────────────────────────────────────────────────────*/
/* ── Base Button Styling ── */
button,
[type="submit"] {
  padding: 0.75rem 1rem;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  color: var(--color-background);
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

/* ── Button Hover States ── */
button:hover,
[type="submit"]:hover {
  background: var(--color-primary-hover);
}

/* ── Button Focus States ── */
button:focus-visible {
  outline: 3px solid var(--color-primary-focus);
  outline-offset: 2px;
}

/* ── Danger Button Variant ── */
button.danger {
  background: var(--color-error);
  border-color: var(--color-error);
}

button.danger:hover {
  background: var(--color-danger);
}

/*─────────────────────────────────────────────────────────────────────────────
  011: PANEL & AUTHENTICATION COMPONENTS
─────────────────────────────────────────────────────────────────────────────*/
/* ── Login/Signup Toggle Panels ── */

button#badgePhoto {
  margin: 0 0 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center; /* centers buttons horizontally */
  gap: 0.5rem; /* space between buttons */
  margin: 1rem 0;
}

button#startBtn {
  margin: 1rem 5rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center; /* centers buttons horizontally */
  gap: 0.5rem; /* space between buttons */
  margin: 1rem 0;
}

button#stopBtn {
  margin: 0 0 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center; /* centers buttons horizontally */
  gap: 0.5rem; /* space between buttons */
  margin: 1rem 0;
}

button#verifyPhone {
  margin: 1rem 5rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center; /* centers buttons horizontally */
  gap: 0.5rem; /* space between buttons */
  margin: 1rem 0;
}
#password-requirements {
  margin-top: 0.5rem;
}
#password-requirements li.met {
  color: #1a7f37;
} /* accessible green */
#password-requirements li.unmet {
  color: #a33;
} /* accessible red */
#password-requirements li.idle {
  color: var(--color-text-muted);
} /* neutral before typing */

/* === Panels for Login/Signup Toggle === */

.panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel:not(.hidden) {
  display: flex;
}

/* ── Hidden State Utility ── */
.hidden {
  display: none !important;
}

/*─────────────────────────────────────────────────────────────────────────────
  013: RESPONSIVE DESIGN & MEDIA QUERIES
─────────────────────────────────────────────────────────────────────────────*/
/* ── Mobile & Tablet Breakpoints ── */
@media (max-width: 768px) {
  /* Navigation adjustments */
  #main-nav ul {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  /* Container spacing adjustments */
  #outer-container,
  .container,
  main {
    padding: 1rem;
  }

  /* Action button layouts */
  .actions {
    flex-direction: column;
    align-items: stretch;
  }
}

div#voiceControls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--color-background);
  border: var(--color-border) dotted 1px;
}

/*─────────────────────────────────────────────────────────────────────────────
  014: PASSWORD STRENGTH INDICATOR
─────────────────────────────────────────────────────────────────────────────*/
#password-requirements {
  display: none;
}
#password-requirements li.idle {
  opacity: 0.7;
}
#password-requirements li.met {
  color: #2e7d32;
}
#password-requirements li.unmet {
  color: #c62828;
}
/*─────────────────────────────────────────────────────────────────────────────
  015: CHIPS FOR BOOLEAN COLUMNS
─────────────────────────────────────────────────────────────────────────────*/
/* chips for boolean columns */
.chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  line-height: 1;
}
.chip-yes {
  background: #d9f2e3;
  color: #0a5b52;
}
.chip-no {
  background: #fde2e2;
  color: #8a1c1c;
}
