/* =======================================
   THEME CONSTANTS
   ======================================= */
:root {
  --ash-blue: #317FE1;
  --light-ash-blue: #72AEFF;
  --dark-gray: #292929;
  --light-gray: #515151;
  --text-light: #ffffff;
  --text-muted: #c7c7c7;
  --accent-blue: #7fb8ff;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: 0.25s ease;
  --shadow-soft: rgba(0, 0, 0, 0.25);
  --nav-height: 50px;
  --footer-height: 36px;
  --vertical-gaps: 80px;
}

/* =======================================
   GLOBAL
   ======================================= */
body.bg-gradient {
  background: var(--dark-gray) url("../img/bg-dark.svg") center / cover no-repeat fixed !important;
  color: var(--text-light);
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* =======================================
   NAVBAR
   ======================================= */
.navbar {
  background: #ffffff !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  height: 50px;
  min-height: 50px;
  padding: 0 !important;
  display: flex;
  align-items: center;
}
.navbar .container-fluid {
  height: 100%;
}

.navbar-brand {
  display: flex;
  align-items: center;
  margin-left: -1.8rem;
}

/* Left logo */
.navbar-logo {
  height: 33px;
  width: auto;
  transition: transform 0.2s ease;
}

.navbar-logo:hover {
  transform: scale(1.05);
}

/* Right title */
.navbar-title {
  color: var(--ash-blue);
  font-weight: 600;
  font-size: 1.0rem;
  letter-spacing: 0.5px;
  margin: 0;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-nav {
  border: 1px solid var(--ash-blue);
  color: var(--ash-blue);
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
}

.btn-nav:hover,
.btn-nav:focus,
.btn-nav.active {
  background: var(--ash-blue);
  color: #ffffff;
}



/* =======================================
   GLASS CARD
   ======================================= */
.glass-card {
  background: rgba(81, 81, 81, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 10px var(--shadow-soft);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  height: 100%;
  transition: box-shadow var(--transition);
}

/* =======================================
   HEADINGS & LABELS
   ======================================= */
h5, label {
  color: var(--text-light) !important;
  font-weight: 500;
}

/* =======================================
   INPUTS & FORMS
   ======================================= */
.form-control,
.form-select,
.form-range {
  background: #3a3a3a;
  border: 1px solid #444;
  color: var(--text-light);
}
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.35);
}
.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: #ff6f7d;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.35);
}
.form-select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3e%3cpolygon fill='%23ffffff' points='5,7 10,12 15,7'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.3rem;
  padding-right: 3rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-select:hover {
  border-color: var(--light-ash-blue);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ash-blue);
  box-shadow: 0 0 0 0.15rem rgba(49, 127, 225, 0.4);
}
.form-control::placeholder,
.form-select::placeholder {
  color: rgba(255, 255, 255, 0.40);
}
.form-control::-webkit-input-placeholder,
.form-select::-webkit-input-placeholder {
  color: rgba(255, 255, 255, 0.40);
}
.form-control::-moz-placeholder,
.form-select::-moz-placeholder {
  color: rgba(255, 255, 255, 0.40);
}
.form-control:-ms-input-placeholder,
.form-select:-ms-input-placeholder {
  color: rgba(255, 255, 255, 0.40);
}
.form-control::-ms-input-placeholder,
.form-select::-ms-input-placeholder {
  color: rgba(255, 255, 255, 0.40);
}

.form-range::-webkit-slider-thumb,
.form-range::-moz-range-thumb {
  background: var(--ash-blue);
}

.divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
}

/* =======================================
   BUTTONS
   ======================================= */
