/* Thirumanam - component styles layered on Tailwind
   Palette: kumkumam rose for action, manjal gold for celebration, warm paper canvas. */

:root {
    color-scheme: light;
    --brand-600: #be123c;
    --brand-700: #9f1239;
    --gold-500: #f59e0b;
}

body { -webkit-font-smoothing: antialiased; }

/* ---------- Page-navigation loader ---------- */
#pageLoader.page-loader-visible {
    opacity: 1;
    pointer-events: auto;
}
.page-loader-spinner {
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    border: 3px solid #fecdd3;
    border-top-color: var(--brand-600);
    animation: page-loader-spin .7s linear infinite;
}
@keyframes page-loader-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Sidebar nav ---------- */
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .8rem;
    border-radius: .7rem;
    font-size: .875rem;
    font-weight: 500;
    color: #57534e;
    transition: background-color .15s ease, color .15s ease;
}
.nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; color: #a8a29e; transition: color .15s ease; }
.nav-link:hover { background: #fdf2f4; color: #1c1917; }
.nav-link:hover i { color: var(--brand-600); }

.nav-active,
.nav-active:hover {
    background: linear-gradient(90deg, #e11d48 0%, #9f1239 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(190, 18, 60, .28);
}
.nav-active i, .nav-active:hover i { color: #fff; }
.nav-active::before {
    content: "";
    position: absolute;
    left: -0.75rem; top: 50%;
    transform: translateY(-50%);
    height: 1.4rem; width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--gold-500);
}

.nav-section {
    padding: .9rem .8rem .3rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #a8a29e;
}

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border: 1px solid #f0e7e4;
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(68, 24, 32, .04), 0 4px 16px rgba(68, 24, 32, .05);
}
.shadow-card { box-shadow: 0 1px 2px rgba(68, 24, 32, .04), 0 4px 16px rgba(68, 24, 32, .06); }

/* Profile card lift on hover - the grid should feel alive */
.profile-card { transition: transform .18s ease, box-shadow .18s ease; }
.profile-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(68, 24, 32, .13); }

