/* ============================================================
   NoBroker VMS – Society Health Report  |  Premium Design v2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    /* Brand */
    --brand: #e72c32;
    --brand-dark: #B01219;
    --brand-light: #FEF2F2;

    /* Navy / dark */
    --navy: #0F172A;
    --navy-2: #1E3A5F;
    --navy-3: #1E293B;
    --navy-pale: #EEF4FD;

    /* Neutrals */
    --bg: #F1F5F9;
    --surface: #FFFFFF;
    --surface-2: #F8FAFC;
    --border: #E2E8F0;
    --border-2: #CBD5E1;

    /* Text */
    --text-1: #0F172A;
    --text-2: #334155;
    --text-3: #64748B;
    --text-4: #94A3B8;

    /* Semantic */
    --green: #16A34A;
    --green-mid: #15803D;
    --green-lt: #F0FDF4;
    --green-border: #BBF7D0;

    --red: #DC2626;
    --red-lt: #FEF2F2;
    --red-border: #FECACA;

    --wa-green: #25D366;
    --wa-dark: #128C7E;

    /* Shadows */
    --sh-xs: 0 1px 2px rgba(15, 23, 42, .06);
    --sh-sm: 0 1px 4px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
    --sh-md: 0 4px 16px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .06);
    --sh-lg: 0 12px 40px rgba(15, 23, 42, .12), 0 4px 12px rgba(15, 23, 42, .08);

    /* Radii */
    --r-xs: 4px;
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;

    /* Transition */
    --ease: all .18s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #FCF8E8;
    color: var(--text-1);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ─────────────────────────────────────────────────── */
.wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px;
}

.topbar {
    background: #ee0625;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 12px rgba(245, 37, 37, .35);
}

.topbar-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.topbar-society {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.topbar-name {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    text-transform: uppercase;
}

.topbar-sub {
    font-size: 10.5px;
    font-weight: 500;
    color: #ffffff !important;
    letter-spacing: .8px;
    text-transform: uppercase;
    margin-top: 2px;
    white-space: nowrap;
    opacity: 1 !important;
}

.topbar-date {
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 500;
    color: #ffffff !important;
    white-space: nowrap;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .12);
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, .18);
    opacity: 1 !important;
}

/* ── Stacked Panels ────────────────────────────────────────── */
.content-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-md);
    overflow: hidden;
    margin-bottom: 24px;
    animation: fadeUp .3s ease-out;
}

#sug-wa,
#sug-flats-scroll {
    cursor: pointer;
}

#sug-wa:hover,
#sug-flats-scroll:hover {
    border-left-color: var(--wa-green);
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
    padding: 24px 0 48px;
}

/* ── Two-column Split ───────────────────────────────────────── */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: flex-start;
    width: 100%;
}

.split-left {
    display: flex;
    flex-direction: column;
}

.split-right {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-md);
    overflow: hidden;
    position: sticky;
    top: 24px;
    transition: outline 0.3s ease;
}

/* For the ring effect in JS */
.split-right[style*="ring"] {
    outline: 3px solid var(--primary) !important;
    outline-offset: 2px;
}

/* ── Panel Header Banner ────────────────────────────────────── */
.panel-header {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #233b6a;
    padding: 12px 20px;
    flex-shrink: 0;
}

.panel-header-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}



.panel-title {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    letter-spacing: .7px;
    text-transform: uppercase;
    line-height: 1.2;
}

.panel-header .panel-subtitle {
    font-size: 11.5px;
    color: #ffffff !important;
    margin-top: 3px;
    line-height: 1.35;
    font-weight: 400;
    opacity: 1 !important;
}

/* ── Panel Body ─────────────────────────────────────────────── */
.panel-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

/* ── Suggestion List ────────────────────────────────────────── */
.suggestion-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 5px solid #233b6a;
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.45;
    transition: var(--ease);
    cursor: default;
}

.suggestion-list li:hover {
    background: #eef4fd;
    border-color: #dbeafe;
    border-left-color: #355288;
    transform: translateX(2px);
}

