/* ==========================================================================
   components.css — buttons, forms, cards, badges, alerts, tabs, tables,
   modal, notice popup, pagination … (no page-specific rules here)
   ========================================================================== */

/* ---------- Icons ---------- */
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; stroke: currentColor; fill: none;
        stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--ink-900); --btn-bd: var(--line); --btn-hover: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: .55em 1.25em; border-radius: var(--radius);
  border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font: 600 var(--fs-base)/1.3 var(--font); text-decoration: none; cursor: pointer;
  transition: background .18s var(--ease), box-shadow .18s var(--ease), transform .12s var(--ease), border-color .18s;
}
.btn:hover { background: var(--btn-hover); color: var(--btn-fg); box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn-primary { --btn-bg: var(--maroon-600); --btn-fg: #fff; --btn-bd: var(--maroon-600); --btn-hover: var(--maroon-700); box-shadow: 0 6px 16px -8px rgba(123, 31, 54, .7); }
.btn-primary:hover { box-shadow: 0 10px 20px -8px rgba(123, 31, 54, .75); }
.btn-gold { --btn-bg: var(--gold-500); --btn-fg: var(--maroon-900); --btn-bd: var(--gold-500); --btn-hover: var(--gold-600); }
.btn-secondary { --btn-bg: transparent; --btn-fg: var(--maroon-600); --btn-bd: var(--maroon-200); --btn-hover: var(--maroon-50); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink-700); --btn-bd: transparent; --btn-hover: var(--line-soft); }
.btn-danger { --btn-bg: var(--danger-500); --btn-fg: #fff; --btn-bd: var(--danger-500); --btn-hover: var(--danger-700); }
.btn-outline-danger { --btn-bg: transparent; --btn-fg: var(--danger-500); --btn-bd: #efc3c8; --btn-hover: var(--danger-bg); }
.btn-success { --btn-bg: var(--success-500); --btn-fg: #fff; --btn-bd: var(--success-500); --btn-hover: var(--success-700); }
.btn-sm { min-height: 36px; padding: .3em .9em; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding: .7em 1.8em; font-size: var(--fs-md); border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { min-width: 40px; padding: .4em; }
.spinner {
  width: 1.1em; height: 1.1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.field { min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field > label, .label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: 6px; color: var(--ink-700); }
.req { color: var(--danger-500); margin-left: 2px; }
/* Every text-like input is styled — including ones with no `type` attribute, type=search/url/etc. (checkbox, radio, file, hidden, range excluded) */
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="submit"]):not([type="button"]), .field select, .field textarea {
  width: 100%; min-height: 46px; padding: .55em .85em; border: 1px solid #d9cfc0; border-radius: var(--radius);
  background: #fff; color: var(--ink-900); font: inherit; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s; appearance: none;
}
.field select, select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b6058' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 2.4em;
}
.field textarea { min-height: 104px; resize: vertical; }
.input:hover, .field input:hover, .field select:hover, .field textarea:hover { border-color: var(--gold-500); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold-500); box-shadow: var(--ring); }
.field .hint { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--ink-500); line-height: 1.5; }
.field .error-text { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--danger-500); font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger-500); background: #fffafa; }
.field.has-error input:focus, .field.has-error select:focus, .field.has-error textarea:focus { box-shadow: 0 0 0 3px rgba(176, 42, 55, .2); }
.input-group { position: relative; }
.input-group .input-addon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.input-group input { padding-right: 3.2em; }

.form-section { padding: 26px 0; border-top: 1px solid var(--line-soft); }
.form-section:first-child { border-top: 0; padding-top: 4px; }
.form-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 16px; }
.form-section-title { font-size: var(--fs-md); margin: 0; color: var(--maroon-700); white-space: nowrap; }
.form-section-note { font-size: var(--fs-xs); color: var(--ink-500); }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding-top: 8px; }

.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); cursor: pointer; }
.checkbox input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--maroon-600); flex: none; }

