/* ============================================================
   assets/css/style.css — ALIG Insurance Simulator
   ============================================================ */

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

body {
  font-family: 'Inter', sans-serif;
  background: #f0f4ff;
  color: #1e293b;
  margin: 0;
  min-height: 100vh;
}

/* ---- Utilities ---- */
.hidden { display: none !important; }
.text-red { color: #dc2626; }
.text-green { color: #16a34a; }
.text-blue { color: #2563eb; }
.text-gray { color: #64748b; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.p-4 { padding: 1rem; }

/* ---- Card ---- */
.card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  border: 1px solid #e2e8f0;
}

/* ---- Form Fields ---- */
.field-group { margin-bottom: 1rem; }
.field-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.input-field {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: #1e293b;
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}
.input-field:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.input-field[readonly] {
  background: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}
textarea.input-field { resize: vertical; min-height: 80px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.35rem;
  border: none;
  border-radius: 0.6rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
}
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; }
.btn-indigo    { background: #4f46e5; color: #fff; }
.btn-indigo:hover { background: #4338ca; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8125rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Login Page ---- */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
}
.login-card {
  background: #fff;
  padding: 2.5rem 2rem;
  border-radius: 1.25rem;
  box-shadow: 0 20px 50px rgba(37,99,235,.15);
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.login-logo {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.login-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1d4ed8;
  margin: 0 0 0.25rem;
}
.login-card p { color: #64748b; font-size: 0.9rem; margin: 0 0 1.5rem; }
.login-error {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 0.5rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

/* ---- App Header ---- */
#app-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.header-brand { display: flex; align-items: center; gap: 0.75rem; }
.header-brand .logo-icon { font-size: 1.6rem; }
.header-brand h1 { font-size: 1.1rem; font-weight: 800; color: #1d4ed8; margin: 0; }
.header-brand p  { font-size: 0.75rem; color: #64748b; margin: 0; }
.header-right { display: flex; align-items: center; gap: 1rem; }
#welcome-msg { font-size: 0.875rem; color: #475569; }
.breadcrumb { font-size: 0.8125rem; color: #94a3b8; margin-top: 0.2rem; }

/* ---- App Container ---- */
#app-container { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }

/* ---- View Transitions ---- */
.view { animation: fadeSlide 0.3s ease-out; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Start / Line Selection ---- */
.line-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.line-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.75rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 700;
  font-size: 1.05rem;
  color: #1e293b;
}
.line-card:hover {
  border-color: #3b82f6;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(37,99,235,.12);
}
.line-card svg, .line-card .line-icon { margin-bottom: 0.75rem; }
.line-card.motor   { border-color: #bfdbfe; }
.line-card.health  { border-color: #bbf7d0; }
.line-card.travel  { border-color: #fde68a; }
.line-card.pa      { border-color: #fca5a5; }
.line-card.fw      { border-color: #c4b5fd; }
.line-card.general { border-color: #a5f3fc; }

/* ---- Plan Selection ---- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}
.plan-card {
  border: 2px solid #e2e8f0;
  border-radius: 0.875rem;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  min-height: 110px;
  background: #fff;
}
.plan-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(37,99,235,.1);
  transform: translateY(-2px);
}
.plan-card h3 { font-size: 0.9375rem; font-weight: 700; margin: 0 0 0.75rem; color: #1e293b; }

/* ---- Calculator Layout ---- */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .calc-layout { grid-template-columns: 1fr; }
}

.calc-inputs { background: #fff; border-radius: 1rem; padding: 1.5rem; border: 1px solid #e2e8f0; }
.calc-sidebar { position: sticky; top: 80px; }

.section-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #f1f5f9;
}

.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}
.fields-grid .full-col { grid-column: 1 / -1; }
@media (max-width: 600px) {
  .fields-grid { grid-template-columns: 1fr; }
}

/* ---- Quote Summary Sidebar ---- */
.quote-summary { background: #fff; border-radius: 1rem; overflow: hidden; border: 1px solid #e2e8f0; }
.quote-summary-header {
  background: linear-gradient(135deg, #1d4ed8, #4f46e5);
  color: #fff;
  padding: 1.25rem 1.25rem 1rem;
}
.quote-summary-header h3 { font-size: 0.9375rem; font-weight: 700; margin: 0 0 0.2rem; opacity: 0.9; }
.quote-summary-header .plan-name { font-size: 0.8125rem; opacity: 0.75; }

.quote-items { padding: 1rem 1.25rem; }
.quote-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}
.quote-row:last-child { border-bottom: none; }
.quote-row .label { color: #64748b; }
.quote-row .value { font-weight: 600; color: #1e293b; }

.quote-total {
  background: #f0fdf4;
  border-top: 2px solid #bbf7d0;
  padding: 1rem 1.25rem;
}
.quote-total .label { font-size: 0.875rem; color: #16a34a; font-weight: 600; }
.quote-total .amount { font-size: 1.75rem; font-weight: 800; color: #15803d; }

.note-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.5rem;
  padding: 0.7rem 1rem;
  font-size: 0.8125rem;
  color: #92400e;
  margin: 0.75rem 1.25rem;
}

/* ---- Action Buttons Row ---- */
.action-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f1f5f9;
}
.action-row .btn { flex: 1; justify-content: center; }

/* ---- Section Nav Bar ---- */
.section-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-nav h2 {
  font-size: 1.375rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
}
.section-nav h2 span { color: #dc2626; }

/* ---- Health: Member Rows ---- */
.member-row {
  display: grid;
  grid-template-columns: 80px 70px 140px 130px 130px 100px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}
.member-row:first-child { font-weight: 700; color: #64748b; font-size: 0.8125rem; }
@media (max-width: 768px) {
  .member-row { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---- Travel: Person Rows ---- */
.travel-person-row {
  display: grid;
  grid-template-columns: 80px 70px 130px 130px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}

/* ---- PA Benefits Table ---- */
.pa-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.pa-table th { background: #f8fafc; color: #475569; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.6rem 0.75rem; text-align: left; }
.pa-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #f1f5f9; }
.pa-table tbody tr:hover { background: #f8fafc; }

/* ---- Comparison Table (Health) ---- */
.comparison-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 1rem; }
.comparison-table th { background: #1d4ed8; color: #fff; padding: 0.65rem 0.75rem; text-align: center; font-size: 0.8rem; }
.comparison-table td { padding: 0.6rem 0.75rem; border: 1px solid #e2e8f0; text-align: center; }
.comparison-table tr:nth-child(even) td { background: #f8fafc; }
.comparison-table .row-label { font-weight: 700; text-align: left; color: #1d4ed8; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef9c3; color: #a16207; }

/* ---- Contact Info (Home) ---- */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 640px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-item { text-align: center; padding: 1.25rem; }
.contact-icon {
  width: 3.25rem; height: 3.25rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.4rem;
}

/* ---- Tab Navigation (for Workmen sub-plans, etc.) ---- */
.tab-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-btn {
  padding: 0.5rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  transition: all 0.18s;
}
.tab-btn.active {
  border-color: #4f46e5;
  background: #4f46e5;
  color: #fff;
}
.tab-btn:hover:not(.active) { border-color: #a5b4fc; color: #4f46e5; }

/* ---- Loading Spinner ---- */
.spinner {
  display: inline-block;
  width: 1.25rem; height: 1.25rem;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  #app-container { padding: 1rem 0.75rem; }
  .fields-grid { grid-template-columns: 1fr; }
  .action-row { flex-direction: column; }
  .calc-layout { grid-template-columns: 1fr; }
  .section-nav { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
