/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  color: #333;
}

/* ── Layout ── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1e1e2e;
  color: #cdd6f4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  display: block;
  width: 100%;
  max-width: 140px;
  height: auto;
  border-radius: 4px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
}

.sidebar-link {
  display: block;
  padding: 0.6rem 1.25rem;
  color: #a6adc8;
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #cdd6f4;
}

.sidebar-link.active {
  color: #f47b20;
  border-left-color: #f47b20;
  background: rgba(244, 123, 32, 0.1);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
}

.sidebar-user {
  display: block;
  color: #6c7086;
  margin-bottom: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-signout {
  color: #a6adc8;
  text-decoration: none;
  font-size: 0.8rem;
}

.sidebar-signout:hover {
  color: #f47b20;
}

.main-content {
  flex: 1;
  min-width: 0;
  background: #f8f9fa;
}

.container {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: #666;
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.back-link:hover {
  color: #333;
}

.flash {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
}

.flash-notice {
  background: #d4edda;
  color: #155724;
  border-bottom: 1px solid #c3e6cb;
}

.flash-alert {
  background: #f8d7da;
  color: #721c24;
  border-bottom: 1px solid #f5c6cb;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #dee2e6;
  text-align: left;
}

.table th {
  font-weight: 600;
  background: #f8f9fa;
}

.table td.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0;
}

.table-clickable-rows tbody tr {
  cursor: pointer;
}

.table-clickable-rows tbody tr:hover {
  background: #f0f4ff;
}

.row-chevron {
  width: 1rem;
  text-align: right;
  color: #aaa;
  font-size: 1.2rem;
  padding-right: 0.5rem;
}

.table-clickable-rows tbody tr:hover .row-chevron {
  color: #555;
}

.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: #f47b20;
  color: #fff;
}

.btn-primary:hover {
  background: #d4680f;
}

.btn-secondary {
  background: #e9ecef;
  color: #333;
}

.btn-secondary:hover {
  background: #dee2e6;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-danger:hover {
  background: #c82333;
}

.detail-list {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.5rem 1rem;
  max-width: 600px;
}

.detail-list dt {
  font-weight: 600;
  color: #555;
}

.detail-list dd {
  margin: 0;
}

.empty-state {
  color: #888;
  font-style: italic;
  margin-top: 0.5rem;
}

.severity-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.mapping-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.mapping-badge.disabled {
  background: #e5e5e5;
  color: #666;
}

.mapping-badge.enabled {
  background: #d4edda;
  color: #155724;
}

.mapping-badge.required {
  background: #cce5ff;
  color: #004085;
}

.severity-dot {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  cursor: default;
  flex-shrink: 0;
}

.severity-low,
.severity-dot.severity-low {
  background: #EAB308;
}

.severity-medium,
.severity-dot.severity-medium {
  background: #F47B20;
}

.severity-high,
.severity-dot.severity-high {
  background: #D32F2F;
}

.severity-remove_from_service,
.severity-dot.severity-remove_from_service {
  background: #000000;
}

.severity-low {
  color: #fff;
}

.severity-medium {
  color: #fff;
}

.severity-high {
  color: #fff;
}

.severity-remove_from_service {
  color: #fff;
}

.photo-thumbs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.damage-photo {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  cursor: pointer;
}

.damage-map-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 68px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  background: #f5f5f5;
  overflow: hidden;
  cursor: pointer;
}

.damage-map-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.damage-map-pin {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f47b20;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  display: none;
}

.photo-lightbox-trigger {
  display: inline-block;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.lightbox[aria-hidden="false"] {
  display: flex;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

.lightbox-pdf-container {
  width: 92vw;
  height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
}

.lightbox-pdf-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.35rem 0.75rem;
  background: rgba(40, 40, 40, 0.95);
  color: #fff;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.lightbox-pdf-controls button {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.lightbox-pdf-controls button:hover {
  background: rgba(255, 255, 255, 0.28);
}

.lightbox-pdf-wrap {
  flex: 1;
  overflow: auto;
  background: #525659;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.lightbox-pdf-canvas-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.lightbox-pdf-pin {
  display: none;
  position: absolute;
  width: 16px;
  height: 16px;
  background: #f47b20;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.lightbox-pdf-canvas {
  display: block;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.lightbox-img-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lightbox-pin {
  display: none;
  position: absolute;
  width: 16px;
  height: 16px;
  background: #f47b20;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 1rem;
  text-decoration: none;
  user-select: none;
  opacity: 0.8;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

.lightbox-prev {
  left: 0.5rem;
}

.lightbox-next {
  right: 0.5rem;
}

.field {
  margin-bottom: 1rem;
}

.row-archived td {
  opacity: 0.5;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-search {
  padding: 0.4rem 0.7rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 0.9rem;
  width: 220px;
}

.filter-select {
  padding: 0.4rem 0.7rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
}

.filter-tabs {
  display: flex;
  gap: 0.25rem;
}

.filter-tab {
  padding: 0.35rem 0.9rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #555;
  text-decoration: none;
  background: #fff;
}

.filter-tab.active {
  background: #f47b20;
  border-color: #f47b20;
  color: #fff;
  font-weight: 600;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: #f47b20;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link-danger {
  color: #D32F2F;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.field input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.field .hint {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.2rem;
  display: block;
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

.actions input[type=submit] {
  padding: 0.4rem 0.9rem;
  background: #f47b20;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

.error-messages {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.error-messages ul {
  margin: 0;
  padding-left: 1.25rem;
}

button {
  background: none;
  border: none;
  padding: 0;
  color: #c0392b;
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
}

/* ── Auth pages (login, password reset, etc.) ── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
}

.auth-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  display: block;
  margin: 0 auto 1rem;
  max-width: 160px;
  height: auto;
  border-radius: 4px;
}

.auth-header p {
  color: #666;
  margin: 0;
  font-size: 0.95rem;
}

.auth-card .field {
  margin-bottom: 1.1rem;
}

.auth-card .field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 0.35rem;
}

.auth-card .field input[type=email],
.auth-card .field input[type=password],
.auth-card .field input[type=text] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.15s;
  outline: none;
}

.auth-card .field input:focus {
  border-color: #f47b20;
  box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.25);
}

.auth-card .field-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-card .field-inline input[type=hidden] {
  display: none;
}

.auth-card .field-inline input[type=checkbox] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.auth-card .field-inline label {
  margin: 0;
  font-weight: 400;
  color: #555;
}

.btn-auth {
  display: block;
  width: 100%;
  padding: 0.7rem;
  margin-top: 1.5rem;
  background: #f47b20;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-auth:hover {
  background: #d4680f;
}

.auth-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.875rem;
}

.auth-links a {
  color: #f47b20;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}