/**
 * WarnIQ App Pages — Shared Styles (Landing-Aligned)
 * Applies to all authenticated / non-public pages.
 * Mirrors design tokens from landing.css for visual consistency.
 * Created: 2026-05-06
 */

/* ===== LAYOUT ===== */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.app-section {
  padding: 2.5rem 0 1.5rem;
}

/* ===== PAGE HEADER ===== */
.app-page-header {
  margin-bottom: 2rem;
  padding-top: 1rem;
}

.app-page-tag {
  font-size: 0.75rem;
  color: #22d3ee;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.app-page-title {
  font-size: 1.625rem;
  font-weight: 500;
  color: #f0f0f0;
  margin: 0;
  line-height: 1.2;
}

.app-page-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.35rem;
}

/* ===== CARDS ===== */
.app-card {
  background: rgba(255, 255, 255, 0.025);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.625rem;
  padding: 1.25rem;
  transition: border-color 0.2s;
  margin-bottom: 1rem;
}

.app-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.app-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.875rem;
  margin-bottom: 0.875rem;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
}

.app-card-title {
  font-size: 1.0625rem;
  font-weight: 500;
  color: #f0f0f0;
  margin: 0;
}

.app-card-action {
  font-size: 0.75rem;
  color: #22d3ee;
  text-decoration: none;
  transition: color 0.2s;
}

.app-card-action:hover {
  color: #06b6d4;
  text-decoration: none;
}

/* ===== METRIC GRID ===== */
.app-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.app-metric {
  background: rgba(255, 255, 255, 0.025);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.625rem;
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.app-metric:hover {
  border-color: rgba(34, 211, 238, 0.2);
}

.app-metric-label {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.app-metric-value {
  font-size: 2rem;
  font-weight: 500;
  color: #f0f0f0;
  line-height: 1.1;
}

.app-metric-sub {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 0.25rem;
}

.app-metric-sub.positive { color: #22c55e; }
.app-metric-sub.negative { color: #ef4444; }
.app-metric-sub.accent   { color: #22d3ee; }

/* ===== TABLE ===== */
.app-table {
  width: 100%;
  border-collapse: collapse;
}

.app-table thead th {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  padding: 0.625rem 0.75rem;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
  text-align: left;
}

.app-table tbody td {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.75rem;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.app-table tbody tr:last-child td {
  border-bottom: none;
}

.app-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.app-table .cell-primary {
  color: #f0f0f0;
  font-weight: 500;
}

.app-table .cell-mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ===== ACTIVITY LIST ===== */
.app-activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.app-activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.04);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
}

.app-activity-item:last-child {
  border-bottom: none;
}

.app-activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.1);
  color: #22d3ee;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.app-activity-content {
  flex: 1;
  min-width: 0;
}

.app-activity-primary {
  color: #f0f0f0;
  font-weight: 500;
}

.app-activity-time {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.25);
  margin-top: 0.15rem;
}

.app-activity-meta {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.3);
  display: flex;
  gap: 0.75rem;
  margin-top: 0.15rem;
  flex-wrap: wrap;
}

.app-activity-item[onclick] {
  cursor: pointer;
}

