/* ===================================================
   MK BRAHMAN — Main App Stylesheet
   Mobile-first, compact table-layout design
   =================================================== */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --brand:        #c0392b;
    --brand-dark:   #922b21;
    --brand-light:  #fadbd8;
    --accent:       #e74c3c;
    --male:         #1a5276;
    --male-bg:      #d6eaf8;
    --female:       #7d3c98;
    --female-bg:    #e8daef;
    --text-primary: #1a1a2e;
    --text-muted:   #6b7280;
    --border:       #e5e7eb;
    --bg-main:      #f8f9fa;
    --bg-card:      #ffffff;
    --bg-header:    #1a1a2e;
    --header-text:  #ffffff;
    --shortlist-on: #e74c3c;
    --shortlist-off:#cbd5e1;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
    --shadow-md:    0 4px 16px rgba(0,0,0,.12);
    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    16px;
    --font-main:    'Poppins', 'Noto Sans Devanagari', sans-serif;
    --sidebar-w:    280px;
    --header-h:     52px;
}

html { font-size: 14px; }

body {
    font-family: var(--font-main);
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---------- CONTAINER ---------- */
.container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg-card);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ---------- HEADER ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    color: var(--header-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: var(--header-h);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

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

.menu-btn, .more-btn {
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 20px;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background .2s;
    line-height: 1;
}

.menu-btn:hover, .more-btn:hover {
    background: rgba(255,255,255,.15);
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .3px;
    color: var(--header-text);
}

.header-subtitle {
    font-size: 10px;
    color: rgba(255,255,255,.65);
    font-weight: 300;
    display: block;
    line-height: 1;
    margin-top: 1px;
}

/* ---------- SEARCH BOX ---------- */
.search-box {
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-h);
    z-index: 90;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap input {
    width: 100%;
    height: 36px;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 0 36px 0 14px;
    font-size: 13px;
    background: var(--bg-main);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.search-input-wrap input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(192,57,43,.12);
    background: #fff;
}

/* Mobile search row — sits below general search */
.mobile-search-wrap {
    margin-top: 6px;
}

.mobile-search-wrap input {
    padding-left: 36px;
    border-color: #0891b2;
    background: #f0f9ff;
    letter-spacing: .5px;
}

.mobile-search-wrap input:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,.12);
    background: #fff;
}

.mobile-search-wrap .search-icon {
    left: 10px;
    right: auto;
    font-size: 14px;
}

.search-input-wrap .search-icon {
    position: absolute;
    right: 10px;
    font-size: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ---------- OVERLAY ---------- */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    opacity: 0;
    transition: opacity .3s;
}

.overlay.active {
    display: block;
    opacity: 1;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100%;
    background: var(--bg-card);
    z-index: 300;
    transform: translateX(calc(-1 * var(--sidebar-w)));
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-header);
    color: #fff;
    flex-shrink: 0;
}

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

.sidebar-logo-icon { font-size: 22px; }

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 16px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.close-btn:hover { background: rgba(255,255,255,.3); }

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: background .2s, color .2s;
    margin-bottom: 4px;
    position: relative;
}

.side-link:hover { background: var(--bg-main); }

.side-link.active {
    background: var(--brand-light);
    color: var(--brand);
}

.side-link-icon { font-size: 18px; width: 24px; text-align: center; }

.badge {
    margin-left: auto;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    background: var(--brand);
    color: #fff;
    transition: background .2s;
    border: none;
}

.admin-btn:hover { background: var(--brand-dark); }

