/* ===== Røde Kors Beredskapssystem – Stylesheet ===== */
:root {
  --rk-red:    #C8102E;
  --rk-dark:   #8B0000;
  --rk-light:  #fce4e8;
  --bg:        #f8f9fa;
  --white:     #ffffff;
  --text:      #212529;
  --muted:     #6c757d;
  --border:    #dee2e6;
  --success:   #198754;
  --warning:   #ffc107;
  --danger:    #dc3545;
  --info:      #0dcaf0;
  --radius:    6px;
  --shadow:    0 2px 8px rgba(0,0,0,.1);
}

* { 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);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--rk-red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--rk-red);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  height: 56px;
  gap: 1rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  color: white;
  white-space: nowrap;
}

.rk-cross { font-size: 1.4rem; }

.nav-links {
  display: flex;
  gap: .25rem;
  flex: 1;
}

.nav-links a {
  color: rgba(255,255,255,.85);
  padding: .4rem .8rem;
  border-radius: var(--radius);
  font-size: .9rem;
  text-decoration: none;
  transition: background .15s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.2);
  color: white;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-left: auto;
}
.nav-user small { color: rgba(255,255,255,.8); font-size: .8rem; }
.nav-org { font-style: italic; }

/* ===== MAIN ===== */
.main-content {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* ===== ALERTS ===== */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-success { background: #d1e7dd; color: #0a3622; border: 1px solid #a3cfbb; }
.alert-error   { background: #f8d7da; color: #58151c; border: 1px solid #f1aeb5; }
.alert-info    { background: #cff4fc; color: #055160; border: 1px solid #9eeaf9; }
.alert-warning { background: #fff3cd; color: #664d03; border: 1px solid #ffda6a; }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.card-header h2, .card-header h3 { margin: 0; font-size: 1.1rem; }
.card-body { padding: 1.25rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn-primary   { background: var(--rk-red); color: white; }
.btn-secondary { background: var(--muted); color: white; }
.btn-success   { background: var(--success); color: white; }
.btn-warning   { background: var(--warning); color: #000; }
.btn-danger    { background: var(--danger); color: white; }
.btn-outline   { background: transparent; border: 1px solid currentColor; }
.btn-sm        { padding: .25rem .6rem; font-size: .8rem; }
.btn-lg        { padding: .75rem 1.5rem; font-size: 1rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 500; margin-bottom: .4rem; font-size: .9rem; }
.form-control, select, textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  background: white;
  transition: border-color .15s;
}
.form-control:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rk-red);
  box-shadow: 0 0 0 3px rgba(200,16,46,.12);
}
textarea { min-height: 100px; resize: vertical; }
.form-text { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
th, td {
  padding: .6rem .75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
tr:hover td { background: rgba(200,16,46,.03); }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: .2em .55em;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1;
}
.badge-success   { background: #d1e7dd; color: #0a3622; }
.badge-warning   { background: #fff3cd; color: #664d03; }
.badge-danger    { background: #f8d7da; color: #58151c; }
.badge-info      { background: #cff4fc; color: #055160; }
.badge-secondary { background: #e2e3e5; color: #41464b; }
.badge-primary   { background: var(--rk-light); color: var(--rk-dark); }

/* ===== SEVERITY / STATUS BADGES ===== */
.sev-critical { background: #f8d7da; color: #58151c; }
.sev-high     { background: #ffe5d0; color: #7b2d00; }
.sev-medium   { background: #fff3cd; color: #664d03; }
.sev-low      { background: #d1e7dd; color: #0a3622; }

.status-active      { background: #d1e7dd; color: #0a3622; }
.status-draft       { background: #e2e3e5; color: #41464b; }
.status-stabilized  { background: #cff4fc; color: #055160; }
.status-closed      { background: #e2e3e5; color: #41464b; }
.status-archived    { background: #f0f0f0; color: #888; }

/* ===== TIMELINE ===== */
.timeline { list-style: none; padding: 0; }
.timeline-item {
  display: flex;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--rk-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.timeline-dot.decision { background: #fff3cd; }
.timeline-body { flex: 1; }
.timeline-meta {
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.timeline-message { white-space: pre-wrap; word-break: break-word; }

/* ===== DASHBOARD STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .num {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--rk-red);
  line-height: 1;
}
.stat-card .lbl { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

/* ===== LOGIN PAGE ===== */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
.login-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
}
.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-logo .cross {
  font-size: 3rem;
  color: var(--rk-red);
  display: block;
}
.login-logo h1 {
  font-size: 1.4rem;
  color: var(--rk-red);
  margin: .25rem 0 0;
}

/* ===== ACK PAGE ===== */
.ack-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--bg);
}
.ack-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 480px;
  width: 100%;
  padding: 2rem;
}
.ack-box h1 { color: var(--rk-red); font-size: 1.4rem; margin-bottom: .5rem; }

/* ===== INCIDENT VIEW ===== */
.incident-header {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.incident-title { font-size: 1.6rem; font-weight: 700; margin-bottom: .5rem; }
.incident-meta {
  display: flex; gap: 1rem; flex-wrap: wrap;
  font-size: .85rem; color: var(--muted);
  margin-bottom: 1rem;
}
.incident-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: .6rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--muted);
  transition: all .15s;
}
.tab-btn.active, .tab-btn:hover {
  color: var(--rk-red);
  border-bottom-color: var(--rk-red);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== NOTIFICATION STATUS ===== */
.status-row-sent       td:first-child { border-left: 3px solid var(--success); }
.status-row-delivered  td:first-child { border-left: 3px solid #0d6efd; }
.status-row-failed     td:first-child { border-left: 3px solid var(--danger); }
.status-row-queued     td:first-child { border-left: 3px solid var(--muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .navbar { height: auto; padding: .5rem 1rem; }
  .nav-links { display: none; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .incident-title { font-size: 1.3rem; }
}

/* ===== PRINT ===== */
@media print {
  .navbar, .nav-links, .btn, footer, .incident-actions { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: .8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