/* Photo placeholder: initials on a warm gradient, never a grey box */
.photo-fallback {
    background: linear-gradient(135deg, #fecdd3 0%, #fda4af 45%, #fbbf24 100%);
    color: #7f1d1d;
    font-weight: 700;
    letter-spacing: .04em;
}
.photo-fallback-groom { background: linear-gradient(135deg, #fed7aa 0%, #fdba74 45%, #f472b6 100%); color: #7c2d12; }

/* ---------- Forms ---------- */
.form-label { display: block; font-size: .8rem; font-weight: 600; color: #44403c; margin-bottom: .35rem; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    border: 1px solid #e7ddda;
    border-radius: .65rem;
    padding: .6rem .8rem;
    font-size: .9rem;
    background: #fff;
    color: #1c1917;
    transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(190, 18, 60, .13);
}
.form-input::placeholder { color: #b6a9a5; }
.form-hint { font-size: .75rem; color: #a8a29e; margin-top: .25rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
    font-weight: 600; font-size: .875rem; border-radius: .7rem; padding: .6rem 1.1rem;
    transition: all .15s ease; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: linear-gradient(135deg, #e11d48, #be123c); color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 20px rgba(190, 18, 60, .32); transform: translateY(-1px); }
.btn-gold { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-gold:hover { box-shadow: 0 8px 20px rgba(217, 119, 6, .32); transform: translateY(-1px); }
.btn-outline, .btn-ghost { background: #fff; color: #44403c; border-color: #e7ddda; }
.btn-outline:hover, .btn-ghost:hover { background: #fdf2f4; border-color: #fecdd3; color: var(--brand-700); }
.btn-danger { background: #fff; color: #e11d48; border-color: #fecdd3; }
.btn-danger:hover { background: #fff1f2; }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; border-radius: .6rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Badges and chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 9999px;
}
.chip, .chip-active {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .45rem 1rem; border-radius: 9999px;
    font-size: .8rem; font-weight: 600;
    border: 1px solid #e7ddda; transition: all .15s ease; cursor: pointer;
}
.chip { background: #fff; color: #78716c; }
.chip:hover { border-color: #fecdd3; color: var(--brand-700); }
.chip-active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); box-shadow: 0 4px 12px rgba(190, 18, 60, .25); }

/* Trait pills that toggle via a hidden checkbox */
.trait-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem .9rem; border-radius: 9999px;
    border: 1px solid #e7ddda; background: #fff; color: #57534e;
    font-size: .82rem; font-weight: 500; cursor: pointer; transition: all .15s ease;
}
.trait-pill:hover { border-color: #fda4af; }
.trait-input:checked + .trait-pill {
    background: #fff1f2; border-color: var(--brand-600); color: var(--brand-700); font-weight: 600;
}
.trait-input:checked + .trait-pill i { color: var(--brand-600); }
.trait-input { position: absolute; opacity: 0; width: 0; height: 0; }

/* ---------- KPI tiles ---------- */
.kpi-icon { height: 2.75rem; width: 2.75rem; border-radius: .8rem; display: grid; place-items: center; font-size: 1.15rem; }

/* ---------- Match ring ---------- */
.match-ring { transform: rotate(-90deg); }
.match-ring circle { transition: stroke-dashoffset .6s ease; }

/* ---------- Tabs ---------- */
.tab-link {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .6rem .95rem; border-radius: .7rem .7rem 0 0;
    font-size: .85rem; font-weight: 600; color: #78716c;
    border-bottom: 2px solid transparent;
}
.tab-link:hover { color: var(--brand-700); background: #fdf2f4; }
.tab-active { color: var(--brand-700); border-bottom-color: var(--brand-600); background: #fff1f2; }

/* ---------- Tables ---------- */
table.datatable tbody td { padding: .7rem .75rem; font-size: .875rem; }
table.datatable thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #78716c;
    padding: .6rem .75rem; text-align: left; border-bottom: 1px solid #f0e7e4;
}
table.datatable tbody tr { border-bottom: 1px solid #faf5f4; }
table.datatable tbody tr:hover { background: #fffbfa; }

/* ---------- Toast ---------- */
#toast, #flash { animation: slideDown .3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Decorative kolam divider ---------- */
.kolam-rule {
    height: 6px;
    background-image: radial-gradient(circle, #fda4af 1.5px, transparent 1.6px);
    background-size: 14px 6px;
    opacity: .7;
}

/* ---------- Blurred photo notice ---------- */
.photo-blur { filter: blur(12px); transform: scale(1.05); }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------- Trust stamps ----------
   Heavier than a badge on purpose: these are the claims a family acts on. */
.stamp {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .8rem;
    border-radius: .75rem;
    border: 1.5px solid;
    background: #fff;
    line-height: 1.15;
}
.stamp i { font-size: 1.15rem; }
.stamp-title { display: block; font-size: .8rem; font-weight: 700; }
.stamp-sub { display: block; font-size: .68rem; opacity: .75; margin-top: .1rem; }

.stamp-emerald { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.stamp-sky     { border-color: #bae6fd; background: #f0f9ff; color: #0369a1; }
.stamp-gold    { border-color: #fde68a; background: #fffbeb; color: #b45309; }
.stamp-violet  { border-color: #ddd6fe; background: #f5f3ff; color: #6d28d9; }

/* Compact pips for cards */
.stamp-pip {
    display: inline-grid;
    place-items: center;
    height: 1.15rem;
    width: 1.15rem;
    border-radius: 9999px;
    color: #fff;
    font-size: .62rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}

/* ---------- Masked contact ---------- */
.masked-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .06em;
    color: #a8a29e;
    background: #f5f5f4;
    padding: .15rem .5rem;
    border-radius: .4rem;
}

/* ---------- Written introduction card ---------- */
.summary-card {
    background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 55%, #faf5ff 100%);
    border: 1px solid #fde68a;
}

/* ---------- Scheme cards on the help pages ---------- */
.scheme-card { border-left: 4px solid var(--gold-500); }

/* ---------- Search page: skeleton loader ----------
   Same card shape as .profile-card so nothing jumps in size when the real
   cards replace it. */
.skeleton-card {
    background: #fff;
    border: 1px solid #f0e7e4;
    border-radius: 1rem;
    overflow: hidden;
}
.skeleton-shimmer {
    background: linear-gradient(90deg, #f5f0ee 25%, #ebe3e0 37%, #f5f0ee 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ---------- Search page: results fade-in after a swap ---------- */
.results-fade-in { animation: results-fade-in .25s ease; }
@keyframes results-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Search page: filter drawer ---------- */
#filterDrawer.drawer-open { transform: translateX(0); }
#filterDrawerOverlay.overlay-open { display: block; }

/* ---------- Quick share sheet ----------
   Bottom sheet on mobile, centered modal on desktop - the panel animates in on its own
   whenever the modal's `hidden` class is removed (CSS animations restart automatically
   when an element goes from display:none to visible, no JS timing needed). */
.quick-share-panel { animation: qs-sheet-in .3s cubic-bezier(.32, .72, 0, 1); }
@keyframes qs-sheet-in {
    from { transform: translateY(100%); opacity: .5; }
    to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 640px) {
    .quick-share-panel { animation: qs-modal-in .2s ease-out; }
    @keyframes qs-modal-in {
        from { transform: scale(.94) translateY(10px); opacity: 0; }
        to { transform: scale(1) translateY(0); opacity: 1; }
    }
}
.quick-share-icon { transition: transform .15s ease; }
.quick-share-icon:active { transform: scale(.92); }
.quick-share-icon span { transition: box-shadow .15s ease; }
.quick-share-icon:hover span { box-shadow: 0 6px 16px rgba(28, 25, 23, .22); }

/* ---------- Download (browser print-to-PDF) ----------
   The "Download" button on the profile and porutham pages just triggers window.print();
   this hides everything that isn't the actual content so what gets saved/printed is a
   clean report instead of the app chrome. .no-print marks page-level bits (the buttons
   themselves, quick-share/modal, etc.) that would otherwise show up in the printout. */
@media print {
    #sidebar, header, #overlay, .no-print, [data-modal] { display: none !important; }
    .flex-1.lg\:pl-72 { padding-left: 0 !important; }
    body { background: #fff !important; }
}
