/* CSS Design System - Safety Training Portal (Business Minimal Edition) */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --border-radius-sm: 4px;
  --border-radius-md: 6px;
  --border-radius-lg: 8px;
  
  /* Strict Business Light Theme Palette */
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #334155;
  --text-muted: #64748b;
  --text-light: #0f172a;
  
  --primary-color: #0284c7; /* Business Blue */
  --primary-hover: #0369a1;
  --hover-bg: #f1f5f9;
  --input-bg: #ffffff;
  
  --color-blue: #0284c7;
  --color-blue-hover: #0369a1;
  --color-green: #15803d; /* Flat Green */
  --color-green-hover: #166534;
  --color-red: #b91c1c; /* Flat Red */
  --color-red-hover: #991b1b;
  --color-amber: #b45309; /* Flat Amber */
  --color-amber-hover: #92400e;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

/* Optional Dark Theme (Strict minimal dark) */
body.dark-theme {
  --bg-app: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --border-color: #334155;
  --text-main: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #f8fafc;
  
  --primary-color: #38bdf8;
  --primary-hover: #0ea5e9;
  --hover-bg: rgba(255, 255, 255, 0.06);
  --input-bg: #0f172a;
  
  --color-blue: #38bdf8;
  --color-green: #4ade80;
  --color-red: #f87171;
  --color-amber: #fbbf24;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

/* Base Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

input, select, textarea, button {
  font-family: inherit;
  color: inherit;
}

/* Application Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: all var(--transition-normal);
}

.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  color: var(--primary-color);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.2px;
}

.brand-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 8px;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-light);
  background-color: var(--hover-bg);
}

.nav-link.active {
  color: var(--primary-color);
  background-color: var(--hover-bg);
  font-weight: 600;
  border-left: 3px solid var(--primary-color);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background-color: var(--hover-bg);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  background-color: var(--primary-color);
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Main Content Wrapper */
.main-wrapper {
  margin-left: 250px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.header {
  height: 60px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-sidebar);
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 6px 12px;
  width: 320px;
}

.header-search:focus-within {
  border-color: var(--primary-color);
}

.search-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2.5;
}

.header-search input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-light);
}

.badge-notification {
  position: relative;
  cursor: pointer;
  color: var(--text-muted);
}

.badge-notification:hover {
  color: var(--text-light);
}

.notification-indicator {
  position: absolute;
  top: -3px;
  right: -3px;
  background-color: var(--color-red);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.current-date {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Content Container */
.content-container {
  padding: 24px;
  flex: 1;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-light);
}

.section-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Flat Panels and Cards */
.glass-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.glass-panel:hover {
  box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--hover-bg);
}

body.dark-theme .btn-secondary {
  background-color: var(--bg-card);
}

.btn-danger {
  background-color: var(--color-red);
  color: white;
}

.btn-danger:hover {
  background-color: var(--color-red-hover);
}

.btn-large {
  padding: 10px 20px;
  font-size: 0.95rem;
}

