/* Design System CSS - Heading Standards and Utilities */
/* This file contains all standardized heading styles and Tailwind-like utilities */

/* ===== HEADING TYPOGRAPHY SYSTEM ===== */

/* CSS variables for standardized page headings */
:root {
  --page-title-size: 1.875rem; /* 30px */
  --page-title-line-height: 2.25rem; /* 36px */
  --page-title-weight: 700;
  --page-title-color: #111827; /* gray-900 */
  --page-title-margin-bottom: 0.5rem; /* 8px */
}

/* Base heading styles - apply to all headings for consistency */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: inherit;
  color: inherit;
}

/* H1 - Page Titles */
.text-3xl {
  font-size: 1.875rem; /* 30px */
  line-height: 2.25rem; /* 36px */
}

/* H2 - Section Titles */  
.text-2xl {
  font-size: 1.5rem; /* 24px */
  line-height: 2rem; /* 32px */
}

/* H3 - Subsection Titles */
.text-xl {
  font-size: 1.25rem; /* 20px */
  line-height: 1.75rem; /* 28px */
}

/* H4 - Component Titles */
.text-lg {
  font-size: 1.125rem; /* 18px */
  line-height: 1.75rem; /* 28px */
}

/* H5 - Minor Headings */
.text-base {
  font-size: 1rem; /* 16px */
  line-height: 1.5rem; /* 24px */
}

/* H6 - Micro Headings */
.text-sm {
  font-size: 0.875rem; /* 14px */
  line-height: 1.25rem; /* 20px */
}

/* Extra small text */
.text-xs {
  font-size: 0.75rem; /* 12px */
  line-height: 1rem; /* 16px */
}

/* ===== FONT WEIGHTS ===== */
.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

.font-normal {
  font-weight: 400;
}

/* ===== TEXT COLORS ===== */
.text-gray-900 {
  color: #111827;
}

.text-gray-800 {
  color: #1f2937;
}

.text-gray-700 {
  color: #374151;
}

.text-gray-600 {
  color: #4b5563;
}

.text-gray-500 {
  color: #6b7280;
}

.text-gray-400 {
  color: #9ca3af;
}

