/* ==========================================================================
   EATERY ESSENTIALS SAFETY & ATTENDANCE CONTROL CENTER - STYLING
   Industrial Quality-System Appearance (Claude-Opus-5 Audit Grade)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@600;700;800&display=swap');

:root {
  /* Industrial Palette Specifications */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-header-bluegray: #D9E2F3;
  --bg-extrusion-blue: #BDD7EE;
  --bg-qc-yellow: #FFF2CC;
  
  --nav-navy: #003E6B;
  --nav-navy-dark: #002847;
  --brand-blue: #005691;
  --brand-green: #00A859;

  --text-dark: #1F2937;
  --text-muted: #4B5563;
  --text-light: #F9FAFB;

  --border-cell: #374151;
  --border-light: #CBD5E1;

  --status-pass: #10B981;
  --status-pass-bg: #DCFCE7;
  --status-violation: #EF4444;
  --status-violation-bg: #FEF2F2;
  --status-warning: #F59E0B;
  --status-warning-bg: #FEF3C7;
  --status-na: #6B7280;
  --status-na-bg: #F3F4F6;

  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: #F1F5F9;
  color: var(--text-dark);
  line-height: 1.4;
  min-height: 100vh;
}

/* Emergency Fire Alarm Top Banner */
.emergency-alarm-banner {
  background: #DC2626;
  color: white;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
  animation: pulseRed 1.5s infinite alternate;
  position: sticky;
  top: 0;
  z-index: 2000;
}

@keyframes pulseRed {
  0% { background-color: #DC2626; }
  100% { background-color: #991B1B; }
}

.alarm-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1700px;
  margin: 0 auto;
}

.alarm-text strong {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  margin-right: 1.5rem;
}

.alarm-actions {
  display: flex;
  gap: 0.75rem;
}

/* Layout Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Desktop Left Navigation Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--nav-navy);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 2px solid var(--nav-navy-dark);
}

.sidebar-header {
  padding: 1.25rem 1rem;
  background-color: var(--nav-navy-dark);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo-svg {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.sidebar-title h2 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
}

.sidebar-title p {
  font-size: 0.72rem;
  color: #93C5FD;
}

.nav-list {
  list-style: none;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  flex-grow: 1;
}

.nav-item button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #D1D5DB;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item button:hover {
  background: rgba(255,255,255,0.1);
  color: #FFFFFF;
}

.nav-item button.active {
  background: var(--brand-blue);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

/* Main Content Shell */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Right User Banner Header */
.top-header {
  background: #FFFFFF;
  border-bottom: 2px solid var(--border-light);
  padding: 0.875rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.page-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--nav-navy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-datetime {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-header-bluegray);
  padding: 4px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-blue);
}

