/* ========== FONT ========== */

@font-face {
  font-family: 'Pirulen';
  src: url('/fonts/pirulen.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ========== PROSERVE DARK THEME ========== */

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --bg-card: #1a1a2e;
  --bg-hover: #252545;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --text-muted: #9090a8;
  --accent-blue: #4a90d9;
  --accent-orange: #f39c12;
  --accent-green: #27ae60;
  --accent-red: #e74c3c;
  --border-color: #2a2a40;
}

/* ========== GLOBAL ========== */

body {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/ProserveReport/Background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}

a:hover {
  color: #6bb3f0;
}

/* ========== NAVBAR ========== */

.app-navbar {
  background-color: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.app-navbar .navbar-brand {
  font-size: 1.3rem;
  letter-spacing: 1px;
}

.brand-logo {
  height: 44px;
  width: auto;
}

.brand-proserve {
  font-family: 'Pirulen', sans-serif;
  color: #ffffff !important;
  font-size: 1.25rem;
  letter-spacing: 2px;
}

.brand-report {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 1px;
}

.text-primary-accent {
  color: var(--accent-blue) !important;
}

.app-navbar .nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: 6px;
  margin: 0 2px;
  transition: all 0.2s;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
  color: var(--text-primary) !important;
  background-color: var(--bg-hover);
}

/* ========== MAIN CONTENT ========== */

.main-content {
  min-height: calc(100vh - 56px);
}

h2, h3 {
  color: var(--text-primary);
}

/* ========== CARDS ========== */

.stat-card,
.data-card,
.chart-card {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px !important;
  color: var(--text-primary);
}

.stat-card .card-body {
  padding: 1.2rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.3rem 0;
}

.card-title {
  color: var(--text-primary) !important;
  font-weight: 600;
  margin-bottom: 1rem;
}

.card-subtitle {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== TABLES ========== */

.data-table {
  color: var(--text-primary) !important;
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-table-hover-bg: var(--bg-hover);
  --bs-table-hover-color: var(--text-primary);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-table-striped-color: var(--text-primary);
}

.data-table thead th {
  background-color: var(--bg-tertiary) !important;
  color: var(--accent-blue) !important;
  border-bottom: 2px solid var(--border-color) !important;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0.75rem;
  white-space: nowrap;
}

.data-table tbody td {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
  padding: 0.65rem 0.75rem;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: var(--bg-hover) !important;
}

.data-table tbody tr:hover td {
  color: #ffffff !important;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  color: #ffffff !important;
}

.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  color: var(--accent-blue) !important;
}

.table-link {
  color: var(--accent-blue) !important;
  font-weight: 500;
}

.table-link:hover {
  color: #6bb3f0 !important;
  text-decoration: underline;
}

/* ========== BOOTSTRAP DARK OVERRIDES ========== */

.table {
  color: var(--text-primary) !important;
}

.card {
  color: var(--text-primary) !important;
}

.form-control,
.form-select {
  color: var(--text-primary) !important;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a0a0b0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

.form-label {
  color: var(--text-secondary) !important;
}

/* ========== MUTED TEXT ========== */

.text-muted-custom {
  color: var(--text-muted) !important;
}

/* ========== FILTERS ========== */

.filter-select,
.filter-input {
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--accent-blue) !important;
  box-shadow: 0 0 0 0.2rem rgba(74, 144, 217, 0.25) !important;
}

.filter-select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* ========== BADGES ========== */

.session-type-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
}

/* ========== PAGINATION ========== */

.custom-pagination .page-item .page-link {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.custom-pagination .page-item .page-link:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.custom-pagination .page-item.active .page-link {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

.custom-pagination .page-item.disabled .page-link {
  background-color: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-muted);
}

/* ========== LANGUAGE SWITCHER ========== */

.lang-switcher {
  display: flex;
  gap: 2px;
  background-color: var(--bg-tertiary);
  border-radius: 6px;
  padding: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background-color: var(--accent-blue);
  color: white;
}

/* ========== PROGRESS BARS ========== */

.objective-bar {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
}

/* ========== SPINNER ========== */

.spinner-border {
  color: var(--accent-blue) !important;
}

/* ========== RECHARTS OVERRIDES ========== */

.recharts-text {
  fill: var(--text-secondary) !important;
}

.recharts-legend-item-text {
  color: var(--text-secondary) !important;
}

.recharts-cartesian-grid line {
  stroke: var(--border-color) !important;
}

.recharts-tooltip-wrapper .recharts-default-tooltip {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
  color: var(--text-primary) !important;
}

.recharts-tooltip-wrapper .recharts-default-tooltip .recharts-tooltip-label {
  color: var(--text-primary) !important;
}

.recharts-tooltip-wrapper .recharts-default-tooltip .recharts-tooltip-item {
  color: var(--text-primary) !important;
}

/* ========== SCROLLBAR ========== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========== PRINT BUTTON ========== */

.print-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.print-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
  background-color: var(--bg-hover);
}

