/* ══════════════════════════════════════════════
   AMPLEM FACTORY 2026 · ADMIN DASHBOARD
   Dark teal theme · Desktop-first
   ══════════════════════════════════════════════ */

:root {
  --teal: #00d4c8;
  --teal-dim: #00a89e;
  --teal-bg: #0d2826;
  --bg: #0d0f10;
  --surface: #161a1c;
  --surface2: #1e2426;
  --border: #2a3035;
  --text: #e8edef;
  --muted: #6b7880;
  --warn: #ff6b35;
  --danger: #ef4444;
  --danger-bg: #2a1010;
  --success: #22c55e;
  --success-bg: #0d2418;
  --hf: #3d8ef0;
  --hh: #f59e0b;
  --ff: #ec4899;
  --sam: #3d8ef0;
  --dim: #a855f7;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Barlow Condensed', sans-serif; }

/* ── LOGIN SCREEN ── */
#login-screen {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.35s, transform 0.35s;
}
#login-screen.hidden { opacity: 0; transform: translateY(-16px); pointer-events: none; }

.login-logo { font-size: 11px; font-weight: 700; letter-spacing: 5px; color: var(--teal); text-transform: uppercase; }
.login-title { font-size: 48px; font-weight: 900; letter-spacing: 1px; line-height: 1; margin: 6px 0 4px; }
.login-sub { font-size: 16px; color: var(--muted); font-weight: 600; margin-bottom: 36px; }

.login-box { width: 100%; max-width: 360px; }
.login-box input {
  width: 100%; padding: 14px 16px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 18px; font-weight: 600; color: var(--text); outline: none;
  margin-bottom: 14px;
}
.login-box input:focus { border-color: var(--teal); }
.login-box input::placeholder { color: var(--muted); }
.login-box button {
  width: 100%; padding: 14px;
  background: var(--teal); color: #000; border: none; border-radius: 8px;
  font-family: inherit; font-size: 18px; font-weight: 800; letter-spacing: 1px;
  cursor: pointer; text-transform: uppercase;
  transition: background 0.2s;
}
.login-box button:hover { background: var(--teal-dim); }
.login-error { color: var(--danger); font-size: 14px; font-weight: 600; margin-top: 10px; text-align: center; display: none; }

/* ── LAYOUT ── */
#app { display: none; flex-direction: column; height: 100vh; }
#app.active { display: flex; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; min-height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-brand { font-size: 11px; font-weight: 700; letter-spacing: 4px; color: var(--teal); text-transform: uppercase; }
.header-title { font-size: 22px; font-weight: 900; letter-spacing: 1px; }
.header-dot { color: var(--muted); font-weight: 600; }

#btn-logout {
  padding: 8px 18px; background: transparent; border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted); font-family: inherit; font-size: 14px;
  font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
  transition: all 0.2s;
}
#btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ── TAB NAV ── */
.tab-nav {
  display: flex; gap: 0; background: var(--surface);
  border-bottom: 1px solid var(--border); padding: 0 24px;
  overflow-x: auto;
}
.tab-btn {
  padding: 12px 20px; background: none; border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted); font-family: inherit; font-size: 15px;
  font-weight: 700; letter-spacing: 0.5px; cursor: pointer;
  text-transform: uppercase; white-space: nowrap;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1; overflow-y: auto; padding: 24px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── SECTION HEADER ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title { font-size: 26px; font-weight: 900; letter-spacing: 1px; }
.section-count { color: var(--muted); font-size: 16px; font-weight: 600; margin-left: 10px; }

/* ── BUTTONS ── */
.btn {
  padding: 8px 16px; border: none; border-radius: 6px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s; letter-spacing: 0.5px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--teal); color: #000; }
.btn-primary:hover { background: var(--teal-dim); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; font-size: 16px; line-height: 1; }

/* ── TABLE ── */
.data-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: 8px; overflow: hidden;
}
.data-table thead th {
  padding: 12px 16px; text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted);
  background: var(--surface2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 600; vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(0, 212, 200, 0.03); }
.data-table .actions { white-space: nowrap; display: flex; gap: 6px; }

