/**
 * RiskThing Main Stylesheet
 *
 * This is the master CSS file that:
 * - Imports shared CSS variables from style-variables.css
 * - Provides Bootstrap 5 compatible overrides and extensions
 * - Defines base styles and utilities
 * - Professional styling optimized for desktop-first corporate environments
 *
 * Load Order: Bootstrap 5 → main.css → domain-specific CSS
 */

/* ============================================================================
   IMPORT SHARED VARIABLES
   ============================================================================ */

/* Import all CSS custom properties from the central variables file */
@import url("./domains/style-variables.648f140735dd.css");

/* Toast notifications (marketing + auth shells render Django messages as toasts). */
@import url("./components/toast.a1539a6e94e5.css");

/* ============================================================================
   BOOTSTRAP 5 OVERRIDES & EXTENSIONS
   ============================================================================ */

/*
 * The --bs-* bridge lives in domains/style-variables.css, imported above, and
 * is the single mapping for every surface. Do not reintroduce a copy here: this
 * file is the entry stylesheet for base_marketing.html, account/base_entrance.html,
 * account/base_confirm.html and 429.html only, so a bridge defined here never
 * reaches the app, admin_portal, django-admin or presentation-room stacks.
 * The authoritative list is test_every_bootstrap_template_reaches_the_bridge;
 * re-run it rather than trusting this enumeration.
 */

/* ============================================================================
   BASE STYLES
   ============================================================================ */

/* Global Typography */
body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--surface-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); font-weight: var(--font-weight-medium); }

p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-normal);
}

/* Links */
a {
  color: var(--bs-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover, a:focus {
  color: var(--secondary-indigo);
  text-decoration: underline;
}

/* Code */
code, pre {
  font-family: var(--font-monospace);
}

code {
  background-color: var(--surface-accent);
  color: var(--text-primary);
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875em;
}

/* ============================================================================
   ENHANCED BOOTSTRAP COMPONENTS
   ============================================================================ */

/*
 * The shared compact button treatment lives in domains/style-variables.css so
 * app, marketing, authentication, and admin surfaces receive the same action
 * hierarchy. Do not restate button sizing or colour in this entry stylesheet.
 */

/* Cards - Professional Enhancement */
.card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-base);
  transition: box-shadow var(--transition-base);
  background-color: var(--surface-secondary);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  background-color: var(--surface-accent);
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-4) var(--space-6);
  font-weight: var(--font-weight-medium);
}

.card-body {
  padding: var(--space-6);
}

/* Forms - Professional Enhancement */
.form-control {
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

.form-label {
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

/* Tables - Professional Enhancement */
.table {
  color: var(--text-primary);
}

.table thead th {
  background-color: var(--surface-accent);
  border-bottom: 2px solid var(--border-medium);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: var(--surface-accent);
}

/*
 * Alert colours are not restated here. The bridge in
 * domains/style-variables.css maps each semantic's complete token family, which
 * is what .alert-* actually reads, so alerts render in brand on every surface
 * rather than only on marketing.
 */

/* ============================================================================
   RISK-SPECIFIC COMPONENTS
   ============================================================================ */

/* Risk Matrix */
.risk-matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background-color: var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 400px;
}

.risk-matrix-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-medium);
  color: var(--text-inverse);
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
  position: relative;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.risk-matrix-cell:hover {
  transform: scale(1.05);
  z-index: 1;
}

/* Risk Action Buttons - Use Sparingly */
.btn-risk-critical {
  background-color: var(--risk-critical);
  color: var(--text-inverse);
}

.btn-risk-high {
  background-color: var(--risk-high);
  color: var(--text-inverse);
}

.btn-risk-medium-high {
  background-color: var(--risk-medium-high);
  color: var(--text-inverse);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Spacing Utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Text Utilities */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-hint { color: var(--text-hint); }
.text-inverse { color: var(--text-inverse); }

.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Background Utilities */
.bg-surface-primary { background-color: var(--surface-primary); }
.bg-surface-secondary { background-color: var(--surface-secondary); }
.bg-surface-accent { background-color: var(--surface-accent); }

/* Border Utilities */
.border-light { border-color: var(--border-light); }
.border-medium { border-color: var(--border-medium); }

/* Shadow Utilities */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-base { box-shadow: var(--shadow-base); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ============================================================================
   RESPONSIVE DESIGN - MOBILE COMPATIBILITY
   ============================================================================ */

/* Mobile adaptations while maintaining desktop-first approach */
@media (max-width: 768px) {
  .card-body {
    padding: var(--space-4);
  }

  .risk-matrix {
    max-width: 100%;
  }

  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  .risk-badge {
    border: 1px solid #000;
    background: white !important;
    color: black !important;
  }

  .card {
    border: 1px solid #000;
    box-shadow: none;
  }
}