.text-foreground {
  color: var(--foreground, #111827);
}

.text-default-600 {
  color: var(--default-600, #4b5563);
}

.text-default-500 {
  color: var(--default-500, #6b7280);
}

/* ===== STANDARDIZED HEADING CLASSES ===== */

/* Standardized Page Heading (applies across all pages) */
/* Usage: add class="page-heading" to your main H1, or use the .page-header pattern */
.page-heading,
.page-header-content h1,
.page-title,
.title-large,
.header .header-title,
.header-title,
/* Common existing patterns */
h1.text-3xl,
h1.text-2xl,
/* Generic fallback: first H1 inside main */
main h1:first-of-type,
/* Specific legacy titles */
.login-title {
  font-size: var(--page-title-size, 1.875rem);
  line-height: var(--page-title-line-height, 2.25rem);
  font-weight: var(--page-title-weight, 700);
  color: var(--page-title-color, #111827);
  margin-bottom: var(--page-title-margin-bottom, 0.5rem);
}

/* Section Title - H2 */
.section-title {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1rem;
}

/* Card Title - H3 */
.card-title {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.75rem;
}

/* Component Title - H4 */
.component-title {
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

/* Minor Heading - H5 */
.minor-heading {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 0.5rem;
}

/* Micro Heading - H6 */
.micro-heading {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

/* ===== SPECIALIZED HEADING PATTERNS ===== */

/* Page Header Pattern */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .page-header-actions {
    align-items: center;
  }
}

.page-header-content h1 {
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.5rem;
}

.page-header-content p {
  color: #4b5563;
}

.page-header-actions {
  display: flex;
  gap: 0.5rem;
}

/* Card Header Pattern */
.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--divider, #e5e7eb);
}

.card-header h2,
.card-header h3 {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

/* Generic card container and body to standardize layout */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.card-body {
  padding: 1.5rem;
}

/* Ghost back button used in page headers */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  color: #374151;
  border-radius: 0.375rem;
  background: #ffffff;
}

.btn-back:hover {
  background: #f9fafb;
}

/* ===== BUTTONS (Shared) ===== */
/* Minimal, app-wide button styles to unify look & feel */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border: 1px solid transparent;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

/* Royal Blue primary (per request) */
.btn-primary {
  background: #4169E1; /* RoyalBlue */
  color: #ffffff;
}
.btn-primary:hover { background: #3157c9; }
.btn-primary:focus { outline: 2px solid #3157c9; outline-offset: 2px; }

.btn-outline {
  background: #ffffff;
  color: #374151;
  border-color: #e5e7eb;
}
.btn-outline:hover { background: #f9fafb; }

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}
.btn-secondary:hover { background: #e5e7eb; }

/* Section Header with Icon */
.section-header-with-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

/* Table Header Pattern */
.table-header {
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

/* Text transforms */
.uppercase {
  text-transform: uppercase;
}

.lowercase {
  text-transform: lowercase;
}

.capitalize {
  text-transform: capitalize;
}

/* Letter spacing */
.tracking-wide {
  letter-spacing: 0.025em;
}

.tracking-wider {
  letter-spacing: 0.05em;
}

.tracking-widest {
  letter-spacing: 0.1em;
}

/* Margin utilities for headings */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

/* ===== RESPONSIVE HEADING ADJUSTMENTS ===== */

/* Mobile-first responsive headings */
@media (max-width: 640px) {
  .text-3xl {
    font-size: 1.5rem; /* 24px on mobile */
    line-height: 2rem; /* 32px */
  }
  
  .text-2xl {
    font-size: 1.25rem; /* 20px on mobile */
    line-height: 1.75rem; /* 28px */
  }
  
  .page-title,
  .page-heading,
  .page-header-content h1,
  .title-large,
  .header .header-title,
  .header-title,
  h1.text-3xl,
  h1.text-2xl,
  main h1:first-of-type,
  .login-title {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  
  .section-title {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .page-title,
  .section-title,
  .card-title {
    color: #000 !important;
  }
  
  .text-gray-900,
  .text-gray-700,
  .text-gray-600 {
    color: #000 !important;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Focus styles for heading links */
h1 a:focus,
h2 a:focus,
h3 a:focus,
h4 a:focus,
h5 a:focus,
h6 a:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 0.125rem;
}

/* Ensure proper contrast ratios */
@media (prefers-contrast: high) {
  .text-gray-500,
  .text-gray-400 {
    color: #374151;
  }
  
  .text-default-600,
  .text-default-500 {
    color: #374151;
  }
}

/* ===== COMPONENT-SPECIFIC HEADING STYLES ===== */

/* Dashboard card statistics headings */
.stat-card h3 {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-card .stat-description {
  font-size: 0.875rem;
  line-height: 1.25rem;
  opacity: 0.75;
}

/* Navigation headings */
.nav-section-title {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  padding: 0 1rem;
}

/* Form section headings */
.form-section-title {
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.form-section-title:first-child {
  margin-top: 0;
}

/* Modal headings */
.modal-title {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

/* ===== MODAL CENTERING ===== */
/* Global rule: All modals should be centered on the page */
/* Modals typically have: fixed position, full viewport overlay, and flex centering */

/* Standard modal overlay pattern */
[class*="modal"][class*="fixed"],
.modal-overlay,
div[id*="Modal"][class*="fixed"],
div[id*="modal"][class*="fixed"] {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 50 !important;
}

/* Ensure modal content doesn't inherit centering */
[class*="modal"][class*="fixed"] > div,
.modal-overlay > div,
div[id*="Modal"][class*="fixed"] > div,
div[id*="modal"][class*="fixed"] > div {
  position: relative !important;
  margin: auto !important;
}

/* Hidden modals should use display: none, not flex */
[class*="modal"][class*="fixed"].hidden,
.modal-overlay.hidden,
div[id*="Modal"][class*="fixed"].hidden,
div[id*="modal"][class*="fixed"].hidden {
  display: none !important;
}

/* ===== LAYOUT CONTAINERS ===== */
/* Make main full-width; use .page-container-95 inside pages to control width */
main {
  width: 100% !important;
  margin: 0;
  box-sizing: border-box;
}

.page-container-95 {
  width: 95% !important;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ===== LEGACY SUPPORT ===== */

/* Support for existing class names that might be in use */
.title-large {
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  color: #111827;
}

.title-medium {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  color: #111827;
}

.title-small {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #111827;
}

.subtitle {
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #374151;
}

.caption {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Override any conflicting styles */
.heading-reset {
  margin: 0 !important;
  padding: 0 !important;
  font-weight: inherit !important;
  color: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}
/* =====
 BOOLEAN FEEDBACK COMPONENTS ===== */

/* Page heading styles */
.page-heading {
  font-size: 2.5rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
}

/* Style selector for boolean feedback */
.feedback-style-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.25rem;
  background-color: #f3f4f6;
  border-radius: 0.5rem;
}

.style-option {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s ease;
}

.style-option:hover {
  background-color: #e5e7eb;
  color: #374151;
}

.style-option.active {
  background-color: #3b82f6;
  color: white;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Toggle Switch Style */
.boolean-toggle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.boolean-toggle {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
  cursor: pointer;
}

.boolean-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.boolean-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.boolean-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.boolean-input:checked + .boolean-slider {
  background-color: #3b82f6;
}

.boolean-input:focus + .boolean-slider {
  box-shadow: 0 0 1px #3b82f6;
}

.boolean-input:checked + .boolean-slider:before {
  transform: translateX(26px);
}

.boolean-labels {
  display: flex;
  gap: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.boolean-off-label,
.boolean-on-label {
  color: #6b7280;
  transition: color 0.2s ease;
}

.boolean-input:not(:checked) ~ .boolean-labels .boolean-off-label,
.boolean-input:checked ~ .boolean-labels .boolean-on-label {
  color: #3b82f6;
  font-weight: 600;
}

/* Slider Style */
.boolean-slider-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.slider-track {
  position: relative;
  width: 200px;
  height: 40px;
  background-color: #f3f4f6;
  border-radius: 20px;
  cursor: pointer;
  overflow: hidden;
}

.boolean-range-input {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.slider-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background-color: #3b82f6;
  transition: width 0.3s ease;
  border-radius: 20px;
}

.slider-thumb {
  position: absolute;
  top: 4px;
  width: 32px;
  height: 32px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: left 0.3s ease;
  transform: translateX(-50%);
  z-index: 1;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  width: 200px;
  font-size: 0.875rem;
  font-weight: 500;
}

.slider-off-label,
.slider-on-label {
  color: #6b7280;
  transition: color 0.2s ease;
}

.slider-off-label.active,
.slider-on-label.active {
  color: #3b82f6;
  font-weight: 600;
}

/* Button Style */
.boolean-buttons-container {
  display: flex;
  gap: 0.5rem;
  background-color: #f3f4f6;
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.boolean-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s ease;
  min-width: 80px;
}

.boolean-btn:hover {
  background-color: #e5e7eb;
  color: #374151;
}

.boolean-btn.active {
  background-color: #3b82f6;
  color: white;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.boolean-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* PM Template Integration Styles */
.pm-boolean-feedback {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  background-color: #fafafa;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.feedback-label {
  font-weight: 600;
  color: #374151;
  font-size: 1rem;
}

.required-indicator {
  color: #ef4444;
  font-weight: bold;
}

.feedback-help {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.75rem;
  font-style: italic;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Responsive design */
@media (max-width: 640px) {
  .boolean-labels,
  .slider-labels {
    font-size: 0.75rem;
  }
  
  .slider-track {
    width: 160px;
  }
  
  .slider-labels {
    width: 160px;
  }
  
  .boolean-btn {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    min-width: 60px;
  }
  
  .demo-grid {
    grid-template-columns: 1fr;
  }
}