.sug-num {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    background: #233b6a;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

/* ── WhatsApp Card ───────────────────────────────────────────── */
.wa-card {
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-bottom: 0;
    box-shadow: var(--sh-xs);
}

.wa-head {
    background: linear-gradient(135deg, #075E54, #25D366);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-head h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .2px;
}

.wa-head p {
    color: rgba(255, 255, 255, .8);
    font-size: 13px;
    margin-top: 2px;
}

.wa-body {
    padding: 16px 20px;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.wa-lbl {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-4);
    margin-bottom: 9px;
}

.wa-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.65;
    resize: none;
    flex: 1;
    background: var(--surface);
    transition: var(--ease);
    white-space: pre-wrap;
    unicode-bidi: plaintext;
}

.wa-textarea:focus {
    outline: none;
    border-color: var(--wa-green);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, .12);
}

.btn-wa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #075E54, #25D366);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    padding: 14px 32px;
    border-radius: 35px;
    border: none;
    cursor: pointer;
    margin-top: 12px;
    transition: var(--ease);
    box-shadow: 0 4px 14px rgba(37, 211, 102, .30);
    letter-spacing: .2px;
}

.btn-wa:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(37, 211, 102, .40);
}

/* ── Flat Stats Row ─────────────────────────────────────────── */
.flat-summary-row {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

.flat-summary-row .flat-stat {
    min-width: 140px;
    max-width: 180px;
}

.flat-stat {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--sh-xs);
    transition: var(--ease);
}

.flat-stat:hover {
    box-shadow: var(--sh-md);
    transform: translateY(-2px);
}

/* Total Flats */
.flat-stat.total {
    background: #f3ff8b;
    border-color: #d4dd5f;
}

.flat-stat.total .flat-stat-val {
    color: #000;
}

.flat-stat.total .flat-stat-lbl {
    color: #000;
}

/* App Installed */
.flat-stat.green {
    background: #cfff94;
    border-color: #63c747;
}

.flat-stat.green .flat-stat-lbl {
    color: #000;
}

/* Not Installed */
.flat-stat.red {
    background: #ffabab;
    border-color: #f45454;
}

.flat-stat.red .flat-stat-lbl {
    color: #000;
}

/* Download Rate */
.flat-stat.rate {
    background: #d1ffe1;
    border-color: #46ffd1;
}

.flat-stat.rate .flat-stat-val {
    color: #000;
}

.flat-stat.rate .flat-stat-lbl {
    color: #000;
}

.flat-stat-val {
    font-size: 24px;
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
    letter-spacing: -.5px;
}

.flat-stat.green .flat-stat-val {
    color: #000;
}

.flat-stat.red .flat-stat-val {
    color: #000;
}

.flat-stat-lbl {
    font-size: 9.5px;
    font-weight: 600;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 5px;
}

/* ── Flat Toolbar ───────────────────────────────────────────── */
.flat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Not Installed Inline Badge ─────────────────────────────── */
.not-installed-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffabab;
    border: 1.5px solid #f45454;
    border-radius: var(--r-sm);
    padding: 6px 16px;
    flex-shrink: 0;
    min-width: 90px;
    box-shadow: var(--sh-xs);
}

.ni-val {
    font-size: 20px;
    font-weight: 800;
    color: #000;
    line-height: 1;
    letter-spacing: -.5px;
}

.ni-lbl {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #000;
    margin-top: 3px;
}

.flat-search {
    flex: 1;
    min-width: 120px;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--text-1);
    background: #FFFFE6;
    transition: var(--ease);
}

.flat-search::placeholder {
    color: var(--text-4);
}

.flat-search:focus {
    outline: none;
    border-color: var(--navy-2);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, .10);
}

.dl-btns {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-dl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: var(--r-sm);
    border: none;
    cursor: pointer;
    transition: var(--ease);
    letter-spacing: .1px;
}

.btn-dl-img {
    background: #3C5A96;
    color: #fff;
    box-shadow: var(--sh-sm);
}

.btn-dl-img:hover {
    background: #304a7d;
    transform: translateY(-1px);
    box-shadow: var(--sh-md);
}

.btn-dl-pdf {
    background: #FF5C5C;
    color: #fff;
    box-shadow: var(--sh-sm);
}

.btn-dl-pdf:hover {
    background: #e04444;
    transform: translateY(-1px);
    box-shadow: var(--sh-md);
}

/* ── Flat Grid ───────────────────────────────────────────────── */
.flat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    max-height: 700px;
    align-content: flex-start;
}

.flat-chip {
    background: #fef38b;
    border: 1.2px solid #ffea2f;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    box-shadow: var(--sh-xs);
    text-transform: uppercase;
    color: var(--text-1);
    transition: var(--ease);
}

