/* Allan & Son Seal Inventory - Week 2 styles */

:root {
  --brand: #1d3557;
  --brand-light: #2b4a75;
  --accent: #e63946;
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --text: #22303c;
  --muted: #64748b;
  --border: #d7dee6;
  --radius: 6px;
  --link: #1d4ed8;
  --heading-accent: #1d3557;
  --btn-bg: #e5e9ee;
  --input-bg: #ffffff;
  --input-disabled: #eef1f4;
  --row-alt: #f8fafc;
  --row-hover: #eef3f8;
  --tint-red: #fdecea;
  --tint-red-hover: #fbdcd9;
  --tint-yellow: #fff8e1;
  --tint-yellow-hover: #fdf0c8;
  --warn-bg: #fffbe6;
  --warn-border: #f0d000;
  --chip-neutral: #eef2f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--brand);
  color: #fff;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.brand {
  color: #fff;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.brand span { font-weight: 300; opacity: 0.85; }
.brand-logo { height: 40px; width: auto; display: block; }
.login-logo {
  display: block; margin: 0 auto 1rem; max-width: 180px;
  border-radius: var(--radius);
}
.hero-logo {
  max-width: 220px; margin: 0 auto 0.75rem; display: block;
  border-radius: var(--radius);
}
.main-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.main-nav a {
  color: #dbe4ee;
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.main-nav a:hover { background: var(--brand-light); color: #fff; }
.nav-logout { border: 1px solid rgba(255,255,255,0.35); }

/* ---------- Layout ---------- */
.container {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  min-height: 60vh;
}
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem 1rem;
}

h1 { margin-top: 0.25rem; }
h2 { margin-top: 2rem; }
.hint { color: var(--muted); font-size: 0.9rem; }
.mono { font-family: Consolas, Menlo, monospace; font-size: 0.92em; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* ---------- Home ---------- */
.hero { text-align: center; padding: 2.5rem 0; }
.hero .lead { max-width: 600px; margin: 0 auto 1.5rem; color: var(--muted); }
.quick-links { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin: 1rem 0; }
.system-status { margin-top: 2rem; color: var(--muted); font-size: 0.9rem; }
.status-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: #2f9e44; margin-right: 0.35rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--text);
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { filter: brightness(0.95); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-light); filter: none; }
.btn-secondary { background: var(--card-bg); border-color: var(--heading-accent); color: var(--heading-accent); }
.btn-danger { background: var(--accent); color: #fff; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 1.05rem; }
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-group { margin-bottom: 1rem; min-width: 160px; flex: 1; }
.form-group-grow { flex: 2; }
.form-group-btn { flex: 0; display: flex; align-items: flex-end; }
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);  /* browsers default to black - unreadable in dark mode */
}
::placeholder { color: var(--muted); opacity: 1; }
select option { background: var(--input-bg); color: var(--text); }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand-light);
  outline-offset: 0;
  border-color: var(--brand-light);
}
input:disabled { background: var(--input-disabled); color: var(--muted); }
small { color: var(--muted); }

.search-form { margin-bottom: 0.75rem; }
.admin-form { margin-bottom: 2rem; }
.login-box { max-width: 380px; margin: 3rem auto; }
.login-footer { margin-bottom: 0; text-align: center; }

