/* Custom Base and Print Styles for Midad */

/* Prevent accidental text selections on controls */
button, select, input, .nav-tab {
  -webkit-tap-highlight-color: transparent;
}

button, .nav-tab {
  user-select: none;
}

/* Hide scrollbar for clean horizontal tab lists */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Active navigation tab highlight */
.nav-tab.active {
  color: #C29B38 !important;
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-bottom: 2px solid #C29B38 !important;
}

/* Accountability Status Badges */
.acc-filter-btn.active {
  background-color: #1B365D !important;
  color: #FFFFFF !important;
  border-color: #1B365D !important;
}

/* Wizard Steps Indicator */
.wizard-step-pill.active {
  background-color: #1B365D;
  color: #FFFFFF;
  border-color: #C29B38;
}
.wizard-step-pill.completed {
  background-color: #E8F5E9;
  color: #2D6A4F;
  border-color: #A7F3D0;
}

/* Official Multi-Color Document Canvas & Tables */
.editable-doc-canvas {
  direction: rtl;
  text-align: right;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  line-height: 1.8;
  color: #1E293B;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 0.75rem;
  padding: 1.5rem;
  min-height: 260px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.editable-doc-canvas:focus {
  border-color: #C29B38;
  box-shadow: 0 0 0 2px rgba(194, 155, 56, 0.25);
}

/* Official Saudi Ministry of Education Colored Table Styling */
.official-edu-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  direction: rtl;
  text-align: right;
  border: 1.5px solid #1B365D;
  background-color: #FFFFFF;
  border-radius: 8px;
  overflow: hidden;
}

.official-edu-table thead tr {
  background-color: #1B365D !important;
  color: #FFFFFF !important;
}

.official-edu-table th {
  background-color: #1B365D !important;
  color: #FFFFFF !important;
  font-weight: 700;
  padding: 10px 12px;
  border: 1px solid #2C4C7E;
  font-size: 12px;
}

.official-edu-table td {
  padding: 8px 10px;
  border: 1px solid #CBD5E1;
  font-size: 11px;
  color: #1E293B;
}

.official-edu-table tbody tr:nth-child(even) {
  background-color: #F8FAFC;
}

.official-edu-table tbody tr:hover {
  background-color: #FEF3C7;
}

/* Section Header Ribbons for Exhaustive Plans */
.plan-section-header {
  background: linear-gradient(90deg, #1B365D 0%, #2C4C7E 100%);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 8px;
  border-right: 5px solid #C29B38;
  font-weight: 700;
  font-size: 14px;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

/* QR Code Display Container for Evidence */
.qr-code-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background-color: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.qr-code-box img, .qr-code-box canvas {
  width: 72px !important;
  height: 72px !important;
}

/* Printable Area and PDF Export Layout Optimizations */
#printableDocumentArea {
  direction: rtl;
  text-align: right;
  background-color: #ffffff;
}

#printableDocumentArea table,
#printDocBody table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  direction: rtl;
  text-align: right;
  border: 1.5px solid #1B365D;
}

#printableDocumentArea th,
#printableDocumentArea td,
#printDocBody th,
#printDocBody td {
  border: 1px solid #CBD5E1;
  padding: 8px 10px;
  text-align: right;
  font-size: 11px;
}

#printableDocumentArea th,
#printDocBody th {
  background-color: #1B365D !important;
  color: #FFFFFF !important;
  font-weight: bold;
}

#printableDocumentArea tr:nth-child(even),
#printDocBody tr:nth-child(even) {
  background-color: #F8FAFC;
}

/* Avoid page breaks inside table rows, signatures, and cards */
table, tr, td, th, .signatures, .official-header {
  page-break-inside: avoid !important;
  break-inside: avoid !important;
}

/* App Owner and Security Gate Enhancements */
#systemGateOverlay {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.owner-filter-btn.active {
  background-color: #1B365D !important;
  color: #FFFFFF !important;
}

/* Dual Report Merger Container & Styling */
#modalDualReportMerger textarea {
  font-family: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif;
  line-height: 1.6;
}

#dualMergerRenderedPreview table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 12px 0 !important;
  direction: rtl !important;
  border: 1.5px solid #1B365D !important;
  font-size: 11px !important;
}

#dualMergerRenderedPreview th {
  background-color: #1B365D !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  padding: 8px 10px !important;
  border: 1px solid #2C4C7E !important;
}

#dualMergerRenderedPreview td {
  padding: 6px 8px !important;
  border: 1px solid #CBD5E1 !important;
  color: #1E293B !important;
}

#dualMergerRenderedPreview tr:nth-child(even) {
  background-color: #F8FAFC !important;
}

/* Dedicated High-Fidelity PDF Export Sandbox Styles */
.pdf-export-mode {
  font-family: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif !important;
  direction: rtl !important;
  text-align: right !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  line-height: 1.6 !important;
  color: #0f172a !important;
  background-color: #ffffff !important;
}

.pdf-export-mode * {
  font-family: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
}

.pdf-export-mode table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 10px 0 !important;
  direction: rtl !important;
  border: 1.5px solid #1B365D !important;
}

.pdf-export-mode th,
.pdf-export-mode td {
  border: 1px solid #cbd5e1 !important;
  padding: 6px 8px !important;
  text-align: right !important;
  font-size: 10px !important;
  line-height: 1.5 !important;
}

.pdf-export-mode th {
  background-color: #1B365D !important;
  color: #ffffff !important;
  font-weight: bold !important;
}

.pdf-export-mode tr:nth-child(even) {
  background-color: #F8FAFC !important;
}

/* PRINT MEDIA STYLES - A4 Official Document Layout */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  
  header, nav, .no-print, #toastNotification, .tab-content:not(#printableDocumentArea), #modalOnboarding, #modalAiDraft, #modalSchoolProfile, #modalIndicatorForm, #modalAddEvidence, #modalSwitchSchool {
    display: none !important;
  }
  
  #modalPrintView {
    position: static !important;
    padding: 0 !important;
    background: transparent !important;
    display: block !important;
  }

  #printableDocumentArea {
    padding: 8mm 12mm !important;
    box-shadow: none !important;
    border: none !important;
    min-height: auto !important;
    page-break-after: avoid;
  }

  @page {
    size: A4 portrait;
    margin: 8mm 8mm 8mm 8mm;
  }
}