/* Segmented radio (वधू / वर) */
.segmented { display: inline-flex; padding: 4px; background: var(--line-soft); border-radius: 12px; gap: 4px; }
.segmented label { margin: 0; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
  display: block; padding: .55em 1.9em; border-radius: 9px; font-weight: 700; color: var(--ink-500);
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented input:checked + span { background: #fff; color: var(--maroon-600); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

/* File picker */
.file-pick { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1.5px dashed #d3c6b2; border-radius: var(--radius); background: var(--surface-2); }
.file-pick:hover { border-color: var(--gold-500); background: var(--gold-50); }
.file-pick input[type="file"] { flex: 1; min-width: 0; font: inherit; font-size: var(--fs-sm); }
.file-pick .preview { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; background: var(--line); flex: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-body { padding: 26px; }
.card-header { padding: 18px 26px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: var(--fs-md); }
.card-footer { padding: 16px 26px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-flat { box-shadow: none; }
.card + .card { margin-top: 20px; }

/* ---------- Badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: .35em; padding: .15em .75em; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.7; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success-700); }
.badge-warning { background: var(--warning-bg); color: var(--warning-700); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-700); }
.badge-info    { background: var(--info-bg);    color: var(--info-700); }
.badge-neutral { background: var(--line-soft);  color: var(--ink-700); }
.badge-primary { background: var(--maroon-100); color: var(--maroon-700); }
.badge-gold    { background: var(--gold-100);   color: var(--gold-700); }
.chip { display: inline-block; padding: .1em .7em; border-radius: 8px; font-size: var(--fs-xs); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-700); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; font-size: var(--fs-sm); line-height: 1.65; }
.alert .icon { margin-top: 3px; width: 1.25em; height: 1.25em; }
.alert-title { display: block; font-weight: 700; }
.alert-info    { background: var(--info-bg);    border-color: #c4dbee; color: var(--info-700); }
.alert-success { background: var(--success-bg); border-color: #bfe0cd; color: var(--success-700); }
.alert-warning { background: var(--warning-bg); border-color: #f0d9a0; color: var(--warning-700); }
.alert-danger  { background: var(--danger-bg);  border-color: #efc3c8; color: var(--danger-700); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 24px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px;
  padding: .7em 1.1em; font: 600 var(--fs-base)/1.4 var(--font); color: var(--ink-500); cursor: pointer; white-space: nowrap;
  display: inline-flex; gap: .5em; align-items: center;
}
.tab:hover { color: var(--maroon-700); }
.tab.is-active { color: var(--maroon-600); border-bottom-color: var(--gold-500); }
.tab-panel > :first-child { margin-top: 0 !important; }  /* page tabs (SM tabify): no extra gap under the tab bar */

/* ---------- Definition list ---------- */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin: 0; }
.dl-item { padding: 12px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.dl-item.span-2 { grid-column: span 2; }
.dl dt { font-size: var(--fs-xs); color: var(--ink-500); font-weight: 600; margin-bottom: 2px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dl dd.is-empty { color: var(--ink-400); font-weight: 400; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; padding: 12px 16px; background: var(--surface-2); color: var(--ink-500); font-weight: 700; font-size: var(--fs-xs); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--gold-50); }
.cell-user { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.avatar { width: 44px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.avatar-sm { width: 36px; height: 44px; }
.cell-user strong { display: block; line-height: 1.35; }
.cell-user small { color: var(--ink-500); }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.table td:last-child { white-space: nowrap; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.page-btn {
  min-width: 40px; height: 40px; padding: 0 .7em; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm);
  font: 600 var(--fs-sm)/1 var(--font); color: var(--ink-700); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.page-btn:hover:not([disabled]) { border-color: var(--gold-500); background: var(--gold-50); }
.page-btn.is-active { background: var(--maroon-600); border-color: var(--maroon-600); color: #fff; }
.page-btn[disabled] { opacity: .4; cursor: default; }
.page-info { font-size: var(--fs-sm); color: var(--ink-500); margin: 0 8px; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--maroon-500)); border-radius: 99px; transition: width .6s var(--ease); }

/* ---------- Skeleton & empty state ---------- */
.skeleton { background: linear-gradient(90deg, var(--line-soft) 25%, #f7f2ea 37%, var(--line-soft) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty-state { text-align: center; padding: 56px 20px; color: var(--ink-500); }
.empty-state .icon { width: 44px; height: 44px; color: var(--gold-500); stroke-width: 1.5; margin-bottom: 8px; }
.empty-state h3 { color: var(--ink-700); margin-bottom: 4px; }

/* ---------- Modal ----------
   STANDING RULE (knowledge base §0.1 rule 13): EVERY popup has a FIXED HEADER (title + close), a FIXED FOOTER (the action
   buttons) and ONLY the content between them scrolls. Never put the buttons inside the scrolling part.
   Markup: .modal > .modal-head + .modal-body + .modal-actions   (a form popup wraps body + actions in one <form>). */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900; background: rgba(35, 15, 22, .6);   /* no backdrop-filter blur: it made popups slow to react on weak phones */
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 460px; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop .2s var(--ease);
  display: flex; flex-direction: column; overflow: hidden; padding: 0;
  max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
}
.modal > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
.modal-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 22px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.modal-title { margin: 0; flex: 1; min-width: 0; font-size: var(--fs-lg); overflow-wrap: anywhere; }
.modal-close { flex: none; }
.btn svg, .btn .icon, .guna-pop-close svg { pointer-events: none; }   /* a click on the icon is a click on the button */
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px; color: var(--ink-700); }
.modal-actions { flex: none; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 640px) {
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .modal-head { padding-left: 16px; } .modal-body { padding: 14px 16px; } .modal-actions { padding: 12px 16px; }
  .modal-actions .btn { flex: 1 1 auto; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Message popups (every message is a popup, see SM.ui.notify) ---------- */
.modal-notice { max-width: 440px; }
.modal-notice .modal-head { border-top: 4px solid var(--maroon-800); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal-notice.modal-success .modal-head { border-top-color: var(--success-700); }
.modal-notice.modal-error .modal-head { border-top-color: var(--danger-700); }
.modal-notice .modal-body { white-space: pre-line; overflow-wrap: anywhere; }

/* ---- PDF dialog (preview + print + download) and progress overlay ---- */
.pdf-dialog { position: fixed; inset: 0; z-index: 200; background: rgba(35, 27, 24, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pdf-panel { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(960px, 100%); height: min(92vh, 1000px); display: flex; flex-direction: column; overflow: hidden; }
.pdf-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.pdf-bar strong { display: inline-flex; align-items: center; gap: 6px; color: var(--maroon-800); }
.pdf-frame { flex: 1; width: 100%; border: 0; background: #e9e4da; min-height: 0; }
.pdf-foot { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.pdf-note { margin: 0; flex: 1 1 220px; font-size: var(--fs-xs); color: var(--ink-500); }
.pdf-busy { position: fixed; inset: 0; z-index: 210; background: rgba(251, 248, 243, .8); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--maroon-800); font-weight: 600; }
.pdf-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--maroon-600); animation: pdfspin .8s linear infinite; }
@keyframes pdfspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pdf-spin { animation-duration: 2.4s; } }

/* ---- small utilities used by the portals ---- */
.text-danger { color: var(--danger-500); font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---- link preview under a field (readable, wraps long URLs) ---- */
.link-preview { margin-top: 8px; padding: 9px 12px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 2px; }
.link-preview span { font-size: var(--fs-xs); color: var(--ink-500); }
.link-preview strong { font-size: var(--fs-sm); color: var(--maroon-800); font-weight: 600; word-break: break-all; font-family: inherit; }

/* ---- platform landing: "find your firm" box + package cards ---- */
.find-firm { margin-top: -28px; position: relative; z-index: 2; }
.find-firm-text h2 { margin: 0 0 4px; font-size: var(--fs-lg, 1.25rem); }
.find-firm-text p { margin: 0 0 12px; color: var(--ink-500); font-size: var(--fs-sm); }
.find-firm-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.find-firm-row .input { flex: 1; min-width: 220px; }
.find-firm-prefix { display: inline-flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-500); font-size: var(--fs-sm); word-break: break-all; max-width: 100%; }
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.pkg h3 { margin: 0 0 4px; color: var(--maroon-800); }
.pkg-price { font-size: 1.7rem; font-weight: 700; color: var(--maroon-700); margin: 0 0 6px; }
.pkg-price small { font-size: var(--fs-sm); font-weight: 400; color: var(--ink-500); }
.pkg-list { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; gap: 6px; font-size: var(--fs-sm); }
.pkg-list li::before { content: "✓"; color: var(--success-500); font-weight: 700; margin-right: 8px; }
.pkg-list li.no { color: var(--ink-500); text-decoration: line-through; opacity: .75; }
.pkg-list li.no::before { content: "✕"; color: var(--ink-500); }
.pkg-list li.ads::before { content: "ℹ"; color: var(--info, #255e91); }
.pkg-old { font-size: var(--fs-base); font-weight: 400; color: var(--ink-500); }
.pkg-offer { margin: 0 0 8px; }
.pkg-hot { border-top: 3px solid var(--gold-500); }
.firm-contact .dl { margin: 0; }

