:root{
  --brand-red: #C8102E;
  --brand-dark: #222222;
  --bg-base: #F5F6F7;
  --card-bg: #ffffff;
  --accent-green: #2E7D32;
  --accent-yellow: #FFD600;
  --muted: #6c757d;
}

/* Base typography */
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--brand-dark);
  background-color: var(--bg-base);
  font-size: 15px;
}

.navbar-brand { font-weight: 600; color: var(--brand-red) !important; display:flex; align-items:center; gap:8px }
.navbar { border-bottom: 1px solid rgba(0,0,0,0.05); }

.card { background: var(--card-bg); border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
h1, h2, h3, h4 { font-weight: 600; color: var(--brand-dark); }

.btn-primary { background-color: var(--brand-red); border-color: var(--brand-red); }
.btn-primary:hover, .btn-primary:focus { background-color: #9d0b23; border-color: #9d0b23; }

.badge-signal { background: var(--accent-green); color: #fff; }
.badge-warning { background: var(--accent-yellow); color: #222; }

.table th { background: #fff; font-weight: 600; }
.table td { vertical-align: middle; }

.page-header { padding: 0.75rem 0; border-bottom: 1px solid rgba(0,0,0,0.04); margin-bottom: 1rem; }

a:focus, button:focus, .btn:focus { outline: 3px solid rgba(200,16,46,0.18); outline-offset: 2px; box-shadow: none; }

.station-code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', monospace; background: rgba(0,0,0,0.03); padding: 0.12rem 0.4rem; border-radius: 4px; font-weight: 600; }

/* Small responsive tweaks */
@media (max-width: 767px) {
  .navbar-brand { gap:6px; }
  .page-header { padding: .5rem 0; }
}

/* Dashboard railway schematic background */
.rail-network-bg {
  position: relative;
  background-color: var(--bg-base);
}
.rail-network-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900' preserveAspectRatio='xMidYMid slice'>%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%23ffffff' stop-opacity='0'/%3E%3Cstop offset='1' stop-color='%23ffffff' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='transparent'/%3E%3Cg stroke='%23222222' stroke-opacity='0.06' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'%3E%3Cpath d='M80 160 C220 120 380 120 520 160 L680 200 C820 240 980 240 1120 200 L1280 160'/%3E%3Cpath d='M120 260 C260 220 420 220 560 260 L720 300 C860 340 1020 340 1160 300 L1320 260'/%3E%3Cpath d='M40 360 C200 320 360 320 520 360 L680 400 C840 440 1000 440 1160 400 L1320 360'/%3E%3C/g%3E%3Cg stroke='%23C8102E' stroke-opacity='0.08' stroke-width='3' stroke-linecap='round' fill='none'%3E%3Cpath d='M200 120 L200 760'/%3E%3Cpath d='M600 80 L600 820'/%3E%3Cpath d='M1000 120 L1000 760'/%3E%3C/g%3E%3Ccircle cx='200' cy='160' r='6' fill='%23C8102E' fill-opacity='0.12'/%3E%3Ccircle cx='600' cy='200' r='6' fill='%23222222' fill-opacity='0.08'/%3E%3Ccircle cx='1000' cy='160' r='6' fill='%23C8102E' fill-opacity='0.12'/%3E%3C/svg>");
  background-repeat: repeat;
  background-position: center;
  background-size: 60%;
  opacity: 0.70;
  pointer-events: none;
  z-index: 0;
}

/* Ensure dashboard content sits above the SVG background */
.rail-network-bg .container,
.rail-network-bg header,
.rail-network-bg main { position: relative; z-index: 1; }

/* Reduce card contrast over the patterned background */
.rail-network-bg .card { background: rgba(255,255,255,0.92); }

/* Dashboard RSS Feed Styles */
.rss-item {
  border-bottom: 1px solid #dee2e6;
  padding: 12px 0;
}

.rss-item:last-child {
  border-bottom: none;
}

.rss-item-title {
  font-weight: 600;
  color: #0d6efd;
  text-decoration: none;
  display: block;
  margin-bottom: 4px;
}

.rss-item-title:hover {
  text-decoration: underline;
}

.rss-item-date {
  font-size: 0.85rem;
  color: #6c757d;
}

.rss-item-description {
  font-size: 0.9rem;
  color: #495057;
  margin-top: 4px;
}

/* GridStack Customization */
.grid-stack {
  background: transparent;
}

.grid-stack-item-content {
  overflow: visible !important;
}

.grid-stack .card {
  height: 100%;
  margin: 0;
}

.grid-stack .card-body {
  overflow-y: auto;
}

/* Widget visibility toggle */
.widget-toggle-item {
  padding: 10px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.widget-toggle-item:last-child {
  border-bottom: none;
}

.widget-toggle-item:hover {
  background-color: #f8f9fa;
}

/* Ensure checkbox is clickable */
#widgetToggleList .form-check-input {
  cursor: pointer !important;
  pointer-events: auto !important;
  position: relative !important;
  z-index: 10 !important;
  width: 3rem !important;
  height: 1.5rem !important;
}

#widgetToggleList .form-check {
  pointer-events: auto !important;
}

/* Fix modal z-index above GridStack */
.modal-backdrop {
  z-index: 1040 !important;
}

#widgetModal {
  z-index: 1050 !important;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  /* Hide RSS feed widgets on mobile */
  .grid-stack-item[gs-id^="rss-"] {
    display: none !important;
  }
  
  /* Make all module widgets full width */
  .grid-stack-item:not([gs-id^="rss-"]) {
    width: 100% !important;
    left: 0 !important;
  }
  
  /* Adjust card height for mobile */
  .grid-stack-item .card {
    min-height: auto;
  }
  
  /* Hide edit controls on mobile */
  #toggleEditMode {
    display: none !important;
  }
  
  /* Smaller cards on mobile */
  .grid-stack {
    margin: 0 -0.5rem;
  }
  
  .grid-stack-item {
    margin-bottom: 1rem;
  }
}
/* Public Test Page Styles */
.test-gradient-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.container-center {
  max-width: 600px;
}

.code-input {
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.loader {
  display: none;
}

.loader.show {
  display: block;
}

.question-readonly {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  padding: 10px;
  border-radius: 4px;
}

/* ============================================================================
   REFACTORED INLINE CSS UTILITIES
   These classes replace inline style="..." attributes throughout the codebase
   ============================================================================ */

/* Display & Visibility */
.cursor-pointer { cursor: pointer; }
.overflow-x-auto { overflow-x: auto; }

/* Section Headers */
.section-header {
  background-color: #f8f9fa;
  border-radius: 0.375rem;
  padding: 0.75rem;
}

/* Text Formatting */
.text-preformatted {
  white-space: pre-wrap;
}

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }

/* Text Truncation Utilities */
.text-truncate-150 {
  max-width: 150px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
}

.text-truncate-180 {
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
}

.text-truncate-300 {
  max-width: 300px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
}

/* Icon Sizes */
.icon-sm { font-size: 1.5rem; }
.icon-md { font-size: 2rem; }
.icon-lg { font-size: 3rem; }

/* Table Layout Utilities */
.table-fixed {
  table-layout: fixed;
  width: 100%;
  margin: 0;
}

.table-responsive-custom {
  overflow-x: auto;
}

/* Column Width Utilities for px-based widths */
.col-width-50 { width: 50px; }
.col-width-100 { width: 100px; }
.col-width-110 { width: 110px; }
.col-width-140 { width: 140px; }
.col-width-180 { width: 180px; }
.col-width-200 { width: 200px; }

/* Column Width Utilities for percentage-based widths */
.col-5 { width: 5%; }
.col-9 { width: 9%; }
.col-13 { width: 13%; }
.col-15 { width: 15%; }
.col-20 { width: 20%; }
.col-22 { width: 22%; }
.col-25 { width: 25%; }
.col-30 { width: 30%; }
.col-75 { width: 75%; }

/* Form Control Widths */
.form-control-250 {
  width: 250px;
}

.form-control-full {
  width: 100%;
}

/* Color & Background Utilities */
.bg-light-custom {
  background-color: #f8f9fa;
}

.badge-light-custom {
  background-color: #f0f0f0;
  font-weight: bold;
}

/* Gradient Classes */
.gradient-module-primary {
  background: linear-gradient(135deg, var(--brand-red) 0%, #a80820 100%);
}

/* Input Styling */
input[type="color"].form-control-color-custom {
  width: 45px;
  height: 30px;
}

/* Card Body Padding Override */
.card-body-no-padding {
  padding: 0;
}

/* Help Text */
.help-text-small {
  font-size: 0.875rem;
  color: var(--muted);
}

/* Flex Utilities (complement Bootstrap) */
.flex-space-between-center {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Progress Bar Custom */
.progress-bar-custom {
  height: 25px;
}

/* Modal & Alert Custom */
.alert-hidden {
  display: none;
}

/* Collapse Helpers */
.collapse-header {
  cursor: pointer;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Image sizing */
.img-logo-nav {
  max-height: 50px;
  max-width: 200px;
}

/* Option Group Styling */
option[disabled] {
  font-weight: bold;
  background-color: #f0f0f0;
}
