/* ==============================================================================
   Flexicomm Contractor Dispatch Terminal - Clean Modern Stylesheet
   Standards: Mainland Scotland Regional Territory Engine | High-Contrast Dark-Tech
   ============================================================================== */

:root {
  --bg-deep: #050811;
  --bg-surface: #0c1324;
  --bg-card: #111a33;
  --bg-card-hover: #162244;
  --border-card: #1e2c52;
  --border-light: rgba(255, 255, 255, 0.08);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-cyan: #00f2fe;
  --accent-emerald: #00f59b;
  --accent-amber: #ffb800;
  --accent-rose: #ff4d6d;
  --accent-blue: #3b82f6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'Space Grotesk', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Container */
.terminal-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

/* ==============================================================================
   LOGIN SCREEN
   ============================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(circle at 50% 20%, #101c38 0%, #050811 80%);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.1;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Quick Roles Box */
.quick-roles-strip {
  background: rgba(0, 242, 254, 0.05);
  border: 1px dashed rgba(0, 242, 254, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1.5rem;
}
.quick-roles-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}
.quick-roles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.btn-role-quick {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.btn-role-quick:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
}
.btn-role-quick.admin {
  border-color: rgba(255, 184, 0, 0.4);
  color: var(--accent-amber);
}
.btn-role-quick.admin:hover {
  background: rgba(255, 184, 0, 0.15);
}

.form-group {
  margin-bottom: 1.15rem;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.form-control {
  width: 100%;
  background: #070c18;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.15);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-cyan), #0099ff);
  color: #050811;
  font-weight: 800;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}
.btn-primary:hover {
  opacity: 0.92;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==============================================================================
   TERMINAL NAVBAR & TOP STRIP
   ============================================================================== */
.terminal-header {
  background: #090e1c;
  border-bottom: 1px solid var(--border-card);
  padding: 0.85rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.contractor-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

.admin-banner {
  background: linear-gradient(90deg, rgba(255, 184, 0, 0.15), rgba(255, 184, 0, 0.05));
  border-bottom: 1px solid rgba(255, 184, 0, 0.3);
  padding: 0.65rem 0;
  font-size: 0.82rem;
}
.admin-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-header-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-light);
  color: #fff;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-header-action:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==============================================================================
   METRICS & CONTROLS STRIP
   ============================================================================== */
.controls-section {
  padding: 1.5rem 0 1rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.metric-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.metric-num {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  margin-bottom: 0.3rem;
}
.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Tab Filter Bar */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}
.tab-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}
.tab-btn.active {
  background: var(--accent-cyan);
  color: #050811;
  border-color: var(--accent-cyan);
}
.tab-btn.admin-tab.active {
  background: var(--accent-amber);
  color: #050811;
  border-color: var(--accent-amber);
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

/* ==============================================================================
   JOB QUEUE CARDS
   ============================================================================== */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.15rem;
  padding-bottom: 3rem;
}

.job-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}
.job-card:hover {
  border-color: rgba(0, 242, 254, 0.35);
  transform: translateY(-2px);
}

.job-card.claimed {
  border-left: 4px solid var(--accent-cyan);
}
.job-card.critical {
  border-left: 4px solid var(--accent-rose);
}
.job-card.completed {
  opacity: 0.75;
  border-left: 4px solid var(--accent-emerald);
}

.job-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.job-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  display: inline-block;
  text-transform: uppercase;
}
.badge-available {
  background: rgba(0, 245, 155, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(0, 245, 155, 0.3);
}
.badge-claimed {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
}
.badge-broadcast {
  background: rgba(255, 184, 0, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(255, 184, 0, 0.3);
}
.badge-urgent {
  background: rgba(255, 77, 109, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(255, 77, 109, 0.3);
}

.job-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}

.job-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.job-details-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Unlocked Contact Box */
.contact-unlocked-box {
  background: rgba(0, 245, 155, 0.06);
  border: 1px solid rgba(0, 245, 155, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.contact-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.btn-contact {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  border: none;
}
.btn-contact.call {
  background: var(--accent-emerald);
  color: #050811;
}
.btn-contact.wa {
  background: #25d366;
  color: #fff;
}
.btn-contact.map {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-light);
}

/* Card Bottom & Claim Actions */
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light);
  padding-top: 0.85rem;
  gap: 0.65rem;
}
.val-pill {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}
.fee-pill {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.btn-claim-action {
  background: var(--accent-cyan);
  color: #050811;
  font-weight: 800;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn-claim-action:hover {
  opacity: 0.9;
}
.btn-territory-locked {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: not-allowed;
}

/* ==============================================================================
   MODALS
   ============================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-overlay.open {
  display: flex;
}
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.75rem;
}
.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}
.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.2rem;
}

/* BACS Breakdown Box */
.bacs-box {
  background: rgba(0, 242, 254, 0.06);
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.bacs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.bacs-item-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.bacs-item-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.ref-highlight-strip {
  background: #060b17;
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--accent-cyan);
  font-size: 1rem;
}

/* Footer */
.terminal-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-card);
  padding: 1.25rem 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
}