.user-role-tag {
  background: var(--nav-navy);
  color: white;
  font-size: 0.6875rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

/* Main Body Views */
.content-body {
  padding: 1.5rem;
  flex-grow: 1;
  overflow-y: auto;
}

/* Dashboard Command Center KPI Cards */
.dashboard-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.command-kpi-card {
  background: #FFFFFF;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.command-kpi-card.kpi-alert {
  border-color: var(--status-violation);
  background: #FEF2F2;
}

.command-kpi-card.kpi-success {
  border-color: var(--brand-green);
}

.kpi-top-line {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.kpi-big-num {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.kpi-bottom-line {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Outstanding Missing Audits Alert Box */
.missing-audits-banner {
  background: #FEF2F2;
  border: 2px solid var(--status-violation);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.missing-info h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--status-violation);
  margin-bottom: 0.25rem;
}

/* Industrial Grid Table Styling (Matching Excel Form) */
.industrial-table-box {
  background: #FFFFFF;
  border: 2px solid var(--border-cell);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.industrial-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8125rem;
}

.industrial-table th {
  background: var(--bg-header-bluegray);
  color: var(--text-dark);
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  padding: 8px;
  border: 1px solid var(--border-cell);
  text-align: center;
}

.industrial-table td {
  padding: 6px 8px;
  border: 1px solid var(--border-cell);
  vertical-align: middle;
}

/* Row Headers & Categories */
.tr-extrusion-role { background-color: var(--bg-extrusion-blue); font-weight: 700; }
.tr-qc-role { background-color: var(--bg-qc-yellow); font-weight: 700; }

/* Response State Badges */
.badge-pass {
  background: var(--status-pass-bg);
  color: #047857;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #10B981;
}

.badge-violation {
  background: var(--status-violation-bg);
  color: var(--status-violation);
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--status-violation);
}

.badge-na {
  background: var(--status-na-bg);
  color: var(--status-na);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}

.badge-unreviewed {
  background: #FFF;
  color: #9CA3AF;
  border: 1px dashed #CBD5E1;
  padding: 2px 6px;
}

/* Button UI */
.btn-action {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.btn-primary { background: var(--brand-blue); color: white; }
.btn-primary:hover { background: var(--nav-navy); }
.btn-danger { background: var(--status-violation); color: white; }
.btn-success { background: var(--brand-green); color: white; }
.btn-secondary { background: #E2E8F0; color: var(--text-dark); border-color: #CBD5E1; }

/* Modal Overlay & Card */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.modal-card {
  background: #FFFFFF;
  border: 2px solid var(--nav-navy);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Mobile Audit Card UX */
.mobile-card-wrapper {
  background: #FFFFFF;
  border: 2px solid var(--nav-navy);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mobile-card-header {
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.mobile-check-group {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.mobile-check-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.mobile-btn-trio {
  display: flex;
  gap: 0.375rem;
}

.trio-btn {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  cursor: pointer;
  background: white;
}

.trio-btn.active-pass { background: var(--status-pass); color: white; border-color: var(--status-pass); }
.trio-btn.active-violation { background: var(--status-violation); color: white; border-color: var(--status-violation); }
.trio-btn.active-na { background: var(--status-na); color: white; }

/* Print Mode Styling (Landscape 1-to-1 Excel Replication) */
@media print {
  @page {
    size: landscape;
    margin: 0.5in;
  }

  body { background: white !important; color: black !important; }
  .sidebar, .top-header, .no-print, .btn-action, .emergency-alarm-banner { display: none !important; }
  .main-wrapper, .content-body { padding: 0 !important; width: 100% !important; }
  
  .industrial-table-box { border: 2px solid #000 !important; }
  .industrial-table th, .industrial-table td {
    border: 1px solid #000 !important;
    font-size: 8px !important;
    padding: 3px 4px !important;
  }

  .print-footer {
    display: block !important;
    margin-top: 1rem;
    font-size: 8px;
    font-weight: 700;
    text-align: justify;
    border-top: 1px solid #000;
    padding-top: 4px;
  }
}

/* DEDICATED FULL-SCREEN LOGIN LANDING PAGE STYLING */
.login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #001F37 0%, #003E6B 50%, #005691 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 1.5rem;
  overflow-y: auto;
}

.login-card-wrapper {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  border: 3px solid var(--brand-blue);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand-header {
  background: linear-gradient(135deg, #003E6B 0%, #005691 100%);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  border-bottom: 3px solid #00A859;
}

.login-logo-svg {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.login-card-body {
  padding: 2rem;
}

.login-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.875rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.login-profile-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-profile-card:hover {
  border-color: var(--brand-blue);
  background: var(--bg-header-bluegray);
  transform: translateY(-2px);
}

.login-profile-card.selected {
  border-color: var(--brand-blue);
  background: #E0F2FE;
  box-shadow: 0 0 0 3px rgba(0, 86, 145, 0.2);
}

.print-footer { display: none; }

/* Claude AI Copilot Styling */
.btn-ai {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-ai:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4) !important;
}

.ai-msg {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-md);
  max-width: 85%;
  font-size: 0.875rem;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.assistant-msg {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-left: 4px solid #7C3AED;
  align-self: flex-start;
  color: var(--text-dark);
}

.user-msg {
  background: #4F46E5;
  color: #FFFFFF;
  align-self: flex-end;
}

.ai-report-content {
  line-height: 1.6;
  font-size: 0.9375rem;
  color: var(--text-dark);
}

.ai-report-content h1, .ai-report-content h2, .ai-report-content h3 {
  font-family: var(--font-heading);
  color: var(--nav-navy);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.ai-report-content ul, .ai-report-content ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.ai-report-content li {
  margin-bottom: 0.375rem;
}

.ai-report-content blockquote {
  background: #F1F5F9;
  border-left: 4px solid var(--brand-blue);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-style: italic;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
