/* ============================================================
   Explosives Bound Book — Frontend Stylesheet
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --ebb-primary:      #1a3a5c;
  --ebb-primary-dark: #122840;
  --ebb-accent:       #c0392b;
  --ebb-accent-dark:  #962d22;
  --ebb-success:      #27ae60;
  --ebb-warning:      #f39c12;
  --ebb-danger:       #e74c3c;
  --ebb-info:         #2980b9;
  --ebb-muted:        #7f8c8d;
  --ebb-border:       #d1d9e0;
  --ebb-bg:           #f4f6f9;
  --ebb-card:         #ffffff;
  --ebb-text:         #2c3e50;
  --ebb-radius:       6px;
  --ebb-shadow:       0 2px 8px rgba(0,0,0,.1);
}

/* ── Reset / Base ───────────────────────────────────────────── */
.ebb-wrap * { box-sizing: border-box; }
.ebb-wrap { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ebb-text); font-size: 14px; line-height: 1.6; }

/* ── Layout ─────────────────────────────────────────────────── */
.ebb-layout { display: flex; min-height: 100vh; }
.ebb-sidebar { width: 240px; flex-shrink: 0; background: var(--ebb-primary); color: #fff; padding: 0; }
.ebb-main    { flex: 1; padding: 24px; background: var(--ebb-bg); overflow-x: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.ebb-sidebar-header { padding: 20px 16px; background: var(--ebb-primary-dark); border-bottom: 1px solid rgba(255,255,255,.1); }
.ebb-sidebar-header h2 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.8); }
.ebb-sidebar-header .ebb-org-name { font-size: 15px; font-weight: 600; color: #fff; margin-top: 4px; display: block; }
.ebb-sidebar nav ul { list-style: none; margin: 0; padding: 8px 0; }
.ebb-sidebar nav ul li a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: rgba(255,255,255,.75); text-decoration: none; font-size: 13px; font-weight: 500; transition: background .15s, color .15s; }
.ebb-sidebar nav ul li a:hover,
.ebb-sidebar nav ul li a.active { background: rgba(255,255,255,.12); color: #fff; }
.ebb-sidebar nav ul li a .dashicons { font-size: 16px; width: 16px; height: 16px; }
.ebb-sidebar-section { padding: 6px 16px 2px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.4); margin-top: 8px; }
.ebb-sidebar-footer { padding: 12px 16px; font-size: 12px; color: rgba(255,255,255,.4); border-top: 1px solid rgba(255,255,255,.1); }

/* ── Page Header ─────────────────────────────────────────────── */
.ebb-page-header { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.ebb-page-header h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--ebb-primary); }
.ebb-page-header p  { margin: 4px 0 0; color: var(--ebb-muted); font-size: 13px; }

/* ── Cards ───────────────────────────────────────────────────── */
.ebb-card { background: var(--ebb-card); border: 1px solid var(--ebb-border); border-radius: var(--ebb-radius); box-shadow: var(--ebb-shadow); margin-bottom: 20px; }
.ebb-card-header { padding: 14px 20px; border-bottom: 1px solid var(--ebb-border); display: flex; align-items: center; justify-content: space-between; }
.ebb-card-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.ebb-card-body  { padding: 20px; }
.ebb-card-footer{ padding: 12px 20px; background: #fafbfc; border-top: 1px solid var(--ebb-border); border-radius: 0 0 var(--ebb-radius) var(--ebb-radius); }

/* ── Stat Cards (Dashboard) ──────────────────────────────────── */
.ebb-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.ebb-stat-card  { background: var(--ebb-card); border: 1px solid var(--ebb-border); border-radius: var(--ebb-radius); padding: 16px 20px; box-shadow: var(--ebb-shadow); }
.ebb-stat-card .label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ebb-muted); margin-bottom: 6px; }
.ebb-stat-card .value { font-size: 28px; font-weight: 700; color: var(--ebb-primary); line-height: 1; }
.ebb-stat-card .sub   { font-size: 12px; color: var(--ebb-muted); margin-top: 4px; }
.ebb-stat-card.danger { border-left: 4px solid var(--ebb-danger); }
.ebb-stat-card.warning{ border-left: 4px solid var(--ebb-warning); }
.ebb-stat-card.success{ border-left: 4px solid var(--ebb-success); }