/* KPI Cards Layout */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon.color-blue { background-color: #e0f2fe; color: #0369a1; }
.kpi-icon.color-green { background-color: #dcfce7; color: #15803d; }
.kpi-icon.color-red { background-color: #fee2e2; color: #b91c1c; }
.kpi-icon.color-amber { background-color: #fef3c7; color: #b45309; }

body.dark-theme .kpi-icon.color-blue { background-color: rgba(56, 189, 248, 0.15); }
body.dark-theme .kpi-icon.color-green { background-color: rgba(74, 222, 128, 0.15); }
body.dark-theme .kpi-icon.color-red { background-color: rgba(248, 113, 113, 0.15); }
body.dark-theme .kpi-icon.color-amber { background-color: rgba(251, 191, 36, 0.15); }

.kpi-content {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-light);
  line-height: 1.2;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.text-red {
  color: var(--color-red) !important;
}

/* Dashboard Panel Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.col-8 { grid-column: span 8; }
.col-4 { grid-column: span 4; }
.mt-4 { margin-top: 20px; }
.mt-2 { margin-top: 10px; }

.dashboard-panel {
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-light);
}

.panel-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.panel-body {
  padding: 16px 20px;
  flex: 1;
}

/* Chart Styles */
.chart-body {
  min-height: 200px;
}

.svg-chart-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 500;
}

.chart-bar-title {
  color: var(--text-main);
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-bar-pct {
  font-weight: 600;
  color: var(--text-light);
}

.chart-bar-outer {
  height: 6px;
  background-color: var(--hover-bg);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.chart-bar-inner {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: var(--border-radius-sm);
  transition: width 0.8s ease;
}

/* Alert list */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-app);
}

.alert-item.danger {
  border-left: 3px solid var(--color-red);
}

.alert-item.warning {
  border-left: 3px solid var(--color-amber);
}

.alert-item-icon {
  margin-top: 1px;
}

.alert-item-icon.red { color: var(--color-red); }
.alert-item-icon.amber { color: var(--color-amber); }

.alert-item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alert-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
}

.alert-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Tables styling */
.table-container {
  overflow: visible !important;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  vertical-align: middle;
}

.data-table th {
  font-weight: 600;
  color: white !important;
  background-color: #00875a !important;
  text-transform: none;
  font-size: 0.8rem;
  letter-spacing: 0.2px;
  position: sticky;
  top: 58px;
  z-index: 10;
}

.table-dept-group-header td {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f0fe 100%) !important;
  color: #1e40af !important;
  font-weight: 700;
  padding: 8px 14px !important;
  font-size: 0.82rem;
  border-bottom: 2px solid #bfdbfe !important;
  border-left: 3px solid #3b82f6 !important;
}

body.dark-theme .table-dept-group-header td {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  color: #93c5fd !important;
  border-bottom: 2px solid #1e3a5f !important;
  border-left: 3px solid #3b82f6 !important;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: rgba(0, 135, 90, 0.04);
}

body.dark-theme .data-table tbody tr:hover {
  background-color: rgba(0, 135, 90, 0.08);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Employee row styles */
.emp-row-untrained {
  border-left: 3px solid var(--color-red) !important;
  animation: soft-pulse-red 3s infinite ease-in-out;
}

@keyframes soft-pulse-red {
  0%, 100% {
    background-color: rgba(185, 28, 28, 0.02);
  }
  50% {
    background-color: rgba(185, 28, 28, 0.09);
  }
}

.emp-row-untrained:hover {
  animation: none;
  background-color: rgba(185, 28, 28, 0.12) !important;
}

body.dark-theme .emp-row-untrained {
  animation: soft-pulse-red-dark 3s infinite ease-in-out;
}

@keyframes soft-pulse-red-dark {
  0%, 100% {
    background-color: rgba(239, 68, 68, 0.03);
  }
  50% {
    background-color: rgba(239, 68, 68, 0.12);
  }
}

body.dark-theme .emp-row-untrained:hover {
  animation: none;
  background-color: rgba(239, 68, 68, 0.15) !important;
}

.emp-row-trained {
  border-left: 3px solid transparent;
}

/* Cell-specific styling */
.cell-num {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.cell-name strong {
  font-weight: 600;
  color: var(--text-color);
  letter-spacing: -0.01em;
}

.cell-position {
  color: var(--text-light);
  font-size: 0.82rem;
}

.cell-snils {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  color: var(--text-light);
  letter-spacing: 0.5px;
}

.cell-date {
  color: var(--text-light);
  font-size: 0.82rem;
  white-space: nowrap;
}

.cell-status {
  text-align: center;
}

.cell-actions {
  text-align: center;
}

.actions-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.status-pill:hover {
  transform: scale(1.03);
}

.status-pill svg {
  flex-shrink: 0;
}

.status-pill.status-success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

body.dark-theme .status-pill.status-success {
  background-color: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.25);
}

.status-pill.status-danger {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  animation: pulse-danger 2.5s infinite ease-in-out;
}

body.dark-theme .status-pill.status-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.25);
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0); }
  50% { box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1); }
}

/* Legacy blink-red-row compatibility */
.blink-red-row {
  border-left: 3px solid var(--color-red) !important;
  background-color: rgba(185, 28, 28, 0.03);
}

body.dark-theme .blink-red-row {
  background-color: rgba(239, 68, 68, 0.05);
}

@keyframes pulse-badge {
  from { opacity: 0.7; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1.03); }
}

.blink-badge {
  animation: pulse-badge 0.6s infinite alternate ease-in-out;
  box-shadow: 0 0 6px rgba(185, 28, 28, 0.2);
}


/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  text-transform: uppercase;
}