/* ---------- Flash / error messages ---------- */
.flash-messages { margin-bottom: 1rem; }
.flash {
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
}
.flash-error {
  background: #fde8e8; border-color: #f5b5b5; color: #9b1c1c;
}
.flash-success {
  background: #e6f4ea; border-color: #a8d5b5; color: #1e6934;
}
.flash-info {
  background: #e8f0fe; border-color: #b3ccf5; color: #1a4b8f;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.92rem;
}
.data-table th, .data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table thead th {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table tbody tr:nth-child(even) { background: var(--row-alt); }
.data-table tbody tr:hover { background: var(--row-hover); }
.empty-row { text-align: center; color: var(--muted); padding: 1.5rem !important; }
.actions { white-space: nowrap; }
.actions form { display: inline; }

.results-summary { color: var(--muted); }
.no-results { text-align: center; color: var(--muted); }

/* ---------- Status color coding ---------- */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
}
.status-confirmed    { background: #90EE90; } /* green  - Confirmed */
.status-checking     { background: #FFFF00; } /* yellow - Needs Checking */
.status-new          { background: #87CEEB; } /* blue   - New */
.status-discontinued { background: #FF6B6B; } /* red    - Discontinued */

/* Week 3 badge classes */
.badge-confirmed    { background: #90EE90; color: black; padding: 5px 10px; border-radius: 3px; }
.badge-checking     { background: #FFFF00; color: black; padding: 5px 10px; border-radius: 3px; }
.badge-new          { background: #87CEEB; color: black; padding: 5px 10px; border-radius: 3px; }
.badge-discontinued { background: #FF6B6B; color: white; padding: 5px 10px; border-radius: 3px; }

/* Row tints by status (kept subtle so text stays readable) */
.data-table tbody tr.row-discontinued { background: var(--tint-red); }
.data-table tbody tr.row-discontinued:hover { background: var(--tint-red-hover); }
.data-table tbody tr.row-out-of-stock { background: var(--tint-yellow); }
.data-table tbody tr.row-out-of-stock:hover { background: var(--tint-yellow-hover); }

.legend { margin-top: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Seal kit detail ---------- */
.detail-card { margin-bottom: 1rem; }
.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1.25rem;
  margin: 0;
}
.detail-list dt { font-weight: 600; color: var(--muted); }
.detail-list dd { margin: 0; }

/* ---------- Dashboard ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.stat-value { font-size: 2.2rem; font-weight: 700; color: var(--heading-accent); }
.stat-label { color: var(--muted); font-size: 0.9rem; }
.admin-links { line-height: 2; }

/* ---------- Week 4: photos ---------- */
.thumb {
  width: 64px; height: 48px; object-fit: contain; background: #fff;
  border-radius: 4px; border: 1px solid var(--border);
  display: block;
}
.photo-cell { width: 72px; }
.no-photo { color: var(--muted); font-size: 0.8rem; }
.photo-form { display: inline; }
.btn-file { position: relative; overflow: hidden; }

/* ---------- Week 4: breadcrumbs ---------- */
.breadcrumb {
  font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem;
}
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---------- Week 4: low stock alerts ---------- */
.low-stock {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem 1.25rem;
  margin: 1.5rem 0;
}
.low-stock h2 { margin-top: 0.5rem; }
.low-stock small { font-weight: 400; color: var(--muted); }
.qty-zero { color: var(--accent); font-weight: 700; }
.row-out-of-zero { background: var(--tint-red) !important; }

/* ---------- Week 4: dashboard extras ---------- */
.dash-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0 2rem;
}
.recent-list { line-height: 1.9; padding-left: 1.2rem; }

/* ---------- Week 4: export / import ---------- */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.export-card h3 { margin-top: 0; }
.import-errors { color: #9b1c1c; line-height: 1.7; }

/* ---------- Week 4: advanced search ---------- */
.range-inputs { display: flex; align-items: center; gap: 0.4rem; }
.range-inputs input { width: 90px; }
.checkbox-group { display: flex; flex-direction: column; gap: 0.2rem; }
.checkbox-label { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; }
.checkbox-label input { width: auto; }
.applied-filters { margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filter-chip {
  background: #e8f0fe; border: 1px solid #b3ccf5; color: #1a4b8f;
  padding: 0.15rem 0.7rem; border-radius: 999px; font-size: 0.85rem;
}

/* ---------- Week 5: users & audit ---------- */
.role-badge {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600;
}
.role-admin   { background: #1d3557; color: #fff; }
.role-manager { background: #2b6cb0; color: #fff; }
.role-staff   { background: #d0e3f5; color: #1a4b8f; }
.role-viewer  { background: #e5e9ee; color: #444; }
.audit-action {
  font-family: Consolas, Menlo, monospace; font-size: 0.85rem;
  background: var(--chip-neutral); padding: 0.1rem 0.5rem; border-radius: 3px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .form-row { flex-direction: column; gap: 0; }
  .form-group { min-width: 0; }
  .hero { padding: 1.25rem 0; }
  .stat-value { font-size: 1.7rem; }
  .quick-links .btn { width: 100%; text-align: center; }
}

/* ---------- Week 6: theming ---------- */
main a { color: var(--link); }
.theme-toggle {
  background: transparent; border: 1px solid rgba(255,255,255,0.35);
  color: #fff; border-radius: var(--radius); cursor: pointer;
  padding: 0.35rem 0.6rem; font-size: 1rem; line-height: 1;
}
.theme-toggle:hover { background: var(--brand-light); }
.settings-section { margin-bottom: 1.5rem; }
.radio-inline { display: flex; gap: 1.5rem; }
.radio-inline label { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; }
.radio-inline input { width: auto; }