.admin-btn--dashboard {
    background: #1a5276;
}
.admin-btn--dashboard:hover { background: #154360; }

.admin-btn--logout {
    background: #7f8c8d;
}
.admin-btn--logout:hover { background: #5d6d7e; }

/* ---------- COMPACT TABLE ---------- */
.table-wrapper {
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
}

.compact-table thead {
    position: sticky;
    top: 0;
    z-index: 50;
}

.compact-table thead tr {
    background: var(--bg-header);
    color: #fff;
}

.compact-table th {
    padding: 8px 6px;
    font-weight: 600;
    font-size: 11px;
    text-align: left;
    white-space: nowrap;
    letter-spacing: .2px;
    border-right: 1px solid rgba(255,255,255,.1);
}

.compact-table th:last-child { border-right: none; }

.compact-table th.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: background-color .15s, color .15s;
}

.compact-table th.sortable-th:hover {
    background: rgba(255,255,255,.18);
    color: #ffeb3b;
}

.compact-table th.sortable-th.th-sorted {
    background: rgba(192,57,43,.55);
    color: #fff;
    box-shadow: inset 0 -2px 0 #ffeb3b;
}

.th-content {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    justify-content: space-between;
}

.th-sort-icon {
    font-size: 10px;
    opacity: 0.5;
    display: inline-block;
    min-width: 10px;
    text-align: center;
    transition: opacity .15s, transform .15s;
    line-height: 1;
}

.sortable-th:hover .th-sort-icon {
    opacity: 0.9;
}

.sortable-th.th-sorted .th-sort-icon {
    opacity: 1;
    color: #ffeb3b;
    font-weight: bold;
}

.compact-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

.compact-table tbody tr:hover { background: #fafafa; }

.compact-table tbody tr:last-child { border-bottom: none; }

.compact-table td {
    padding: 7px 6px;
    vertical-align: middle;
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Gender badge */
.gender-m {
    display: inline-block;
    background: var(--male-bg);
    color: var(--male);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    white-space: nowrap;
}

.gender-f {
    display: inline-block;
    background: var(--female-bg);
    color: var(--female);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Shortlist button */
.shortlist-btn {
    background: none;
    border: none;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
    transition: transform .15s;
    display: block;
    margin: 0 auto;
}

.shortlist-btn:active { transform: scale(1.3); }

.shortlist-btn.loading { opacity: .5; pointer-events: none; }

/* ---------- EMPTY STATE ---------- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 52px; margin-bottom: 12px; }

.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }

.empty-state p { font-size: 13px; }

/* ---------- LOADING SPINNER ---------- */
.spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin: 20px auto;
}

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

/* ---------- PAGE SECTION TITLE ---------- */
.section-tag {
    padding: 6px 12px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-tag .count { font-weight: 700; color: var(--brand); }

/* ---------- MORE MENU DROPDOWN ---------- */
.more-menu {
    position: absolute;
    top: calc(var(--header-h) + 4px);
    right: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 150;
    min-width: 160px;
    overflow: hidden;
    display: none;
}

.more-menu.open { display: block; }

.more-menu a, .more-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    font-size: 13px;
    color: var(--text-primary);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: background .15s;
}

.more-menu a:hover, .more-menu button:hover { background: var(--bg-main); }

/* ---------- TOAST NOTIFICATION ---------- */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #1a1a2e;
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 500;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- SHORTLISTED PAGE HEADER ---------- */
.page-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: var(--header-h);
    background: var(--bg-header);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.back-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background .2s;
    text-decoration: none;
    flex-shrink: 0;
}

.back-btn:hover { background: rgba(255,255,255,.3); }

/* ---------- SHORTLISTED HEART COLUMN ---------- */
.col-heart { width: 36px; text-align: center; }

/* ---------- CLICKABLE PROFILE ROWS ---------- */
.compact-table tbody tr.profile-row {
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.compact-table tbody tr.profile-row:hover td {
    background: #eef2ff;
}

.compact-table tbody tr.profile-row:active td {
    background: #dbeafe;
}

.compact-table tbody tr.profile-row:focus {
    outline: none;
}

.compact-table tbody tr.profile-row:focus-visible td:first-child {
    box-shadow: inset 3px 0 0 var(--brand);
}

/* ---------- EXPORT BUTTON IN HEADER ---------- */
.export-header-btn {
    background: rgba(39, 174, 96, .2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background .2s;
    text-decoration: none;
    flex-shrink: 0;
}

.export-header-btn:hover { background: rgba(39, 174, 96, .4); }

/* ---------- RESPONSIVE TWEAKS ---------- */
@media (min-width: 480px) {
    .container { box-shadow: var(--shadow-md); }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ---------- FILTER BAR ---------- */
/*  One-line pill strip: [सर्व | मुलगा | मुलगी]  ···  [नोंद ▾ ][↓]  */
.filter-bar {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-top: 8px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    height: 34px;
}

/* Left: gender segmented control */
.filter-gender-group {
    display: flex;
    align-items: stretch;
    flex: 1;
    min-width: 0;
}

/* Right: sort controls */
.filter-sort-group {
    display: flex;
    align-items: stretch;
    border-left: 1.5px solid var(--border);
    flex-shrink: 0;
}

/* Gender chips — behave like a segmented control */
.filter-chip {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 8px;
    border: none;
    border-right: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
    min-width: 0;
}

.filter-chip:last-of-type { border-right: none; }

.filter-chip:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
}

.filter-chip[data-gender="1"].active { background: var(--male);   color: #fff; }
.filter-chip[data-gender="2"].active,
.filter-chip[data-gender="0"].active { background: var(--female); color: #fff; }

/* Quick Sort Actions Bar */
.quick-sort-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    overflow: hidden;
}

.quick-sort-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.quick-sort-scroll {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.quick-sort-scroll::-webkit-scrollbar {
    display: none;
}

.quick-sort-btn {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #4b5563;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: all .15s ease;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1.3;
}

.quick-sort-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.quick-sort-btn:active {
    transform: scale(0.94);
}

.quick-sort-btn.active {
    background: var(--brand);
    color: #ffffff;
    border-color: var(--brand);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(192,57,43,0.25);
}

/* Sort column selector */
.sort-select {
    height: 100%;
    padding: 0 18px 0 8px;
    border: none;
    border-right: 1px solid var(--border);
    font-size: 11.5px;
    font-family: var(--font-main);
    color: var(--text-primary);
    background: #fff;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    min-width: 80px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    transition: background-color .15s;
}

.sort-select:hover,
.sort-select:focus { background-color: var(--bg-main); }

/* Sort direction toggle */
.sort-dir-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    border: none;
    background: #fff;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.sort-dir-btn:hover  { background: var(--bg-main); color: var(--brand); }
.sort-dir-btn:active { transform: scale(0.88); }
.sort-dir-btn[data-dir="ASC"] { color: var(--brand); }

.sort-icon {
    display: inline-block;
    line-height: 1;
    font-weight: 700;
}