.badge-success { background-color: #dcfce7; color: #15803d; }
.badge-warning { background-color: #fef3c7; color: #b45309; }
.badge-danger { background-color: #fee2e2; color: #b91c1c; }
.badge-info { background-color: #e0f2fe; color: #0369a1; }

body.dark-theme .badge-success { background-color: rgba(74, 222, 128, 0.15); color: #4ade80; }
body.dark-theme .badge-warning { background-color: rgba(251, 191, 36, 0.15); color: #fbbf24; }
body.dark-theme .badge-danger { background-color: rgba(248, 113, 113, 0.15); color: #f87171; }
body.dark-theme .badge-info { background-color: rgba(56, 189, 248, 0.15); color: #38bdf8; }

.status-avatar-row {
  display: flex;
  flex-direction: column;
}

.emp-sub-position {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.course-progress-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.course-badge-item {
  padding: 2px 6px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.7rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.course-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.course-dot.completed { background-color: var(--color-green); }
.course-dot.in_progress { background-color: var(--color-amber); }
.course-dot.not_started { background-color: var(--text-muted); }
.course-dot.expired { background-color: var(--color-red); }

/* Table Actions Button */
.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background-color: var(--hover-bg);
  color: var(--text-light);
}

.btn-icon.delete:hover {
  background-color: var(--color-red);
  color: white;
}

/* Filters Toolbar */
.filters-toolbar {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-select {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  outline: none;
}

.filter-group-search {
  flex: 1;
  max-width: 280px;
}

.filter-input {
  width: 100%;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  outline: none;
}

/* Course Grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.course-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.course-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.course-card-icon {
  width: 32px;
  height: 32px;
  background-color: var(--hover-bg);
  color: var(--primary-color);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.course-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  line-height: 1.3;
}

.course-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.course-card-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.course-stat {
  display: flex;
  flex-direction: column;
}

.course-stat-val {
  font-weight: 600;
  color: var(--text-main);
}

/* Calendar styling */
.calendar-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

.calendar-sidebar {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calendar-sidebar h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.upcoming-events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-card {
  padding: 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.event-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
}

.event-card-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.event-type-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.event-type-dot.briefing { background-color: var(--color-blue); }
.event-type-dot.exam { background-color: var(--color-green); }
.event-type-dot.expiration { background-color: var(--color-red); }
.event-type-dot.other { background-color: var(--color-amber); }

.calendar-main-view {
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.calendar-header-controls h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day-header {
  text-align: center;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 0;
  font-size: 0.8rem;
}

.calendar-day {
  min-height: 70px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

body.dark-theme .calendar-day {
  background-color: var(--bg-card);
}

.calendar-day.empty {
  background-color: transparent;
  border-color: transparent;
}

.calendar-day.today {
  border-color: var(--primary-color);
  background-color: var(--hover-bg);
}

.day-num {
  font-weight: 600;
  font-size: 0.8rem;
}

.day-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--primary-color);
  margin-top: 2px;
  align-self: center;
}

.day-event {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: var(--border-radius-sm);
  margin-top: 2px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-event.briefing { background-color: var(--color-blue); }
.day-event.exam { background-color: var(--color-green); }
.day-event.expiration { background-color: var(--color-red); }

/* Interactive test styling */
.testing-container {
  max-width: 600px;
  margin: 20px auto 0;
  padding: 30px;
}

.quiz-hero {
  margin-bottom: 16px;
}

.testing-container h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-light);
}

.testing-container p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.quiz-progress-bar {
  height: 6px;
  background-color: var(--hover-bg);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.quiz-progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  width: 0;
  transition: width 0.2s ease;
}

.quiz-header-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.quiz-question {
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-light);
  margin-bottom: 20px !important;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.quiz-opt-btn {
  text-align: left;
  padding: 12px 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-opt-btn:hover {
  background-color: var(--hover-bg);
  border-color: var(--primary-color);
}

.quiz-opt-btn.selected {
  background-color: var(--hover-bg);
  border-color: var(--primary-color);
}

.quiz-opt-btn.correct {
  background-color: #dcfce7;
  border-color: var(--color-green);
  color: #15803d;
}

.quiz-opt-btn.incorrect {
  background-color: #fee2e2;
  border-color: var(--color-red);
  color: #b91c1c;
}

.quiz-opt-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-opt-btn.selected .quiz-opt-indicator {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
}

.quiz-footer {
  display: flex;
  justify-content: flex-end;
}

.hidden, .modal-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
}

.result-icon-container {
  margin-bottom: 16px;
}

.result-badge-container {
  margin-bottom: 16px;
}

.result-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.result-badge.success { background-color: #dcfce7; color: #15803d; }
.result-badge.failure { background-color: #fee2e2; color: #b91c1c; }

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* Modals Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-container {
  width: 480px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-large {
  width: 720px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-light);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-close-modal:hover {
  color: var(--text-light);
}

.modal-body {
  padding: 20px;
}

/* Forms layout */
.form-group {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 8px 10px;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary-color);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-col-6 {
  flex: 1;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.col-span-2 {
  grid-column: span 2;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.employees-selection-container {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 8px;
  background-color: var(--input-bg);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.employee-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  padding: 6px 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

body.dark-theme .employee-select-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.employee-select-item:hover {
  background-color: var(--hover-bg);
}

.employee-select-item input[type="checkbox"],
.employee-select-item .prot-emp-checkbox {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

/* Printable Document Style (GOST 2464 Protocol) */
.modal-print {
  width: 297mm;
  min-height: 210mm;
  background-color: white !important;
  color: black !important;
  border: none !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
  padding: 15mm 20mm;
  box-sizing: border-box;
}

.modal-actions-header {
  display: flex;
  gap: 10px;
  align-items: center;
}

.printable-area {
  font-family: 'Times New Roman', Times, serif;
  font-size: 14px;
  line-height: 1.4;
  color: black !important;
}

.gost-protocol-title {
  text-align: center;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 20px;
}

.gost-org-header {
  text-align: center;
  text-transform: uppercase;
  font-size: 14px;
  margin-bottom: 10px;
  font-weight: bold;
}

.gost-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  font-weight: 500;
}

.gost-section-title {
  font-weight: bold;
  margin-top: 14px;
  margin-bottom: 6px;
}

.gost-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  margin-bottom: 20px;
}

.gost-table th, .gost-table td {
  border: 1px solid black;
  padding: 6px;
  font-size: 12px;
  color: black !important;
}

.gost-table th {
  text-align: center;
  font-weight: bold;
  background-color: #f3f3f3;
}

.gost-signatures {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.sig-row {
  display: flex;
  justify-content: space-between;
}

.sig-underline {
  border-bottom: 1px solid black;
  width: 200px;
  text-align: center;
  font-size: 10px;
}

.sig-label {
  font-size: 11px;
  font-style: italic;
  text-align: center;
  margin-top: 1px;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 0 !important; /* Hides default browser header/footer (date, URL, page number) */
  }

  body {
    background-color: white !important;
    color: black !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .app-container, .no-print, .modal-overlay:not(#modal-print-view) {
    display: none !important;
  }
  
  #modal-print-view {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 297mm !important;
    height: 210mm !important;
    box-sizing: border-box !important;
    padding: 10mm 15mm !important; /* Emulates safe page margin internally */
    background-color: white !important;
    z-index: 99999 !important;
    overflow: hidden !important;
    page-break-after: avoid !important;
    page-break-before: avoid !important;
  }

  .modal-print {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    box-shadow: none !important;
    border: none !important;
    box-sizing: border-box !important;
  }

  .modal-header.no-print {
    display: none !important;
  }
}

/* ===== Employee Name Link ===== */
.emp-name-link {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.15s ease;
  cursor: pointer;
}

.emp-name-link:hover {
  color: #005a3c;
  text-decoration: underline;
}

body.dark-theme .emp-name-link {
  color: #4ade80;
}

body.dark-theme .emp-name-link:hover {
  color: #86efac;
}

/* ===== Employee Detail Modal ===== */
.emp-detail-profile {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.emp-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2e7d32;
  flex-shrink: 0;
}

body.dark-theme .emp-detail-avatar {
  background: linear-gradient(135deg, #1b3a26 0%, #0d2818 100%);
  color: #4ade80;
}

.emp-detail-info h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--text-color);
}

.emp-detail-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.emp-detail-field {
  background-color: var(--hover-bg);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emp-detail-field .field-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.emp-detail-field .field-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color);
}

.emp-detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-color);
}

/* Course detail cards grid */
.detail-courses-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.course-detail-card {
  border-radius: 10px;
  padding: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.course-detail-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.course-detail-card.completed {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
}

.course-detail-card.not-started {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fecaca;
}

body.dark-theme .course-detail-card.completed {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.04) 100%);
  border-color: rgba(34, 197, 94, 0.2);
}

body.dark-theme .course-detail-card.not-started {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.04) 100%);
  border-color: rgba(239, 68, 68, 0.2);
}

.course-detail-card.expiring {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  animation: pulse-yellow 3s infinite ease-in-out;
}

body.dark-theme .course-detail-card.expiring {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-color: rgba(245, 158, 11, 0.3);
}

.course-detail-card.expired {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fca5a5;
}

body.dark-theme .course-detail-card.expired {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-color: rgba(239, 68, 68, 0.25);
}

@keyframes pulse-yellow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12); }
}

.course-detail-status.yellow { color: #d97706; }
body.dark-theme .course-detail-status.yellow { color: #fbbf24; }

.expiring-warning {
  color: #b45309 !important;
  font-weight: 600 !important;
}

.expired-warning {
  color: #b91c1c !important;
  font-weight: 600 !important;
  text-decoration: line-through;
}

.course-detail-card.not-applicable {
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border: 1px dashed #d1d5db;
  opacity: 0.75;
}

body.dark-theme .course-detail-card.not-applicable {
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.06) 0%, rgba(156, 163, 175, 0.03) 100%);
  border-color: rgba(156, 163, 175, 0.25);
}

.course-detail-status.grey { color: #9ca3af; }
body.dark-theme .course-detail-status.grey { color: #6b7280; }

.course-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.course-detail-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.course-detail-status.green { color: #16a34a; }
.course-detail-status.red { color: #dc2626; }

body.dark-theme .course-detail-status.green { color: #4ade80; }
body.dark-theme .course-detail-status.red { color: #f87171; }

.course-detail-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
  line-height: 1.3;
}

.course-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.course-detail-date,
.course-detail-cert {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.course-detail-cert {
  font-family: monospace;
  font-size: 0.72rem;
}

/* Switch Toggle Styles for Constructor */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}
.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 22px;
}
.slider-toggle:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.switch-toggle input:checked + .slider-toggle {
  background-color: #0284c7;
}
.switch-toggle input:checked + .slider-toggle:before {
  transform: translateX(22px);
}

/* Mixed Orientation Printing for Personal Card Combo */
.printable-card-view {
  display: none;
}

/* Styles for printable card and orders */
.personal-card-print-layout {
  font-family: "Times New Roman", Times, serif;
  color: black;
  background: white;
  padding: 10mm;
  box-sizing: border-box;
}

.personal-card-print-layout h1 {
  font-size: 1.4rem;
  text-align: center;
  margin-bottom: 0.2rem;
  font-weight: bold;
}

.personal-card-print-layout h2 {
  font-size: 1.2rem;
  text-align: center;
  margin-top: 0;
  margin-bottom: 1rem;
  font-weight: bold;
  letter-spacing: 0.05em;
}

.personal-card-print-layout table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.82rem;
}

.personal-card-print-layout th, 
.personal-card-print-layout td {
  border: 1px solid black;
  padding: 4px 6px;
  vertical-align: middle;
}

.personal-card-print-layout th {
  background-color: #f2f2f2;
  font-weight: bold;
  text-align: center;
}

@media print {
  body.printing-personal-card {
    background: white !important;
    color: black !important;
  }
  body.printing-personal-card .app-container {
    display: none !important;
  }
  body.printing-personal-card .modal-overlay {
    display: none !important;
  }
  body.printing-personal-card .printable-card-view {
    display: block !important;
  }

  /* Paged Media Setup */
  @page {
    size: A4 portrait;
    margin: 15mm 10mm 15mm 20mm;
  }

  @page landscape-card {
    size: A4 landscape;
    margin: 10mm 10mm 10mm 15mm;
  }

  .print-card-page-landscape {
    page: landscape-card;
    page-break-after: always;
    break-after: page;
    width: 297mm;
    height: 210mm;
    box-sizing: border-box;
    overflow: hidden;
    padding: 10mm;
  }

  .print-order-page-portrait {
    page: auto;
    page-break-after: always;
    break-after: page;
    width: 210mm;
    height: 297mm;
    box-sizing: border-box;
    overflow: hidden;
    padding: 15mm 15mm 15mm 20mm;
  }
}
