:root {
  --bg: #0a0e18;
  --panel: rgba(15, 25, 45, 0.85);
  --panel2: rgba(20, 35, 60, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f5f7ff;
  --muted: rgba(245, 247, 255, 0.75);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);

  --blue: #2d5fb0;
  --blue-light: #4a8cff;
  --green: #4caf50;
  --orange: #ff9933;
  --red: #ff4444;
}

:root[data-theme="light"] {
  --bg: #f0f2f5;
  --panel: rgba(255, 255, 255, 0.98);
  --panel2: rgba(248, 249, 250, 0.95);
  --border: rgba(0, 0, 0, 0.12);
  --text: #1c1e21;
  --muted: rgba(28, 30, 33, 0.6);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-weight: 700;
  overflow-x: hidden;
}

#root {
  min-height: 100vh;
}

/* SOS CAD Header */
.sosHeader {
  background: linear-gradient(180deg, #1a3a7a 0%, #0d1f45 100%);
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

:root[data-theme="light"] .sosHeader {
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  color: #1c1e21;
}

.sosLogo {
  font-size: 32px;
  font-weight: 1000;
  letter-spacing: 2px;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

.sosHeaderRight {
  display: flex;
  align-items: center;
  gap: 16px;
  color: white;
}

.sosTime {
  font-size: 24px;
  font-weight: 1000;
  font-family: 'Courier New', monospace;
  min-width: 120px;
  text-align: right;
}

.sosCaseNumbers {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 13px;
  font-weight: 900;
  opacity: 0.95;
}

/* Tabs */
.sosTabs {
  background: linear-gradient(180deg, #2952a3 0%, #1a3a7a 100%);
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  display: flex;
  padding: 8px 12px;
  gap: 8px;
  align-items: center;
}

:root[data-theme="light"] .sosTabs {
  background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sosTabIcon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border-radius: 50%;
  position: relative;
  transition: all 0.2s;
}

.sosTabIcon:hover {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 1);
  transform: scale(1.05);
}

.sosTabIcon.active {
  background: #2563eb;
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

:root[data-theme="light"] .sosTabIcon {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(28, 30, 33, 0.8);
}

:root[data-theme="light"] .sosTabIcon:hover {
  background: rgba(0, 0, 0, 0.12);
  color: rgba(28, 30, 33, 1);
}

:root[data-theme="light"] .sosTabIcon.active {
  background: #2563eb;
  border-color: rgba(37, 99, 235, 0.3);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Main Content */
.sosContent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  min-height: calc(100vh - 180px);
}

.sosPanel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

:root[data-theme="light"] .sosPanel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sosPanelTitle {
  font-size: 16px;
  font-weight: 1000;
  margin-bottom: 12px;
  color: var(--blue-light);
}

:root[data-theme="light"] .sosPanelTitle {
  color: #1e40af;
  font-weight: 800;
}

.sosSection {
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--panel2);
}

:root[data-theme="light"] .sosSection {
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.9);
}

.sosSectionTitle {
  font-size: 13px;
  font-weight: 1000;
  color: var(--blue-light);
  margin-bottom: 8px;
  text-transform: uppercase;
}

:root[data-theme="light"] .sosSectionTitle {
  color: #1e40af;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.sosField {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] .sosField {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.sosField:last-child {
  border-bottom: none;
}

.sosLabel {
  font-weight: 900;
  opacity: 0.85;
  font-size: 14px;
}

.sosValue {
  font-weight: 1000;
  text-align: right;
  font-size: 14px;
}

/* Status Badge */
.sosStatus {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 1000;
  text-align: center;
  margin-bottom: 12px;
  font-size: 15px;
}

.sosStatus.accepteret {
  background: linear-gradient(180deg, #4caf50 0%, #388e3c 100%);
  color: white;
}

.sosStatus.vaerksted {
  background: linear-gradient(180deg, #ff9933 0%, #cc7a29 100%);
  color: white;
}

.sosStatus.k3 {
  background: linear-gradient(180deg, #ff4444 0%, #cc3333 100%);
  color: white;
}

.sosStatus.normal {
  background: linear-gradient(180deg, #4a8cff 0%, #2d5fb0 100%);
  color: white;
}

/* Vehicle Info Grid */
.sosVehicleGrid {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.sosVehicleRow {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  padding: 4px 0;
}

/* Timeline */
.sosTimeline {
  display: grid;
  gap: 6px;
}

.sosTimelineItem {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  font-size: 13px;
}

:root[data-theme="light"] .sosTimelineItem {
  background: rgba(0, 0, 0, 0.04);
}

/* Bottom Buttons */
.sosBottomBar {
  background: linear-gradient(180deg, #1a3a7a 0%, #0d1f45 100%);
  border-top: 2px solid rgba(255, 255, 255, 0.15);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

:root[data-theme="light"] .sosBottomBar {
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
  border-top: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.sosBtn {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(180deg, rgba(70, 130, 255, 0.95) 0%, rgba(40, 90, 200, 0.95) 100%);
  color: white;
  font-weight: 1000;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

:root[data-theme="light"] .sosBtn {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid rgba(37, 99, 235, 0.3);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
  color: white;
}

.sosBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  background: linear-gradient(180deg, rgba(90, 150, 255, 0.95) 0%, rgba(60, 110, 220, 0.95) 100%);
}

:root[data-theme="light"] .sosBtn:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4), 0 2px 4px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

:root[data-theme="light"] .sosBtn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.sosBtn:active {
  transform: translateY(0);
}

.sosBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.sosBtnKey {
  margin-left: 8px;
  font-size: 11px;
  opacity: 0.9;
}

/* Messages */
.sosMessageList {
  display: grid;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 6px;
}

.sosMessage {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.sosMessageHeader {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 900;
  opacity: 0.85;
}

.sosMessageBody {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
  white-space: pre-wrap;
}

.sosMessageUnread {
  border-left: 4px solid var(--blue-light);
  background: rgba(74, 140, 255, 0.12);
}

/* Input */
.sosInput {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
  outline: none;
}

.sosInput:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(74, 140, 255, 0.15);
}

.sosTextarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.sosTextarea:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(74, 140, 255, 0.15);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Login Page */
.sosLoginPage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% 20%, rgba(80, 140, 255, 0.20), rgba(0, 0, 0, 0)), linear-gradient(180deg, rgba(10, 25, 55, 0.95), rgba(6, 12, 24, 0.95));
}

:root[data-theme="light"] .sosLoginPage {
  background: radial-gradient(1200px 600px at 50% 10%, rgba(80, 140, 255, 0.25), rgba(0, 0, 0, 0)), linear-gradient(180deg, #f5f7ff, #e8eefc);
}

.sosLoginCard {
  width: min(920px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 14, 28, 0.55);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

:root[data-theme="light"] .sosLoginCard {
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 20px 60px rgba(20, 40, 80, 0.20);
}

.sosLoginHeader {
  padding: 18px 20px;
  background: linear-gradient(180deg, rgba(25, 60, 140, 0.55), rgba(10, 20, 40, 0.35));
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  display: flex;
  align-items: center;
  gap: 16px;
}

:root[data-theme="light"] .sosLoginHeader {
  background: linear-gradient(180deg, rgba(80, 140, 255, 0.30), rgba(255, 255, 255, 0.10));
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 16px;
}

.sosLoginTitle {
  font-size: 40px;
  font-weight: 1000;
  letter-spacing: 0.5px;
}

.sosLoginSub {
  margin-top: 4px;
  font-weight: 800;
  opacity: 0.85;
}

.sosLoginHero {
  padding: 18px 18px 0 18px;
}

.sosLoginHeroImg {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

:root[data-theme="light"] .sosLoginHeroImg {
  border: 1px solid rgba(0, 0, 0, 0.10);
}

.sosLoginForm {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.sosRoleRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sosRoleBtn {
  flex: 1;
  min-width: 220px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 1000;
  cursor: pointer;
  color: var(--text);
}

:root[data-theme="light"] .sosRoleBtn {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.95);
}

.sosRoleBtn.isActive {
  background: linear-gradient(180deg, rgba(45, 140, 255, 0.95), rgba(15, 90, 220, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: white;
}

:root[data-theme="light"] .sosRoleBtn.isActive {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.sosWarning {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 210, 90, 0.35);
  background: rgba(255, 210, 90, 0.12);
  font-weight: 900;
}

.sosLabel {
  font-weight: 900;
  opacity: 0.9;
  margin-top: 6px;
}

.sosInput {
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  padding: 0 12px;
  font-weight: 900;
  outline: none;
  color: var(--text);
  font-size: 15px;
}

:root[data-theme="light"] .sosInput {
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.95);
  color: #1c1e21;
}

.sosInput:focus {
  border-color: rgba(80, 140, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(80, 140, 255, 0.18);
}

:root[data-theme="light"] .sosInput:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.sosError {
  color: #ff3b3b;
  font-weight: 1000;
}

.sosBigBtnRow {
  margin-top: 6px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.sosBigBtn {
  flex: 1;
  min-width: 260px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(45, 140, 255, 0.95), rgba(15, 90, 220, 0.95));
  color: white;
  font-weight: 1000;
  cursor: pointer;
  font-size: 16px;
}

.sosBigBtnAlt {
  background: linear-gradient(180deg, rgba(40, 60, 90, 0.90), rgba(18, 28, 50, 0.95));
}

:root[data-theme="light"] .sosBigBtnAlt {
  background: linear-gradient(180deg, #e9edf7, #cfd7ea);
  color: #0b1020;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.sosHot {
  margin-left: 8px;
  font-weight: 1000;
  opacity: 0.9;
}

.sosFooterHint {
  margin-top: 8px;
  font-weight: 800;
  opacity: 0.75;
}

/* Responsive */
@media (max-width: 1024px) {
  .sosContent {
    grid-template-columns: 1fr;
  }
}

/* Loading */
.sosLoading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  font-size: 18px;
  font-weight: 900;
  opacity: 0.7;
}

/* Case Table */
.sosCaseTable {
  background: var(--panel);
  min-height: calc(100vh - 180px);
}

.sosCaseTableHeader {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(80, 120, 180, 0.35), rgba(40, 70, 120, 0.35));
  border-bottom: 2px solid var(--border);
  font-weight: 1000;
  font-size: 14px;
  color: var(--text);
}

:root[data-theme="light"] .sosCaseTableHeader {
  background: linear-gradient(180deg, rgba(248, 249, 250, 0.95), rgba(233, 236, 239, 0.95));
  color: #1c1e21;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-weight: 700;
}

.sosCaseTableRow {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  color: white;
  font-weight: 900;
}

:root[data-theme="light"] .sosCaseTableRow {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

.sosCaseTableRow:hover {
  filter: brightness(1.15);
}

:root[data-theme="light"] .sosCaseTableRow:hover {
  background: rgba(37, 99, 235, 0.04);
  filter: none;
}

:root[data-theme="light"] .sosCaseTableRow:nth-child(even) {
  background: rgba(248, 249, 250, 0.8);
}

:root[data-theme="light"] .sosCaseTableRow:nth-child(even):hover {
  background: rgba(37, 99, 235, 0.06);
}

/* Modal */
.sosModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sosModalBackdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

:root[data-theme="light"] .sosModalBackdrop {
  background: rgba(10, 30, 60, 0.45);
}

.sosModalContent {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  min-width: 500px;
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sosModalBtn {
  flex: 1;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 1000;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.sosModalBtnPrimary {
  background: linear-gradient(180deg, rgba(45, 140, 255, 0.95), rgba(15, 90, 220, 0.95));
  color: white;
}

.sosModalBtnPrimary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(45, 140, 255, 0.4);
}

.sosModalBtnSecondary {
  background: linear-gradient(180deg, rgba(60, 80, 110, 0.90), rgba(30, 45, 70, 0.95));
  color: white;
}

:root[data-theme="light"] .sosModalBtnSecondary {
  background: linear-gradient(180deg, #e9edf7, #cfd7ea);
  color: #0b1020;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.sosModalBtnSecondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
