/* ========================================
   BoMaD Design System - Main CSS
   IDR Law Branding
   
   🎨 EASY COLOR CUSTOMIZATION:
   To change the app's colors, edit the variables in:
   design-system/variables.css
   
   Primary (Teal): --color-primary-500 (#00deb2)
   Secondary (Navy): --color-secondary-500 (#253e5d)
   Accent (Yellow): --color-accent-yellow (#e8c855)
   ======================================== */

/* ===== DESIGN SYSTEM FOUNDATION ===== */
@import './design-system/variables.css';
@import './design-system/colors.css';

/* ===== COMPONENT STYLES ===== */
@import './components/buttons.css';
@import './components/cards.css';
@import './components/forms.css';
@import './components/navigation.css';
@import './components/progress.css';

/* ===== UTILITY CLASSES ===== */
@import './utilities/layout.css';

/* ===== THIRD-PARTY IMPORTS ===== */
@import '@fortawesome/fontawesome-free/css/all.css';

/* ===== BASE STYLES ===== */
html, body {
  font-family: var(--font-family-primary);
  color: var(--text-primary);
  background-color: transparent; /* Allow page backgrounds to show through */
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

body {
  padding-bottom: 60px; /* Global padding for nav bar - applies to all pages */
}

* {
  box-sizing: border-box;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 var(--space-md) 0;
}

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

p {
  margin: 0 0 var(--space-md) 0;
  color: var(--text-secondary);
}

a {
  color: var(--color-primary-500);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-600);
  text-decoration: underline;
}

/* ===== LISTS ===== */
ul, ol {
  margin: 0 0 var(--space-md) 0;
  padding-left: var(--space-lg);
}

li {
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}

/* ===== PAGE LAYOUT ===== */
.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent; /* Allow page backgrounds to show through */
}

main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
  background: transparent; /* Allow page backgrounds to show through */
}

.content {
  flex: 1;
  position: relative;
  z-index: 5;
  padding: 0;
  margin: 0;
  background: transparent; /* Allow page backgrounds to show through */
}

.content.with-nav {
  /* Padding handled globally on body element */
  min-height: 100vh; /* Ensure content fills screen */
}

.content.full-height {
  height: 100vh;
  padding-bottom: 0;
}

/* ===== CONTAINER ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-sm {
  max-width: 640px;
}

.container-lg {
  max-width: 1400px;
}

/* ===== SECTION SPACING ===== */
.section {
  padding: var(--space-2xl) 0;
}

.section-sm {
  padding: var(--space-xl) 0;
}

.section-lg {
  padding: var(--space-3xl) 0;
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: var(--z-modal);
  overflow-y: auto;
  padding: var(--space-lg) 0;
  background-color: var(--bg-overlay);
  backdrop-filter: blur(4px);
}

.modal-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
}

.modal-content {
  padding: var(--space-xl);
  border: none !important;
  overflow-y: auto;
  background-color: var(--bg-card);
}

/* ===== FOCUS STYLES ===== */
.btn:focus, 
.btn:active:focus, 
.btn-link:focus, 
.form-input:focus, 
.form-select:focus,
.form-textarea:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

h1:focus {
  outline: none;
}

/* ===== VALIDATION STYLES ===== */
.valid.modified:not([type=checkbox]) {
  outline: 1px solid var(--color-success-500);
}

.invalid {
  outline: 1px solid var(--color-error-500);
}

.validation-message {
  color: var(--color-error-500);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
}

/* ===== ERROR UI ===== */
#blazor-error-ui {
  background: var(--color-warning-50);
  bottom: 0;
  box-shadow: var(--shadow-lg);
  display: none;
  left: 0;
  padding: var(--space-md) var(--space-xl);
  position: fixed;
  width: 100%;
  z-index: var(--z-notification);
  border-top: 2px solid var(--color-warning-500);
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: var(--space-md);
  top: var(--space-md);
  color: var(--color-error-500);
}

.blazor-error-boundary {
  background: var(--color-error-500);
  padding: var(--space-lg);
  color: var(--text-inverse);
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
}

.blazor-error-boundary::after {
  content: "An error has occurred.";
}

/* ===== SAFE AREA SUPPORT ===== */
.status-bar-safe-area {
  display: none;
}

@supports (-webkit-touch-callout: none) {
  .status-bar-safe-area {
    display: flex;
    position: sticky;
    top: 0;
    height: env(safe-area-inset-top);
    background-color: var(--bg-secondary);
    width: 100%;
    z-index: 1;
  }

  .flex-column, .navbar-brand {
    padding-left: env(safe-area-inset-left);
  }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 640px) {
  .content {
    padding: var(--space-md);
  }
  
  .container {
    padding: 0 var(--space-md);
  }
  
  .modal-container {
    margin: var(--space-md);
    max-width: calc(100% - 2rem);
  }
  
  .section {
    padding: var(--space-xl) 0;
  }
}

@media (min-width: 641px) {
  .page {
    flex-direction: row;
  }

  .sidebar {
    width: 250px;
    height: 100vh;
    position: sticky;
    top: 0;
  }
}

/* ===== UTILITY OVERRIDES ===== */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.transition { transition: all var(--transition-normal); }
.transition-fast { transition: all var(--transition-fast); }
.transition-slow { transition: all var(--transition-slow); }

/* ===== PRINT STYLES ===== */
@media print {
  .no-print {
    display: none !important;
  }
  
  .page {
    box-shadow: none;
  }
  
  .sidebar,
  .bottom-nav,
  .top-nav {
    display: none;
  }
}
