/* ================================================================
   PortNOC Onboarding Portal — Styles (v2)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Material Icons ─────────────────────────────────────── */
.material-icons {
  vertical-align: middle;
  font-size: inherit;
  line-height: 1;
  user-select: none;
}
.material-icons.icon-sm { font-size: 16px; }
.material-icons.icon-md { font-size: 20px; }
.material-icons.icon-lg { font-size: 32px; }

/* ── Variables ─────────────────────────────────────────── */

:root {
  --shell: #1c2120;
  --card: #ffffff;
  --accent: #2ab85c;
  --accent-hover: #239e4e;
  --heading: #1a3a4b;
  --text: #333;
  --text-light: #666;
  --text-muted: #999;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --bg-light: #f7f8fa;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --warning: #f39c12;
  --info: #3498db;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Reset ─────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--shell);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Utility ───────────────────────────────────────────── */

.hidden { display: none !important; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.mb-4 { margin-bottom: 16px; }

.d-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Navbar ────────────────────────────────────────────── */

.navbar {
  background: var(--shell);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand { display: flex; align-items: center; gap: 12px; }
.navbar-brand img { height: 28px; }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
}

.navbar-user .user-email { font-family: var(--font-mono); font-size: 13px; }

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-logout:hover { border-color: rgba(255,255,255,0.4); color: #fff; }

/* ── Layout ────────────────────────────────────────────── */

.app-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.sidebar {
  width: 240px;
  background: var(--shell);
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 24px 0;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  position: sticky;
  top: 0;
}

.sidebar-nav { list-style: none; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.6);
  font-size: 14px; font-weight: 500;
  transition: all 0.15s; text-decoration: none;
}
.nav-coming-soon > span {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.25);
  font-size: 14px; font-weight: 500;
  cursor: default; user-select: none;
}
.badge-coming-soon {
  font-size: 10px; font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.3);
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-nav a.active { color: var(--accent); background: rgba(42,184,92,0.08); border-right: 3px solid var(--accent); }

.main-content { flex: 1; background: var(--bg-light); padding: 32px; overflow-y: auto; height: 100%; }

/* ── Cards ─────────────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.card-header h2 { color: var(--heading); font-size: 18px; font-weight: 600; }

/* ── Auth / Login page ─────────────────────────────────── */

.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--shell);
}
.auth-card {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 420px;
}
.auth-card .logo { display: flex; justify-content: center; margin-bottom: 32px; }
.auth-card .logo img { height: 36px; }
.auth-card h1 {
  color: var(--heading); font-size: 22px; font-weight: 700;
  text-align: center; margin-bottom: 8px;
}
.auth-card .subtitle { color: var(--text-light); text-align: center; font-size: 14px; margin-bottom: 28px; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0; color: var(--text-muted); font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Forms ─────────────────────────────────────────────── */

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--heading); margin-bottom: 6px; font-family: var(--font-mono);
}

.form-control {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px;
  color: var(--text); background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42,184,92,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-control-sm { padding: 6px 10px; font-size: 13px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* Field-level validation error */
.field-error { border-color: var(--danger) !important; }
.field-error:focus { box-shadow: 0 0 0 3px rgba(231,76,60,0.15) !important; }

/* ── Checkboxes ────────────────────────────────────────── */

.checkbox-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 14px;
}
.checkbox-label input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer;
}

/* ── Buttons ───────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-light); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline:hover:not(:disabled) { background: rgba(42,184,92,0.08); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Stepper ───────────────────────────────────────────── */

.stepper {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 0; margin-bottom: 32px; padding: 0;
}

.stepper-step {
  display: flex; flex-direction: column; align-items: center; gap: 0;
}

.stepper-circle {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  border: 2px solid var(--border); color: var(--text-muted);
  background: #fff; transition: all 0.2s; flex-shrink: 0;
}
.stepper-step.active .stepper-circle {
  border-color: var(--accent); background: var(--accent); color: #fff;
}
.stepper-step.completed .stepper-circle {
  border-color: var(--accent); background: var(--accent); color: #fff;
}

.stepper-label {
  font-size: 11px; color: var(--text-muted); margin-top: 6px;
  text-align: center; white-space: nowrap;
  font-family: var(--font-mono);
}
.stepper-step.active .stepper-label { color: var(--accent); font-weight: 600; }
.stepper-step.completed .stepper-label { color: var(--accent); }

.stepper-line {
  width: 36px; height: 2px; background: var(--border);
  transition: background 0.2s; margin-top: 17px;
}
.stepper-step.completed + .stepper-line,
.stepper-line.completed { background: var(--accent); }

/* ── Stat tiles ────────────────────────────────────────── */

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-tile {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 20px;
}
.stat-tile .stat-value {
  font-size: 32px; font-weight: 700; color: var(--heading); font-family: var(--font-mono);
}
.stat-tile .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

/* ── Tables ────────────────────────────────────────────── */

.table-wrapper, .table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.5px;
  font-family: var(--font-mono); border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-light); }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--bg-light); }

/* Inline-editable VLAN table */
.data-table { min-width: 900px; }
.data-table input.form-control-sm {
  min-width: 70px; padding: 5px 8px; font-size: 12px; border-radius: 4px;
}
.data-table td { padding: 6px 4px; vertical-align: middle; }
.data-table th { padding: 8px 4px; font-size: 10px; }

