/* ============================================================
   MEDICOLEGAL AUTOPSY NOTIFICATION (HEALTH 1328) - MOBILE STYLES
   ============================================================ */

:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --success: #16a34a;
  --success-dark: #15803d;
  --success-light: #dcfce7;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --border-focus: #0284c7;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-main: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  padding-bottom: 90px; /* Space for fixed bottom action bar */
}

/* ================= HEADER ================= */
.app-header {
  background: #0f172a;
  color: #ffffff;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-md);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-form {
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.app-subtitle {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 6px;
}

.btn-chip {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 4px 9px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-chip:hover, .btn-chip:active {
  background: #334155;
  color: #ffffff;
}

.btn-chip-primary {
  background: #0284c7;
  color: #ffffff;
  border-color: #0369a1;
}

.btn-chip-primary:hover, .btn-chip-primary:active {
  background: #0369a1;
  color: #ffffff;
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

/* ================= MAIN CONTAINER ================= */
.app-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 14px;
}

/* ================= PRESET EMAIL BANNER ================= */
.preset-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.banner-icon {
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
}

.banner-content {
  font-size: 13px;
  color: #1e3a8a;
  flex: 1;
}

.email-tag {
  background: #dbeafe;
  color: #1d4ed8;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  word-break: break-all;
}

.banner-hint {
  font-size: 11px;
  color: #3b82f6;
  margin-top: 3px;
}

/* ================= FORM CARDS ================= */
.form-card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
}

.card-header {
  background: #f1f5f9;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-num {
  background: #334155;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.card-header h2 {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ================= FORM ELEMENTS ================= */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sublabel {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: normal;
}

.req {
  color: var(--danger);
  font-weight: 700;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background-color: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  transition: all 0.15s ease-in-out;
  outline: none;
  min-height: 44px; /* Mobile touch friendly target */
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

textarea {
  resize: vertical;
  min-height: 58px;
  line-height: 1.4;
}

.mono-input {
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.text-center {
  text-align: center;
}

.font-bold {
  font-weight: 600;
}

/* Segmented Control (Mobile friendly tabs/radios) */
.segmented-control {
  display: flex;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.seg-option {
  flex: 1;
  position: relative;
  cursor: pointer;
  margin: 0;
}

.seg-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  border-radius: 6px;
  min-height: 40px;
  transition: all 0.15s;
  user-select: none;
}

.seg-option input[type="radio"]:checked + .seg-btn {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  border: 1px solid #e2e8f0;
}

/* Toggle Pills */
.toggle-pill-group {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 20px;
  padding: 3px;
  gap: 4px;
  width: fit-content;
}

.toggle-pill {
  position: relative;
  cursor: pointer;
  margin: 0;
}

.toggle-pill input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pill-btn {
  display: inline-block;
  padding: 4px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border-radius: 16px;
  transition: all 0.15s;
}

.toggle-pill input[type="radio"]:checked + .pill-btn {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

/* Sub-form block */
.sub-form-block {
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Cause header row */
.cause-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.interval-input {
  max-width: 140px;
  min-height: 32px !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
}

/* Quick Suggestion Chips */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}

.chip-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.chip:hover, .chip:active {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}

.border-top-divider {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

/* Doctor Profile Card */
.doctor-card {
  border-color: #93c5fd;
  background: #f0f9ff;
}

.doctor-card .card-header {
  background: #e0f2fe;
}

.profile-tip {
  font-size: 11.5px;
  color: #0369a1;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #bae6fd;
}

.stamp-post-print-note {
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
  margin-top: 4px;
}

/* ================= FLOATING ACTION BAR ================= */
.bottom-spacer {
  height: 20px;
}

.floating-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.08);
  padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  z-index: 50;
  max-width: 680px;
  margin: 0 auto;
}

.btn-primary {
  flex: 2;
  background: var(--success);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease-in-out;
}

.btn-primary:hover, .btn-primary:active {
  background: var(--success-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  flex: 1;
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  transition: all 0.15s;
}

.btn-secondary:hover, .btn-secondary:active {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================= MODALS ================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  z-index: 100;
  padding: 12px;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-large {
  max-width: 720px;
  height: 90vh;
}

.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

.modal-iframe-container {
  padding: 0;
  flex: 1;
  display: flex;
}

.modal-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.reference-photo {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Success Modal */
.header-success {
  background: var(--success-light);
  border-bottom-color: #bbf7d0;
  color: var(--success-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-success-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.success-icon {
  background: var(--success);
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.success-lead {
  font-size: 14px;
  margin-bottom: 12px;
}

.delivery-status-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 14px;
}

.status-row {
  display: flex;
  justify-content: space-between;
}

.status-lbl {
  color: var(--text-muted);
}

.status-val {
  font-weight: 600;
}

.status-message {
  font-size: 12px;
  color: #0369a1;
  background: #e0f2fe;
  padding: 6px 8px;
  border-radius: 6px;
  margin-top: 4px;
}

.spam-hint {
  font-size: 11.5px;
  color: #b45309;
  background: #fef3c7;
  padding: 6px 8px;
  border-radius: 6px;
  margin-top: 4px;
  border: 1px solid #fde68a;
  line-height: 1.4;
}

.modal-footer-split {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 480px) {
  .modal-footer-split {
    flex-direction: row;
    justify-content: space-between;
  }
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  background: #ffffff;
  transition: all 0.15s;
}

.btn-action:hover, .btn-action:active {
  background: var(--primary-light);
}

/* ================= TOAST NOTIFICATIONS ================= */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease-out;
}

.toast.toast-success {
  background: #15803d;
}

.toast.toast-error {
  background: #b91c1c;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