.flat-chip:hover {
    background: #FECACA;
    border-color: var(--red);
    transform: scale(1.05);
    box-shadow: var(--sh-sm);
}

.flat-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-4);
    padding: 24px;
    font-size: 13px;
}

/* ── Loading ────────────────────────────────────────────────── */
.loading-wrap {
    min-height: 65vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-3);
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

/* ── Error ──────────────────────────────────────────────────── */
.error-wrap {
    min-height: 65vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    padding: 40px;
}

.error-icon {
    font-size: 48px;
}

.error-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--navy);
}

.error-msg {
    color: var(--text-3);
    max-width: 360px;
    font-size: 13.5px;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Scrollbar styling ──────────────────────────────────────── */
.flat-grid::-webkit-scrollbar {
    width: 5px;
}

.flat-grid::-webkit-scrollbar-track {
    background: transparent;
}

.flat-grid::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 6px;
}

.flat-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-4);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 960px) {
    .split-layout {
        grid-template-columns: 1fr;
    }

    .split-left,
    .split-right {
        height: auto;
    }
}

@media (max-width: 640px) {
    .wrap {
        padding: 0 16px;
    }

    .topbar-inner {
        padding: 0 16px;
    }

    .flat-summary-row {
        justify-content: flex-start;
    }

    .flat-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .dl-btns {
        flex-direction: row;
    }

    .btn-dl {
        flex: 1;
        justify-content: center;
    }

    .panel-body {
        padding: 16px;
    }

    .panel-header {
        padding: 14px 16px;
    }
}

/*  Mobile & Premium Refinements  */

.topbar-logo {
    height: 44px;
    width: auto;
    border-radius: 6px;
    flex-shrink: 0;
    transition: var(--ease);
}

@media (max-width: 640px) {
    .topbar-logo {
        height: 38px;
    }
}

@media (max-width: 400px) {
    .flat-summary-row {
        justify-content: flex-start;
    }

    .flat-stat-val {
        font-size: 18px;
    }

    .topbar-date {
    margin-left: auto;
        display: none;
    }

    .topbar-logo {
        height: 34px;
    }

    .topbar-inner {
        height: 54px;
        gap: 8px;
    }

    .topbar-sub {
        font-size: 9px;
    }
}

/* ── Modal Styles ─────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--surface);
    width: 100%;
    max-width: 500px;
    border-radius: var(--r-lg);
    box-shadow: var(--sh-lg);
    overflow: hidden;
    position: relative;
    animation: slideDown 0.3s ease-out;
}

.modal-header {
    background: #233b6a;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: var(--ease);
}

.modal-close:hover {
    color: #fff;
}

#ticket-modal-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input, 
.input-group select, 
.input-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: var(--surface-2);
    transition: var(--ease);
}

.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus {
    outline: none;
    border-color: #233b6a;
    box-shadow: 0 0 0 3px rgba(35, 59, 106, 0.1);
}

.message-box {
    padding: 12px 16px;
    border-radius: var(--r-sm);
    font-size: 13px;
    display: none;
    line-height: 1.5;
}

.message-box.success {
    display: block;
    background: var(--green-lt);
    color: var(--green-mid);
    border: 1px solid var(--green-border);
}

.message-box.error {
    display: block;
    background: var(--red-lt);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn-action {
    flex: 1;
    border: none;
    padding: 14px;
    border-radius: var(--r-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-interested {
    background: #DCFCE7;
    color: #166534;
    border: 1.5px solid #BBF7D0;
}

.btn-interested:hover {
    background: #BBF7D0;
    transform: translateY(-1px);
    box-shadow: var(--sh-sm);
}

.btn-not-interested {
    background: #FEE2E2;
    color: #991B1B;
    border: 1.5px solid #FECACA;
}

.btn-not-interested:hover {
    background: #FECACA;
    transform: translateY(-1px);
    box-shadow: var(--sh-sm);
}

.btn-action.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ── Top CTA Bar (Replacement for Nav Tabs) ────────────────── */
.top-cta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    padding: 16px 24px;
    margin-bottom: 20px;
    box-shadow: none;
    animation: fadeIn 0.5s ease both;
}

.top-cta-text {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.btn-raise-ticket {
    background: #233b6a;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 99px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--ease);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-raise-ticket:hover {
    background: #1a2a4d;
    transform: translateY(-1px);
    box-shadow: var(--sh-md);
}

/* ── Animations ───────────────────────────────────────────── */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}