/* ── Badges ────────────────────────────────────────────── */

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; font-family: var(--font-mono);
  text-transform: lowercase;
}
.badge-new { background: #f0f0f0; color: #888; }
.badge-draft { background: #e9ecef; color: #495057; }
.badge-submitted { background: #e8f4fd; color: #2980b9; }
.badge-under_review { background: #fef9e7; color: #d68910; }
.badge-pending_documents { background: #fef9e7; color: #d68910; }
.badge-approved { background: #eafaf1; color: #27ae60; }
.badge-rejected { background: #fdedec; color: #e74c3c; }
.badge-archived { background: #eee; color: #666; }

/* ── Toasts ────────────────────────────────────────────── */

.toast-container {
  position: fixed; top: 72px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease; max-width: 400px;
}
.toast-success { background: var(--accent); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--info); color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Modal ─────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 200; display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 28px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
}
.modal h2 { color: var(--heading); font-size: 18px; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 24px; }
.modal-actions .btn { flex-shrink: 0; width: auto; }

/* modal-card pattern (with header/body/footer sections) */
.modal-card {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h2, .modal-header h3 { margin: 0; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px; padding: 4px 6px;
  border-radius: 4px; line-height: 1; display: flex; align-items: center;
}
.modal-close:hover { background: var(--bg-alt, #f8fafc); color: var(--heading); }
.modal-card .modal-actions {
  padding: 14px 24px; border-top: 1px solid var(--border);
  margin: 0; flex-shrink: 0;
}

/* ── File Upload Zone ──────────────────────────────────── */

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: all 0.2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent); background: rgba(42,184,92,0.04);
}
.upload-zone p { color: var(--text-light); font-size: 14px; margin-top: 8px; }
.upload-zone .upload-icon { font-size: 36px; color: var(--text-muted); }

.file-list { margin-top: 16px; }
.file-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg-light); border-radius: var(--radius);
  margin-bottom: 8px; font-size: 13px; gap: 12px;
}
.file-item .file-name { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }
.file-item .btn-remove {
  background: none; border: none; color: var(--danger);
  cursor: pointer; font-size: 16px; padding: 2px 6px; flex-shrink: 0;
}

/* ── Pagination ────────────────────────────────────────── */

.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 24px;
}
.pagination button {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; cursor: pointer; font-size: 13px; transition: all 0.15s;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-light); font-family: var(--font-mono); }

/* ── Contact cards ─────────────────────────────────────── */

.contact-card { position: relative; }

/* ── Location cards (Step 3) ───────────────────────────── */

.location-card { transition: box-shadow 0.15s; }
.location-card:hover { box-shadow: var(--shadow-lg); }

.loc-card-body { transition: max-height 0.3s ease; }
.loc-card-body.hidden { display: none; }

.loc-validation-summary {
  margin-top: 12px; padding: 10px 14px;
  background: #fef9e7; border-radius: var(--radius);
  font-size: 13px; color: #856404;
}

/* ── Validation banners ────────────────────────────────── */

.validation-banner {
  padding: 14px 18px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.5;
}
.validation-banner ul { margin: 8px 0 0 18px; }
.validation-banner li { margin-bottom: 4px; }
.validation-error { background: #fdedec; color: #c0392b; border: 1px solid #f5c6cb; }
.validation-warning { background: #fef9e7; color: #856404; border: 1px solid #ffeeba; }

/* ══════════════════════════════════════════════════════════
   PER-LOCATION DETAILS (Step 5)
   ══════════════════════════════════════════════════════════ */

.location-detail-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  min-height: 400px;
}

/* Location sidebar / picker */
.location-sidebar {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  align-self: start;
  position: sticky;
  top: 80px;
}

.location-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--heading);
}

.location-picker-list {
  list-style: none;
  max-height: 420px;
  overflow-y: auto;
}

.location-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
  border-left: 3px solid transparent;
}
.location-picker-item:hover { background: var(--bg-light); }
.location-picker-item.active {
  background: rgba(42,184,92,0.06);
  border-left-color: var(--accent);
  font-weight: 600;
}

.location-sidebar-legend {
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.legend-complete { background: var(--accent); }
.legend-partial { background: var(--warning); }
.legend-empty { background: var(--border); }

.loc-picker-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Location detail main */
.location-detail-main { min-width: 0; }

/* Tab bar */
.loc-tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 2px solid var(--border-light);
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0 8px;
}

.loc-tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -2px;
}
.loc-tab:hover { color: var(--text); }
.loc-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.loc-tab-panel {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  margin-top: 0;
}

/* ISP cards */
.isp-card {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
}

/* ── Review sections ───────────────────────────────────── */

.review-section { margin-bottom: 16px; }

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.review-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.review-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.review-value {
  font-size: 14px;
  color: var(--text);
}

.review-contact {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}
.review-contact:last-child { border-bottom: none; }

.review-location {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.review-location:last-child { border-bottom: none; }

/* ── Empty state ───────────────────────────────────────── */

.empty-state {
  text-align: center;
}

/* ── Form container (responsive width) ─────────────────── */

.form-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 16px;
  transition: max-width 0.3s ease;
}
.form-container.wide {
  max-width: 1200px;
}

/* ── Save indicator ────────────────────────────────────── */

.save-indicator {
  font-size: 12px;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: 4px;
  transition: opacity 0.5s;
}
.save-indicator.saving { color: rgba(255,255,255,0.6); }
.save-indicator.saved { color: var(--accent); }
.save-indicator.error { color: var(--danger); }
.save-indicator.fade { opacity: 0.3; }

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .location-detail-layout { grid-template-columns: 1fr; }
  .location-sidebar {
    position: static;
    margin-bottom: 16px;
  }
  .location-picker-list { max-height: 200px; }
  .stepper-line { width: 20px; }
  .stepper-label { font-size: 9px; }
  .loc-tab { padding: 10px 12px; font-size: 12px; }
  .data-table { font-size: 12px; }
}

@media (max-width: 480px) {
  .stepper-label { display: none; }
  .navbar { padding: 0 12px; }
  .card { padding: 16px; }
  .btn-group { flex-direction: column; }
}