.app-activity-item[onclick]:hover {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0.5rem;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* ===== BADGES ===== */
.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.app-badge-low    { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.app-badge-medium { background: rgba(234, 179, 8, 0.12); color: #eab308; }
.app-badge-high   { background: rgba(249, 115, 22, 0.12); color: #f97316; }
.app-badge-danger  { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.app-badge-info    { background: rgba(34, 211, 238, 0.12); color: #22d3ee; }
.app-badge-muted   { background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.4); }
.app-badge-admin   { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.app-badge-success { background: rgba(34, 197, 94, 0.12); color: #22c55e; }

/* ===== RISK GRID ===== */
.app-risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.625rem;
}

.app-risk-item {
  background: rgba(255, 255, 255, 0.02);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.5rem;
  padding: 0.875rem;
  text-align: center;
}

.app-risk-label {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.app-risk-value {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #f0f0f0;
}

.app-risk-value.green  { color: #22c55e; }
.app-risk-value.yellow { color: #eab308; }
.app-risk-value.red    { color: #ef4444; }
.app-risk-value.cyan   { color: #22d3ee; }

/* ===== EMPTY STATE ===== */
.app-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
}

.app-empty-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  opacity: 0.35;
}

.app-empty-title {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.25rem;
}

.app-empty-sub {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
}

/* ===== FILTER BAR ===== */
.app-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.app-filter-bar select,
.app-filter-bar input[type="text"],
.app-filter-bar input[type="search"],
.app-filter-bar input[type="date"] {
  background: rgba(255, 255, 255, 0.035);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.375rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  padding: 0.45rem 0.65rem;
  transition: border-color 0.2s;
}

.app-filter-bar select:focus,
.app-filter-bar input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.35);
}

/* ===== BUTTONS ===== */
.app-btn-primary {
  padding: 0.55rem 1.25rem;
  background: #22d3ee;
  color: #000;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.app-btn-primary:hover {
  background: #06b6d4;
  color: #000;
  text-decoration: none;
}

.app-btn-secondary {
  padding: 0.55rem 1.25rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.app-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f0f0f0;
  text-decoration: none;
}

/* ===== GRID HELPERS ===== */
.app-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.app-three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

/* ===== DIVIDER ===== */
.app-divider {
  border: none;
  border-top: 0.5px solid rgba(255, 255, 255, 0.06);
  margin: 1.5rem 0;
}

/* ===== FORM CONTROLS (landing-aligned) ===== */
.app-form-label {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
  display: block;
  font-weight: 500;
}

.app-form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.035);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.375rem;
  color: #f0f0f0;
  font-size: 0.8125rem;
  padding: 0.55rem 0.75rem;
  transition: border-color 0.2s;
}

.app-form-input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.35);
}

.app-form-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-container { padding: 0 1rem; }
  .app-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .app-two-col { grid-template-columns: 1fr; }
  .app-three-col { grid-template-columns: 1fr; }
  .app-risk-grid { grid-template-columns: repeat(2, 1fr); }
  .app-page-title { font-size: 1.375rem; }
  .app-metric-value { font-size: 1.625rem; }

  .app-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .app-metric-grid { grid-template-columns: 1fr; }
  .app-filter-bar { flex-direction: column; align-items: stretch; }
}

/* ==========================================================================
   Bootstrap Modal Overrides (BS JS loaded, but BS CSS is not)
   ========================================================================== */

/* --- Base modal layer --- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1055;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}
.modal.show { display: block; }
.modal.fade .modal-dialog {
  opacity: 0;
  transform: translateY(-1.5rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.modal.show .modal-dialog {
  opacity: 1;
  transform: translateY(0);
}

/* --- Backdrop --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}
.modal-backdrop.fade { opacity: 0; transition: opacity 0.15s ease; }
.modal-backdrop.show { opacity: 1; }

/* --- Dialog centering --- */
.modal-dialog {
  position: relative;
  width: auto;
  max-width: 520px;
  margin: 5rem auto 2rem;
  pointer-events: none;
}
.modal-content {
  pointer-events: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #111214;
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.625rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #f0f0f0;
}

/* --- Header --- */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
}
.modal-title {
  font-size: 1.0625rem;
  font-weight: 500;
  margin: 0;
}

/* --- Body --- */
.modal-body {
  padding: 1.25rem;
}

/* --- Footer --- */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 0.5px solid rgba(255, 255, 255, 0.06);
}

/* --- Close button --- */
.btn-close, .btn-close-white {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  padding: 0.25rem;
  line-height: 1;
}
.btn-close::before, .btn-close-white::before { content: "\00d7"; }
.btn-close:hover, .btn-close-white:hover { color: #f0f0f0; }

/* --- Form controls inside modals --- */
.modal .form-label {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.modal .form-control,
.modal .form-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.375rem;
  color: #f0f0f0;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  transition: border-color 0.15s;
}
.modal .form-control:focus,
.modal .form-select:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.4);
}
.modal .form-text {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.25);
  margin-top: 0.25rem;
}

/* --- Utility classes used by modals --- */
.mb-3 { margin-bottom: 0.75rem; }

/* Responsive display utilities (Bootstrap-style).
   All use !important so they win the cascade regardless of selector specificity.
   Use these to toggle visibility between breakpoints, e.g.:
     <div class="d-none d-lg-block">   visible only on desktop (>=992px)
     <div class="d-block d-lg-none">   visible only on mobile/tablet (<992px) */
.d-none { display: none !important; }
.d-block { display: block !important; }
@media (min-width: 992px) {
  .d-lg-block { display: block !important; }
  .d-lg-none  { display: none !important; }
}
@media (max-width: 991px) {
  .d-none.d-lg-block { display: none !important; }
  .d-block.d-lg-none { display: block !important; }
}

/* --- Alert boxes inside modals --- */
.alert {
  padding: 0.65rem 0.85rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  margin-bottom: 0.75rem;
}
.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 0.5px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 0.5px solid rgba(34, 197, 94, 0.2);
  color: #86efac;
}

/* --- Responsive modal --- */
@media (max-width: 576px) {
  .modal-dialog { margin: 1rem 0.75rem; max-width: none; }
  .modal-body { padding: 1rem; }
}

/* ===== SHARED PAGE HERO (matches landing/auth hero aesthetic) ===== */
.page-hero {
  padding: 4.5rem 1.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.07) 0%, transparent 70%);
  pointer-events: none;
}

.page-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #22d3ee;
  border: 0.5px solid rgba(34, 211, 238, 0.25);
  padding: 0.3rem 0.85rem;
  border-radius: 2rem;
  margin-bottom: 1.5rem;
}

.page-hero-title {
  position: relative;
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #f0f0f0;
  margin: 0 0 1rem;
}

.page-hero .accent-gradient,
.accent-gradient {
  background: linear-gradient(135deg, #22d3ee, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-hero-sub {
  position: relative;
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.5);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.65;
}

@media (max-width: 768px) {
  .page-hero { padding: 3.5rem 1.25rem 1rem; }
  .page-hero-title { font-size: 2rem; }
  .page-hero-sub { font-size: 0.95rem; }
}