/* ── Alerts ──────────────────────────────────────────────────── */
.ebb-alert { padding: 12px 16px; border-radius: var(--ebb-radius); margin-bottom: 16px; font-size: 13px; display: flex; align-items: flex-start; gap: 10px; }
.ebb-alert .dashicons { flex-shrink: 0; margin-top: 1px; }
.ebb-alert-danger  { background: #fdf2f2; border: 1px solid #f5c6cb; color: #7b1e24; }
.ebb-alert-warning { background: #fefaed; border: 1px solid #fce08a; color: #7d5a00; }
.ebb-alert-success { background: #edfaf3; border: 1px solid #a9dfbf; color: #1a5c38; }
.ebb-alert-info    { background: #eaf4fb; border: 1px solid #aed6f1; color: #1a4a6b; }

/* ── Alerts List ─────────────────────────────────────────────── */
.ebb-alerts-list { list-style: none; margin: 0; padding: 0; }
.ebb-alerts-list li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--ebb-border); }
.ebb-alerts-list li:last-child { border-bottom: none; }
.ebb-alert-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ebb-alert-icon.critical { background: #fdf2f2; color: var(--ebb-danger); }
.ebb-alert-icon.high     { background: #fefaed; color: var(--ebb-warning); }
.ebb-alert-icon.medium   { background: #eaf4fb; color: var(--ebb-info); }
.ebb-alerts-list .alert-msg  { font-size: 13px; font-weight: 500; }
.ebb-alerts-list .alert-time { font-size: 11px; color: var(--ebb-muted); margin-top: 2px; }

/* ── Tables ──────────────────────────────────────────────────── */
.ebb-table-wrap { overflow-x: auto; }
table.ebb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ebb-table th { text-align: left; padding: 10px 12px; background: #f0f3f7; border-bottom: 2px solid var(--ebb-border); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ebb-muted); white-space: nowrap; }
table.ebb-table td { padding: 10px 12px; border-bottom: 1px solid var(--ebb-border); vertical-align: middle; }
table.ebb-table tr:hover td { background: #f9fafc; }
table.ebb-table tr:last-child td { border-bottom: none; }
.ebb-table-empty { text-align: center; padding: 32px !important; color: var(--ebb-muted); font-style: italic; }

/* ── Badges ──────────────────────────────────────────────────── */
.ebb-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ebb-badge-success { background: #d5f5e3; color: #1a5c38; }
.ebb-badge-danger  { background: #fdf2f2; color: #7b1e24; }
.ebb-badge-warning { background: #fefaed; color: #7d5a00; }
.ebb-badge-info    { background: #eaf4fb; color: #1a4a6b; }
.ebb-badge-muted   { background: #ecf0f1; color: var(--ebb-muted); }

/* ── Buttons ─────────────────────────────────────────────────── */
.ebb-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--ebb-radius); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: background .15s, box-shadow .15s; line-height: 1.4; }
.ebb-btn-primary { background: var(--ebb-primary); color: #fff; }
.ebb-btn-primary:hover { background: var(--ebb-primary-dark); color: #fff; }
.ebb-btn-danger  { background: var(--ebb-accent); color: #fff; }
.ebb-btn-danger:hover  { background: var(--ebb-accent-dark); color: #fff; }
.ebb-btn-secondary { background: #fff; border-color: var(--ebb-border); color: var(--ebb-text); }
.ebb-btn-secondary:hover { background: #f0f3f7; }
.ebb-btn-success { background: var(--ebb-success); color: #fff; }
.ebb-btn-sm { padding: 5px 10px; font-size: 12px; }
.ebb-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────────── */
.ebb-form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.ebb-form-row.cols-1 { grid-template-columns: 1fr; }
.ebb-form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.ebb-form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.ebb-form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.ebb-field { display: flex; flex-direction: column; gap: 4px; }
.ebb-field label { font-size: 12px; font-weight: 600; color: var(--ebb-text); }
.ebb-field label .req { color: var(--ebb-accent); margin-left: 2px; }
.ebb-field input,
.ebb-field select,
.ebb-field textarea { padding: 8px 10px; border: 1px solid var(--ebb-border); border-radius: var(--ebb-radius); font-size: 13px; width: 100%; transition: border .15s, box-shadow .15s; background: #fff; }
.ebb-field input:focus,
.ebb-field select:focus,
.ebb-field textarea:focus { outline: none; border-color: var(--ebb-primary); box-shadow: 0 0 0 3px rgba(26,58,92,.1); }
.ebb-field input.error,
.ebb-field select.error { border-color: var(--ebb-danger); }
.ebb-field .field-help { font-size: 11px; color: var(--ebb-muted); }
.ebb-field .field-error { font-size: 11px; color: var(--ebb-danger); display: none; }
.ebb-field .field-error.visible { display: block; }
.ebb-field textarea { min-height: 80px; resize: vertical; }

.ebb-form-actions { display: flex; gap: 10px; align-items: center; padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--ebb-border); }
.ebb-form-section { margin-bottom: 24px; }
.ebb-form-section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ebb-muted); margin-bottom: 14px; padding-bottom: 6px; border-bottom: 1px solid var(--ebb-border); }

/* ── FFL Validation Indicator ────────────────────────────────── */
.ebb-ffl-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 8px; border-radius: 20px; margin-top: 4px; }
.ebb-ffl-status.valid    { background: #d5f5e3; color: #1a5c38; }
.ebb-ffl-status.expired  { background: #fefaed; color: #7d5a00; }
.ebb-ffl-status.invalid,
.ebb-ffl-status.not_found{ background: #fdf2f2; color: #7b1e24; }
.ebb-ffl-status.pending  { background: #ecf0f1; color: var(--ebb-muted); }
.ebb-ffl-spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid #ccc; border-top-color: var(--ebb-primary); border-radius: 50%; animation: ebb-spin .6s linear infinite; }
@keyframes ebb-spin { to { transform: rotate(360deg); } }

/* ── Wizard ──────────────────────────────────────────────────── */
.ebb-wizard { max-width: 720px; margin: 0 auto; }
.ebb-wizard-steps { display: flex; margin-bottom: 32px; }
.ebb-wizard-step { flex: 1; text-align: center; position: relative; }
.ebb-wizard-step::after { content: ''; position: absolute; top: 14px; left: 50%; width: 100%; height: 2px; background: var(--ebb-border); z-index: 0; }
.ebb-wizard-step:last-child::after { display: none; }
.ebb-wizard-step .step-num { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ebb-border); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; position: relative; z-index: 1; }
.ebb-wizard-step .step-label { font-size: 11px; color: var(--ebb-muted); margin-top: 6px; display: block; }
.ebb-wizard-step.active .step-num { background: var(--ebb-primary); border-color: var(--ebb-primary); color: #fff; }
.ebb-wizard-step.active .step-label { color: var(--ebb-primary); font-weight: 600; }
.ebb-wizard-step.done .step-num { background: var(--ebb-success); border-color: var(--ebb-success); color: #fff; }

.ebb-wizard-panel { display: none; }
.ebb-wizard-panel.active { display: block; }

/* ── Modals ──────────────────────────────────────────────────── */
.ebb-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9999; align-items: center; justify-content: center; }
.ebb-modal-overlay.open { display: flex; }
.ebb-modal { background: #fff; border-radius: var(--ebb-radius); box-shadow: 0 8px 32px rgba(0,0,0,.2); width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; margin: 20px; }
.ebb-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--ebb-border); display: flex; align-items: center; justify-content: space-between; }
.ebb-modal-header h3 { margin: 0; font-size: 16px; }
.ebb-modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--ebb-muted); padding: 0 4px; line-height: 1; }
.ebb-modal-body   { padding: 20px; }
.ebb-modal-footer { padding: 14px 20px; border-top: 1px solid var(--ebb-border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Tabs ────────────────────────────────────────────────────── */
.ebb-tabs { border-bottom: 2px solid var(--ebb-border); display: flex; gap: 0; margin-bottom: 20px; }
.ebb-tab  { padding: 10px 18px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; background: none; color: var(--ebb-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.ebb-tab:hover  { color: var(--ebb-primary); }
.ebb-tab.active { color: var(--ebb-primary); border-bottom-color: var(--ebb-primary); }
.ebb-tab-panel  { display: none; }
.ebb-tab-panel.active { display: block; }

/* ── Permissions Grid ────────────────────────────────────────── */
.ebb-perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.ebb-perm-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #f9fafc; border: 1px solid var(--ebb-border); border-radius: 4px; }
.ebb-perm-item input[type=checkbox] { width: 14px; height: 14px; flex-shrink: 0; }
.ebb-perm-item label { font-size: 12px; cursor: pointer; margin: 0; }
.ebb-perm-group { margin-bottom: 16px; }
.ebb-perm-group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ebb-primary); margin-bottom: 8px; }

/* ── Login / Auth ────────────────────────────────────────────── */
.ebb-auth-wrap { max-width: 400px; margin: 40px auto; }
.ebb-auth-wrap .ebb-card-header { justify-content: center; }
.ebb-auth-wrap .ebb-card-header h3 { font-size: 18px; }
.ebb-auth-logo { text-align: center; margin-bottom: 20px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ebb-primary); }

/* ── Tier Picker ─────────────────────────────────────────────── */
.ebb-tier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.ebb-tier-card { border: 2px solid var(--ebb-border); border-radius: var(--ebb-radius); padding: 16px 14px; cursor: pointer; text-align: center; transition: border-color .15s, box-shadow .15s; }
.ebb-tier-card:hover { border-color: var(--ebb-primary); }
.ebb-tier-card.selected { border-color: var(--ebb-primary); background: rgba(26,58,92,.04); box-shadow: 0 0 0 3px rgba(26,58,92,.1); }
.ebb-tier-card .tier-name  { font-size: 12px; font-weight: 700; color: var(--ebb-primary); margin-bottom: 6px; }
.ebb-tier-card .tier-range { font-size: 11px; color: var(--ebb-muted); margin-bottom: 10px; }
.ebb-tier-card .tier-price { font-size: 20px; font-weight: 700; color: var(--ebb-text); }
.ebb-tier-card .tier-price sup { font-size: 12px; vertical-align: super; }
.ebb-tier-card .tier-period{ font-size: 11px; color: var(--ebb-muted); }

/* ── Misc ────────────────────────────────────────────────────── */
.ebb-divider { border: none; border-top: 1px solid var(--ebb-border); margin: 20px 0; }
.ebb-spinner-overlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,.7); z-index: 9998; align-items: center; justify-content: center; }
.ebb-spinner-overlay.active { display: flex; }
.ebb-notice { padding: 10px 14px; border-radius: var(--ebb-radius); margin-bottom: 14px; font-size: 13px; }
.ebb-notice-success { background: #edfaf3; border-left: 4px solid var(--ebb-success); color: #1a5c38; }
.ebb-notice-error   { background: #fdf2f2; border-left: 4px solid var(--ebb-danger); color: #7b1e24; }
.ebb-text-muted { color: var(--ebb-muted); }
.ebb-text-danger { color: var(--ebb-danger); }
.ebb-text-right { text-align: right; }
.ebb-mt-0 { margin-top: 0 !important; }
.ebb-mb-0 { margin-bottom: 0 !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ebb-layout { flex-direction: column; }
  .ebb-sidebar { width: 100%; }
  .ebb-form-row.cols-2, .ebb-form-row.cols-3, .ebb-form-row.cols-4 { grid-template-columns: 1fr; }
  .ebb-tier-grid { grid-template-columns: 1fr 1fr; }
  .ebb-stats-grid { grid-template-columns: 1fr 1fr; }
}