.btn {
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-primary {
  background: var(--ash-blue);
  border: none;
  color: #fff;
}
.btn-primary:hover {
  background: var(--light-ash-blue);
  transform: translateY(-1px);
}
.btn-outline-secondary {
  border-color: var(--light-ash-blue);
  color: var(--light-ash-blue);
}
.btn-outline-secondary:hover {
  background: var(--light-ash-blue);
  color: #fff;
}
.btn.btn-outline-secondary.btn-chart-toggle {
  border-color: rgba(127, 184, 255, 0.65);
  color: var(--light-ash-blue);
  background: rgba(127, 184, 255, 0);
  box-shadow: 0 0 0 0 transparent;
}
.btn.btn-outline-secondary.btn-chart-toggle:hover,
.btn.btn-outline-secondary.btn-chart-toggle:focus {
  background: rgba(127, 184, 255, 0.25);
  color: #ffffff;
  border-color: rgba(127, 184, 255, 0.95);
}
.btn.btn-outline-secondary.btn-chart-toggle.active,
.btn.btn-outline-secondary.btn-chart-toggle[aria-pressed="true"] {
  background: var(--light-ash-blue);
  color: #ffffff;
  border-color: transparent;
}
.btn.btn-outline-secondary.btn-chart-toggle.active:hover,
.btn.btn-outline-secondary.btn-chart-toggle.active:focus,
.btn.btn-outline-secondary.btn-chart-toggle[aria-pressed="true"]:hover,
.btn.btn-outline-secondary.btn-chart-toggle[aria-pressed="true"]:focus {
  background: var(--light-ash-blue);
  color: #ffffff;
  border-color: transparent;
}

.camera-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.camera-pill {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-light);
  padding: 0.35rem 1.1rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: all var(--transition);
  cursor: pointer;
}

.camera-pill:hover,
.camera-pill:focus-visible {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 0 0.15rem rgba(127, 184, 255, 0.25);
  outline: none;
}

.camera-pill-active {
  background: var(--accent-blue);
  color: var(--text-light);
  border-color: transparent;
}

.camera-pill-active:hover,
.camera-pill-active:focus-visible {
  color: #1f1f1f;
  box-shadow: 0 0 0 0.18rem rgba(127, 184, 255, 0.35);
}

.table-sort {
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  padding: 0;
  text-transform: inherit;
}

.table-sort:hover,
.table-sort:focus-visible {
  color: var(--accent-blue);
  outline: none;
}

.table-sort-active {
  color: var(--accent-blue);
}

.sort-indicator {
  font-size: 0.75rem;
  opacity: 0.55;
  transition: opacity var(--transition), transform var(--transition);
}

.table-sort-active .sort-indicator,
.table-sort:focus-visible .sort-indicator {
  opacity: 1;
}

select option.lens-unavailable {
  color: var(--text-muted);
}

/* =======================================
   MAGNIFICATION SLIDER STYLING
   ======================================= */
#mag {
  width: 100%;
  height: 6px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--ash-blue), var(--light-ash-blue));
  outline: none;
  transition: background 0.15s linear;
  cursor: pointer;
  margin-top: 4px;
}

#mag:hover {
  background: linear-gradient(90deg, var(--light-ash-blue), var(--ash-blue));
}

/* WebKit (Chrome, Edge, Safari) */
#mag::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--ash-blue);
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(114, 174, 255, 0.7);
  transition: box-shadow 0.15s ease-in-out, background 0.15s ease-in-out;
  cursor: grab;
}
#mag:active::-webkit-slider-thumb {
  background: var(--light-ash-blue);
  box-shadow: 0 0 14px rgba(114, 174, 255, 0.9);
  cursor: grabbing;
}
#mag:active {
  transition: none;
}

#mag + .d-flex {
  margin-top: 0.25rem;
  color: var(--text-light);
}
#magVal {
  color: var(--light-ash-blue);
}


/* =======================================
   RESULT PANEL
   ======================================= */
