/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Arial, sans-serif;
  font-size: 14px;
  background: #f5f5f5;
  color: #333333;
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 220px 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar content";
  min-height: 100vh;
}

/* ── PDS Top bar ──────────────────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  background: linear-gradient(to right, #0075DB, #00427C);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 40px rgba(0,0,0,0.2);
  z-index: 10;
}

/* PDS logo lockup */
.pds-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.pds-p-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.pds-logo-text-wrap {
  display: flex;
  align-items: center;
  gap: 0;
}
.pds-logo-primary {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.1px;
}
.pds-logo-divider {
  color: rgba(255,255,255,0.45);
  margin: 0 8px;
  font-weight: 300;
  font-size: 16px;
}
.pds-logo-secondary {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,0.85);
}

.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-label { font-size: 13px; color: rgba(255,255,255,0.85); }

.btn-settings, .btn-logout {
  padding: 6px 14px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: Arial, sans-serif;
}
.btn-settings { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.btn-settings:hover { background: rgba(255,255,255,0.25); }
.btn-logout { background: transparent; color: rgba(255,255,255,0.85); border: 1px solid rgba(255,255,255,0.25); }
.btn-logout:hover { background: rgba(255,255,255,0.1); }

/* ── PDS Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: #ffffff;
  border-right: 1px solid #e5e5e5;
  padding: 8px 0;
  overflow-y: auto;
}
.sidebar ul { list-style: none; }
.nav-section {
  padding: 16px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #677274;
}
.nav-item {
  padding: 9px 16px;
  color: #333333;
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 13px;
  transition: background 0.1s;
}
.nav-item:hover { background: #F1F4F4; color: #333333; }
.nav-item.active {
  background: #C2E2FF;
  color: #00427C;
  border-left-color: #0075DB;
  font-weight: 600;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.content {
  grid-area: content;
  padding: 28px;
  overflow-y: auto;
  background: #f5f5f5;
}
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; color: #333333; font-weight: 700; }
.subtitle { font-size: 13px; color: #677274; margin-top: 4px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.card {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-top: 3px solid #0075DB;
}
.card.alert { border-top-color: #d0021b; }
.card-label { font-size: 11px; color: #677274; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.card-value { font-size: 26px; font-weight: 700; color: #333333; margin: 8px 0 4px; }
.card-sub { font-size: 12px; color: #677274; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-section {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.table-section h2 { font-size: 15px; margin-bottom: 16px; color: #333333; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  color: #677274;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  border-bottom: 2px solid #e5e5e5;
  background: #F1F4F4;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #F1F4F4; }

.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 700;
}
.status.approved { background: #e6f4ea; color: #2e7d32; }
.status.pending  { background: #fff8e1; color: #f57c00; }
.status.review   { background: #C2E2FF; color: #00427C; }

/* ── Environment banner ───────────────────────────────────────────────────── */
.env-banner {
  margin-top: 24px;
  padding: 12px 18px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  display: none;
}
.env-banner.unprotected {
  display: block;
  background: #fdecea;
  border: 1px solid #f5c6c6;
  color: #b71c1c;
}
.env-banner.protected {
  display: block;
  background: #e6f4ea;
  border: 1px solid #b7dfbf;
  color: #1b5e20;
}

/* ── WAF Demo nav items ───────────────────────────────────────────────────── */
.nav-item.demo-item {
  border-left-color: transparent;
  color: #0075DB;
  font-size: 12px;
}
.nav-item.demo-item:hover { background: #F1F4F4; color: #00427C; }

/* ── Demo modals — shared ─────────────────────────────────────────────────── */
.demo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.demo-modal-wide { width: 720px; }

/* Native <dialog> */
dialog.demo-dialog {
  border: none;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  width: 560px;
  max-width: 95vw;
  padding: 0;
  overflow: hidden;
}
dialog.demo-dialog::backdrop {
  background: rgba(0,0,0,0.55);
}

.demo-dialog-header {
  background: linear-gradient(to right, #0075DB, #00427C);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.demo-dialog-title { flex: 1; font-size: 14px; font-weight: 600; }

.demo-dialog-body { padding: 18px; overflow-y: auto; }

.demo-dialog-footer {
  background: #e8edf4;
  border-top: 1px solid #cdd5e0;
  padding: 7px 16px;
  font-size: 11px;
  color: #666;
  font-family: monospace;
}

/* Badge labels */
.demo-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-right: 4px;
}

/* Method explanation note */
.demo-method-note {
  background: #f0f4fc;
  border-left: 3px solid #2d6ad4;
  border-radius: 0 4px 4px 0;
  padding: 10px 14px;
  font-size: 12px;
  color: #444;
  margin-bottom: 16px;
  line-height: 1.55;
}
.demo-method-note code {
  background: #e0e8f8;
  border-radius: 3px;
  padding: 0 4px;
  font-size: 11px;
}

/* Result feedback */
.demo-result {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.5;
  display: none;
}
.demo-result.demo-result-pending {
  display: block;
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #795400;
}
.demo-result.demo-result-blocked {
  display: block;
  background: #fdecea;
  border: 1px solid #f5c6c6;
  color: #7b1a1a;
}
.demo-result.demo-result-info {
  display: block;
  background: #e8f0fe;
  border: 1px solid #b3c8f5;
  color: #1a3a6b;
}
.demo-result.demo-result-ok {
  display: block;
  background: #e6f4ea;
  border: 1px solid #b7dfbf;
  color: #1b5e20;
}
.demo-result code {
  background: rgba(0,0,0,0.07);
  border-radius: 3px;
  padding: 0 4px;
}

/* Request preview code block */
.demo-code-block {
  margin-top: 10px;
  background: #1a1a2e;
  color: #a8d8a8;
  border-radius: 5px;
  padding: 12px 14px;
  font-family: monospace;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

/* iframe inside modal */
.demo-iframe {
  width: 100%;
  height: 360px;
  border: none;
  border-top: 1px solid #e0e4ec;
  display: block;
}

/* Auth form used in popup-auth.html and demo modals */
.demo-auth-form .form-grid {
  grid-template-columns: 140px 1fr;
}

/* ── Popup styles ─────────────────────────────────────────────────────────── */
body.popup-body {
  display: block;
  background: #f5f6fa;
  min-height: 100vh;
}

.popup-header {
  background: linear-gradient(to right, #0075DB, #00427C);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.popup-title { font-size: 15px; font-weight: 600; flex: 1; }
.btn-close {
  background: transparent;
  border: none;
  color: #a8c0e0;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}
.btn-close:hover { color: #fff; }

.popup-content { padding: 20px; }

.popup-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #dde2ea;
  padding-bottom: 0;
}
.tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab:hover { color: #0075DB; }
.tab.active { color: #0075DB; border-bottom-color: #0075DB; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel h2 { font-size: 16px; margin-bottom: 4px; }
.tab-desc { font-size: 13px; color: #888; margin-bottom: 18px; }

.form-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 10px 16px;
  align-items: center;
  max-width: 600px;
  margin-bottom: 20px;
}
.form-grid label { font-size: 13px; color: #555; font-weight: 500; }
.form-grid input, .form-grid select {
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  width: 100%;
  background: #fff;
}
.form-grid input:focus, .form-grid select:focus {
  outline: none;
  border-color: #0075DB;
  box-shadow: 0 0 0 2px rgba(0,117,219,0.15);
}

.form-actions { display: flex; gap: 10px; margin-bottom: 12px; }
.btn-primary {
  padding: 8px 20px;
  background: #0075DB;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: Arial, sans-serif;
}
.btn-primary:hover { background: #0060b8; }
.btn-secondary {
  padding: 8px 20px;
  background: #fff;
  color: #0075DB;
  border: 1px solid #0075DB;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: Arial, sans-serif;
}
.btn-secondary:hover { background: #C2E2FF; }

.status-msg {
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 13px;
  display: none;
}
.status-msg.success { display: block; background: #e6f4ea; color: #2e7d32; }
.status-msg.error   { display: block; background: #fdecea; color: #b71c1c; }

.popup-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #e8edf4;
  border-top: 1px solid #cdd5e0;
  padding: 6px 20px;
  font-size: 11px;
  color: #888;
  display: flex;
  justify-content: space-between;
}