/* ── LINE BADGE ── */
.line-badge {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  font-size: 13px; font-weight: 800; letter-spacing: 1px;
}
.line-badge.l1 { background: #1a2a3d; color: var(--hf); }
.line-badge.l2 { background: #2a2410; color: var(--hh); }
.line-badge.l3 { background: #2a1028; color: var(--ff); }
.line-badge.l4 { background: #1a1a2d; color: var(--dim); }

/* ── HEAT BADGE ── */
.heat-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 13px; font-weight: 800; background: var(--surface2); color: var(--text);
}

/* ── CATEGORY BADGE ── */
.cat-badge {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  font-size: 13px; font-weight: 800;
}
.cat-hf { background: #1a2a3d; color: var(--hf); }
.cat-hh { background: #2a2410; color: var(--hh); }
.cat-ff { background: #2a1028; color: var(--ff); }

/* ── DAY BADGE ── */
.day-badge {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  font-size: 13px; font-weight: 800;
}
.day-sam { background: #1a2040; color: var(--sam); }
.day-dim { background: #1e1030; color: var(--dim); }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text); outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--teal); }
.form-select { cursor: pointer; appearance: auto; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }

.form-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  padding: 28px; transform: translateY(20px); transition: transform 0.25s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-wide { max-width: 720px; }

.modal-title {
  font-size: 22px; font-weight: 900; letter-spacing: 1px; margin-bottom: 20px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}

/* ── TOAST ── */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 5000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: 8px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  transform: translateX(120%); transition: transform 0.3s;
  max-width: 400px;
}
.toast.show { transform: translateX(0); }
.toast-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.toast-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }

/* ── CONFIRM DIALOG ── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.confirm-overlay.open { opacity: 1; pointer-events: all; }
.confirm-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 28px; max-width: 400px; width: 100%; text-align: center;
}
.confirm-msg { font-size: 18px; font-weight: 700; margin-bottom: 20px; line-height: 1.4; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }

/* ── CARD GRID ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; transition: border-color 0.2s;
}
.card:hover { border-color: var(--teal-dim); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 18px; font-weight: 900; letter-spacing: 0.5px; }
.card-subtitle { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ── ASSIGNMENTS GRID ── */
.assign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.assign-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px;
}
.assign-wod { font-size: 16px; font-weight: 900; margin-bottom: 10px; color: var(--teal); }
.assign-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  padding: 8px 10px; background: var(--surface2); border-radius: 6px;
}
.assign-line-label { font-size: 12px; font-weight: 800; letter-spacing: 1px; width: 50px; text-transform: uppercase; }

/* ── SCHEDULE TABLE ── */
.schedule-group { margin-bottom: 24px; }
.schedule-group-title {
  font-size: 18px; font-weight: 900; margin-bottom: 10px;
  padding: 8px 14px; background: var(--surface2); border-radius: 6px;
  display: flex; align-items: center; gap: 10px;
}

/* ── FLOATER ── */
.floater-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.floater-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px;
}
.floater-time { font-size: 18px; font-weight: 900; color: var(--teal); }
.floater-info { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.floater-signups { margin-top: 10px; }
.floater-signup-item {
  padding: 6px 10px; background: var(--surface2); border-radius: 4px;
  font-size: 14px; font-weight: 600; margin-bottom: 4px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--muted);
  font-size: 16px; font-weight: 600;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── LOADING ── */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--teal);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   RESPONSIVE — Mobile
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Header */
  header { padding: 0 12px; height: 48px; min-height: 48px; }
  .header-brand { font-size: 9px; letter-spacing: 3px; }
  .header-title { font-size: 18px; }
  .header-dot, .header-section { display: none; }
  #btn-logout { padding: 6px 12px; font-size: 12px; }

  /* Tabs — horizontal scroll */
  .tab-nav { padding: 0 8px; gap: 0; }
  .tab-btn { padding: 10px 12px; font-size: 13px; }

  /* Main content */
  .main-content { padding: 14px; }

  /* Section header */
  .section-header { flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
  .section-title { font-size: 20px; }

  /* Tables — horizontal scroll */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table thead th { padding: 10px 12px; font-size: 10px; }
  .data-table tbody td { padding: 8px 12px; font-size: 14px; }

  /* Card grids — single column */
  .card-grid { grid-template-columns: 1fr; }
  .assign-grid { grid-template-columns: 1fr; }
  .floater-slots { grid-template-columns: 1fr; }

  /* Forms — single column */
  .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }

  /* Modals */
  .modal { margin: 12px; padding: 20px; max-height: 90vh; border-radius: 10px; }
  .modal-wide { max-width: 100%; }
  .modal-title { font-size: 18px; margin-bottom: 16px; }

  /* Confirm dialog */
  .confirm-box { margin: 16px; padding: 20px; }

  /* Toast */
  .toast-container { top: 8px; right: 8px; left: 8px; }
  .toast { max-width: 100%; }

  /* Buttons */
  .btn { padding: 10px 14px; font-size: 13px; }
  .section-header .btn { width: 100%; justify-content: center; }

  /* Login */
  .login-box { padding: 0 20px; }
}