.result-panel {
  font-size: 1rem;
  color: var(--text-light);
  background: rgba(81, 81, 81, 0.8);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.result-panel.table-panel {
  padding: 12px 0;
  overflow: hidden;
}

.result-panel.table-panel .table-responsive {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 14px;
}

.result-panel table {
  color: var(--text-light);
  border-color: rgba(255, 255, 255, 0.08);
}

.result-panel table thead th {
  color: var(--text-light);
  border-color: rgba(255, 255, 255, 0.16);
}

.result-panel table tbody tr {
  background: rgba(30, 30, 30, 0.8);
}

.result-panel table tbody tr:nth-child(even) {
  background: rgba(40, 40, 40, 0.85);
}

.result-panel table tbody tr:hover {
  background: rgba(49, 127, 225, 0.3);
}

.result-panel table tbody tr.camera-group {
  --bs-table-bg: rgba(49, 127, 225, 0.15);
  --bs-table-striped-bg: rgba(49, 127, 225, 0.15);
  --bs-table-hover-bg: rgba(49, 127, 225, 0.15);
  --bs-table-accent-bg: rgba(49, 127, 225, 0.15);
  background-color: rgba(49, 127, 225, 0.15) !important;
}

.result-panel table tbody tr.camera-group:hover {
  background-color: rgba(49, 127, 225, 0.15) !important;
}

.result-panel table.table-hover tbody tr.camera-group:hover > * {
  background-color: transparent !important;
  color: var(--text-light);
}

.result-panel table tbody tr.camera-group td {
  background: transparent !important;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-top: 1px solid rgba(127, 184, 255, 0.4);
  border-bottom: 1px solid rgba(127, 184, 255, 0.2);
}

.result-panel table tbody tr.camera-group .camera-group-label {
  color: var(--accent-blue);
  display: inline-block;
}

.results-table-view {
  display: block;
}

.results-card-view {
  display: none;
}

.result-card-sort {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.result-card-sort-label {
  font-weight: 600;
  letter-spacing: 0.35px;
}

.result-card-sort-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.result-card-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(127, 184, 255, 0.12);
  border: 1px solid rgba(127, 184, 255, 0.4);
  color: var(--text-light);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.result-card-sort-button .sort-indicator {
  font-size: 0.75rem;
}

.result-card-group {
  margin-bottom: 1.25rem;
}

.result-card-group-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--accent-blue);
  margin-bottom: 0.5rem;
}

.result-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-card {
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid rgba(127, 184, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.result-card-header {
  margin-bottom: 0.75rem;
}

.result-card-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.result-card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-card-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem 1rem;
}

.result-card-metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.result-card-metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
}

.result-card-metric-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
}

.result-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.result-card-actions .btn {
  flex: 1 1 0;
}

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

/* =======================================
   LAYOUT & CHART
   ======================================= */
.row.g-4 {
  align-items: stretch;
}

.chart-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: calc(100vh - (var(--nav-height) + var(--footer-height) + var(--vertical-gaps)));
}

.chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 360px; /* safety minimum for small screens */
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#accuracyChart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.chart-wrap .js-plotly-plot {
  width: 100% !important;
  height: 100% !important;
}

.chart-wrap .plotly .main-svg {
  border-radius: inherit;
}

.chart-wrap .plotly,
.chart-wrap .plotly .bg {
  background: transparent !important;
}


/* =======================================
   FOOTER
   ======================================= */
footer {
  margin-top: auto;
  color: var(--text-light);
  border-top: 1px solid #3a3a3a;
  padding: 1.3rem 0;
  font-size: 1rem;
  line-height: 1.2;
}

footer a {
  color: inherit;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  text-align: center;
  padding: 0 2.5rem;
  min-height: 80px;
}

.app-footer-version {
  color: var(--text-muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.app-footer-content {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  width: 100%;
  row-gap: 0.95rem;
}
.app-footer-disclaimer {
  grid-column: 1 / span 3;
  grid-row: 1;
  justify-self: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
}
.app-footer-version {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
}
.app-footer-content a {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
}


/* =======================================
   MOBILE OPTIMISATION
   ======================================= */
@media (max-width: 768px) {
  .navbar-links {
    flex-direction: row;
    justify-content: center;
    width: auto;
    gap: 0.5rem;
  }
  .navbar-links .btn-nav {
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
  }
  .navbar-links .btn-nav .nav-label {
    display: none !important;
  }
  .glass-card {
    padding: 1.25rem !important;
  }
  .result-panel {
    font-size: 0.9rem;
  }
  .results-table-view {
    display: none;
  }
  .results-card-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  .result-card-actions {
    flex-direction: column;
  }
  .result-card-actions .btn {
    width: 100%;
  }
  .navbar-logo {
    height: 36px;
  }
  .navbar-title {
    font-size: 1.1rem;
  }
  .app-footer {
    padding: 0 1.5rem 0.75rem;
    min-height: 110px;
  }
  .app-footer-content {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, auto);
    row-gap: 0.5rem;
  }
  .app-footer-version {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
  }
  .app-footer-content a {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
  }
  .app-footer-disclaimer {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.7rem;
  }
}