/* ========== PRINT HEADER (hidden on screen) ========== */

.print-header {
  display: none;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
  .stat-value {
    font-size: 1.4rem;
  }

  .main-content {
    padding: 1rem !important;
  }
}

/* ========== PRINT STYLES ========== */

@media print {
  /* Show print header */
  .print-header {
    display: flex !important;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #333;
  }

  .print-header img {
    height: 36px;
    filter: brightness(0);
  }

  .print-header .print-title {
    font-family: 'Pirulen', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: #000 !important;
  }

  .print-header .print-subtitle {
    font-size: 0.8rem;
    color: #666 !important;
    margin-left: auto;
  }

  /* Light theme overrides */
  * {
    color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11px !important;
  }

  /* Hide non-printable elements */
  .app-navbar,
  .print-btn,
  .lang-switcher,
  .filter-select,
  .filter-input,
  .filter-label,
  .custom-pagination,
  .no-print {
    display: none !important;
  }

  .main-content {
    padding: 0 !important;
    min-height: auto !important;
  }

  /* Page titles */
  h2, h3 {
    color: #000 !important;
    font-size: 1.2rem !important;
    margin-bottom: 8px !important;
  }

  /* Cards - remove dark backgrounds */
  .card,
  .stat-card,
  .data-card,
  .chart-card {
    background: #ffffff !important;
    border: 1px solid #ccc !important;
    color: #000 !important;
    box-shadow: none !important;
    break-inside: avoid;
    margin-bottom: 10px !important;
  }

  .card-title {
    color: #000 !important;
    font-size: 0.95rem !important;
  }

  .card-subtitle {
    color: #555 !important;
  }

  /* Stat cards compact */
  .stat-card .card-body {
    padding: 8px !important;
  }

  .stat-value {
    font-size: 1.3rem !important;
    color: #000 !important;
  }

  /* Tables - light theme */
  .table,
  .data-table {
    color: #000 !important;
    --bs-table-bg: #ffffff;
    --bs-table-color: #000;
    --bs-table-hover-bg: transparent;
    --bs-table-hover-color: #000;
    font-size: 10px !important;
  }

  .data-table thead th {
    background-color: #f0f0f0 !important;
    color: #333 !important;
    border-bottom: 2px solid #999 !important;
    font-size: 9px !important;
    padding: 4px 6px !important;
  }

  .data-table tbody td {
    color: #000 !important;
    border-color: #ddd !important;
    padding: 3px 6px !important;
  }

  .data-table tbody tr:hover,
  .data-table tbody tr:hover td {
    background: transparent !important;
    color: #000 !important;
  }

  .table-link {
    color: #000 !important;
    text-decoration: none !important;
  }

  /* Badges - grayscale print friendly */
  .badge {
    border: 1px solid #999 !important;
    font-size: 9px !important;
    padding: 2px 5px !important;
  }

  .badge.bg-success {
    background-color: #ffffff !important;
    color: #000 !important;
    border-color: #333 !important;
  }

  .badge.bg-danger {
    background-color: #e0e0e0 !important;
    color: #000 !important;
    border-color: #666 !important;
  }

  .session-type-badge {
    background-color: #e8e8e8 !important;
    color: #000 !important;
    border: 1px solid #999 !important;
  }

  /* Text colors for print */
  .text-muted-custom {
    color: #666 !important;
  }

  .text-danger {
    color: #000 !important;
    font-weight: bold !important;
  }

  .fw-bold {
    font-weight: 700 !important;
  }

  /* Progress bars */
  .progress,
  .objective-bar {
    background-color: #e0e0e0 !important;
    height: 6px !important;
  }

  .progress-bar {
    background-color: #555 !important;
  }

  /* Charts - let them print as-is but ensure visibility */
  .recharts-text {
    fill: #333 !important;
  }

  .recharts-legend-item-text {
    color: #333 !important;
  }

  .recharts-cartesian-grid line {
    stroke: #ddd !important;
  }

  /* Page breaks */
  .page-break-before {
    break-before: page;
  }

  .card {
    break-inside: avoid;
  }

  tr {
    break-inside: avoid;
  }

  /* Links as plain text */
  a, a:visited {
    color: #000 !important;
    text-decoration: none !important;
  }
}
