/* KLCM Field Marketing Survey Styles */
:root {
  --primary: #0d9488;       /* Medical Teal */
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --secondary: #0284c7;     /* Clinical Sky Blue */
  --accent: #f59e0b;        /* Amber */
  --dark: #0f172a;          /* Slate 900 */
  --light-bg: #f8fafc;      /* Slate 50 */
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-muted: #64748b;
  --danger: #ef4444;
  --success: #10b981;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--light-bg);
  color: var(--dark);
  line-height: 1.5;
  padding-bottom: 100px; /* Space for fixed mobile bottom nav */
}

/* Sticky Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 990;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-bottom: 1px solid var(--border);
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
}

.brand-logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  height: 42px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.lang-switch {
  display: flex;
  background: #f1f5f9;
  border-radius: 20px;
  padding: 3px;
  border: 1px solid #e2e8f0;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
}

/* Control Bar: Staff Info & GPS */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  align-items: center;
}

.staff-input-group {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}

.staff-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #ffffff;
}

.staff-input:focus {
  outline: none;
  border-color: var(--primary);
}

.gps-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.gps-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #94a3b8;
}

.gps-dot.active {
  background-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.gps-dot.error {
  background-color: var(--danger);
}

/* Category Banner (Shows currently active form clearly without cutoff) */
.active-category-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.2px;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
}

.category-banner-icon {
  font-size: 1.1rem;
  margin-right: 8px;
}

/* Desktop Tabs Navigation (Hidden on Mobile) */
.desktop-nav {
  display: flex;
  background: #ffffff;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  flex: 1;
  text-align: center;
  padding: 12px 14px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #f0fdfa;
}

/* Mobile Fixed Bottom Navigation Bar (App-like native feel) */
.mobile-bottom-nav {
  display: none; /* Shown only on mobile screens */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  border-top: 1px solid #e2e8f0;
  z-index: 1000;
  padding: 6px 12px;
}

.mobile-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 8px 4px;
  border-radius: 10px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.mobile-nav-btn .nav-icon {
  font-size: 1.35rem;
  line-height: 1;
  margin-bottom: 4px;
}

.mobile-nav-btn .nav-label {
  font-size: 0.75rem;
  font-weight: 600;
}

.mobile-nav-btn.active {
  color: var(--primary-dark);
  background: #f0fdfa;
}

.mobile-nav-btn.active .nav-icon {
  transform: scale(1.1);
  transition: transform 0.2s;
}

/* Main Container */
.container {
  max-width: 820px;
  margin: 16px auto;
  padding: 0 16px;
}

/* Form Cards */
.form-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  padding: 18px;
  margin-bottom: 18px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge-gate {
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

.badge-mandatory {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
  color: #1e293b;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* Checkbox and Radio Grid */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.choice-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f8fafc;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  font-size: 0.88rem;
  user-select: none;
}

.choice-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.choice-item input {
  margin-top: 3px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Action Buttons */
.btn-submit {
  width: 100%;
  padding: 15px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
  transition: transform 0.1s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-submit:hover {
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.4);
}

.btn-submit:active {
  transform: translateY(1px);
}

.btn-reset {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
}

/* Notice Box */
.notice-box {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  line-height: 1.4;
}

.notice-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.notice-info {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 80px; /* Above the bottom nav bar */
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 9999;
  display: none;
  animation: fadeIn 0.3s;
  text-align: center;
  max-width: 90%;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Responsive Rules */
@media (max-width: 768px) {
  /* On mobile/tablets: Hide cramped top tabs, show app-like bottom navigation */
  .desktop-nav {
    display: none !important;
  }
  .mobile-bottom-nav {
    display: block !important;
  }
  .brand-logo-img {
    height: 34px;
  }
  .choice-grid {
    grid-template-columns: 1fr;
  }
  .card-title {
    font-size: 0.98rem;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (min-width: 769px) {
  /* On desktops: Keep clean top tabs, hide bottom navigation */
  .desktop-nav {
    display: flex !important;
  }
  .mobile-bottom-nav {
    display: none !important;
  }
  body {
    padding-bottom: 50px;
  }
}

/* ======================================================== */
/* PWA App Sync Bar, User Status & Multi-Step Wizard Styles */
/* ======================================================== */
.app-top-status-bar {
  background: #0f172a;
  color: #f8fafc;
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
}
.network-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.network-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}
.network-dot.offline {
  background: #f59e0b;
}
.sync-counter-badge {
  background: #334155;
  color: #f1f5f9;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  cursor: pointer;
}
.sync-counter-badge.pending {
  background: #f59e0b;
  color: #000;
  font-weight: 700;
}

/* Wizard Stepper Header */
.wizard-stepper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  background: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.wizard-progress-bar-container {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin: 0 12px;
  overflow: hidden;
}
.wizard-progress-fill {
  height: 100%;
  background: var(--primary);
  width: 25%;
  transition: width 0.3s ease;
}
.wizard-step-indicator {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Wizard Cards & Navigation */
.wizard-step-card {
  display: none;
}
.wizard-step-card.active {
  display: block;
  animation: fadeIn 0.25s ease;
}
.wizard-nav-btns {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn-wizard-prev {
  flex: 1;
  background: #e2e8f0;
  color: #334155;
  border: none;
  padding: 12px;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
}
.btn-wizard-next {
  flex: 2;
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
}

/* Touch-First Selection Pills & Chips */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.chip-item {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.chip-item:active {
  transform: scale(0.96);
}
.chip-item input[type="radio"],
.chip-item input[type="checkbox"] {
  display: none;
}
.chip-item.selected {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
}

/* Stepper Counter (+ / -) */
.counter-box {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}
.counter-btn {
  width: 38px;
  height: 38px;
  background: #f1f5f9;
  border: none;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.counter-btn:active {
  background: #e2e8f0;
}
.counter-val {
  min-width: 44px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

/* User Login Modal / Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-card {
  background: #ffffff;
  width: 100%;
  max-width: 360px;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  text-align: center;
}

