:root{
    --shadow-header:0 10px 30px rgba(15,23,42,.10);
}

body{
    padding-top:118px;
    background:var(--body-bg);
}

body[data-header-light-mode="1"]{
    padding-top:118px !important;
}

a{
    color:var(--link-color);
}

/* =========================================================
   TOP HEADER
========================================================= */

.topbar{
    position:fixed;
    top:8px;
    left:8px;
    right:8px;
    z-index:900;
    overflow:visible;
    padding:8px;
    background:#ffffff !important;
    color:#111827 !important;
    border:1px solid var(--card-border);
    border-radius:24px;
    box-shadow:var(--shadow-header);
}

.topbar-main{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
}

/* =========================================================
   DYNAMIC HEADER BRAND
========================================================= */

.brand{
    flex:1 1 0;
    min-width:0;
    overflow:hidden;
}

.brand-link{
    display:flex;
    align-items:center;
    gap:10px;
    width:100%;
    min-width:0;
    color:#111827 !important;
    text-decoration:none;
}

.brand-logo{
    width:44px;
    height:44px;
    flex:0 0 44px;
    object-fit:contain;
    background:#ffffff;
    border:1px solid var(--card-border);
    border-radius:14px;
    box-shadow:0 5px 14px rgba(15,23,42,.10);
}

.brand-text-wrap{
    flex:1 1 auto;
    min-width:0;
    display:flex;
    flex-direction:column;
    justify-content:center;
    overflow:hidden;
    line-height:1;
}

.brand-master-name{
    display:block;
    margin:0 0 3px;
    color:var(--brand, #1565c0) !important;
    font-size:10px;
    font-weight:900;
    line-height:1;
    white-space:nowrap;
}

.brand-city-name{
    display:block;
    width:100%;
    min-width:0;
    overflow:hidden;
    color:#111827 !important;
    font-size:15px;
    font-weight:1000;
    line-height:1.15;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* =========================================================
   HEADER ACTION BUTTONS
========================================================= */

.topbar-right{
    flex:0 0 auto;
    display:flex;
    align-items:center;
    gap:8px;
}

.menu-btn,
.bell-btn,
.header-login-link{
    position:relative;
    width:42px;
    height:42px;
    flex:0 0 42px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0;
    background:#f8fafc !important;
    color:var(--brand) !important;
    border:1px solid #e5e7eb;
    border-radius:14px;
    box-shadow:none;
    text-decoration:none;
    font-weight:900;
    cursor:pointer;
}

.menu-btn .svg-icon,
.bell-btn .svg-icon,
.topbar .svg-icon{
    stroke:var(--brand) !important;
    color:var(--brand) !important;
}

.bell-btn.active{
    background:#ffffff !important;
    color:var(--brand) !important;
    border-color:var(--brand) !important;
}

.bell-status{
    position:absolute;
    top:7px;
    right:7px;
    width:10px;
    height:10px;
    border:2px solid #ffffff;
    border-radius:50%;
}

.bell-on{
    background:#22c55e;
}

.bell-off{
    background:#ef4444;
}

.bell-default{
    background:#f59e0b;
}

/* =========================================================
   HEADER SEARCH
========================================================= */

.header-search-shell{
    position:relative;
    z-index:1001;
    padding:8px 0 0 !important;
    background:transparent !important;
}

.header-live-search-form{
    position:relative;
    width:100%;
    display:flex;
    align-items:center;
    gap:8px;
    overflow:visible;
    box-sizing:border-box;
    padding:6px 8px !important;
    background:#f8fafc !important;
    border:1px solid #e5e7eb !important;
    border-radius:18px !important;
    box-shadow:none !important;
}

.header-search-icon{
    flex:0 0 22px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#111827;
    opacity:.75;
}

.header-live-search-input{
    flex:1 1 auto;
    min-width:0;
    height:42px;
    padding:0;
    background:transparent;
    color:#111827;
    border:0;
    outline:0;
    font-size:15px;
}

.header-live-search-input::placeholder{
    color:#94a3b8;
}

.header-live-search-btn{
    flex:0 0 auto;
    height:42px !important;
    padding:0 16px;
    background:var(--brand) !important;
    color:#ffffff;
    border:0;
    border-radius:14px !important;
    font-size:14px;
    font-weight:900;
    cursor:pointer;
}

/* =========================================================
   SEARCH RESULT DROPDOWN
========================================================= */

.header-live-search-dropdown,
.search-suggestions,
.suggestions-box,
.autocomplete-list,
#searchSuggestions,
#searchResults{
    position:absolute !important;
    top:calc(100% + 8px) !important;
    left:0 !important;
    right:0 !important;
    z-index:99999 !important;
    max-height:320px;
    overflow-y:auto;
    padding:8px;
    background:#ffffff;
    border:1px solid var(--card-border);
    border-radius:18px;
    box-shadow:0 14px 35px rgba(15,23,42,.22);
}

.header-live-search-item{
    display:flex;
    align-items:center;
    gap:10px;
    padding:10px;
    color:inherit;
    border-radius:14px;
    text-decoration:none;
}

.header-live-search-item:hover{
    background:#f8fafc;
}

.header-live-search-thumb{
    width:74px;
    height:60px;
    flex:0 0 74px;
    overflow:hidden;
    background:#f8f9fa;
    border:1px solid #e5e7eb;
    border-radius:12px;
}

.header-live-search-thumb img{
    width:100%;
    height:100%;
    display:block;
    object-fit:cover;
}

.header-live-search-title{
    margin-bottom:6px;
    color:#1a0dab;
    font-size:14px;
    font-weight:900;
}

/* =========================================================
   DRAWER
========================================================= */

.drawer{
    position:fixed;
    top:0;
    left:0;
    z-index:9999 !important;
    width:86%;
    max-width:360px;
    height:100dvh;
    max-height:100dvh;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    padding:0;
    background:#ffffff;
    border-radius:0 26px 26px 0;
    box-shadow:0 18px 45px rgba(15,23,42,.22);
    transform:translateX(-110%);
    transition:transform .25s ease;
}

.drawer.show{
    transform:translateX(0);
}

.drawer-overlay{
    position:fixed;
    inset:0;
    z-index:9998 !important;
    visibility:hidden;
    opacity:0;
    background:rgba(15,23,42,.45);
    transition:opacity .25s ease, visibility .25s ease;
}

.drawer-overlay.show{
    visibility:visible;
    opacity:1;
}

.drawer-head{
    flex:0 0 auto;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:16px;
    background:linear-gradient(180deg,#ffffff,var(--brand-light));
    color:#111827;
    border-bottom:1px solid var(--card-border);
    font-size:20px;
    font-weight:900;
}

.drawer-head button{
    width:42px;
    height:42px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0;
    background:#f8fafc;
    color:var(--brand);
    border:0;
    border-radius:14px;
    cursor:pointer;
}

.drawer-body{
    flex:1 1 auto;
    min-height:0;
    display:flex;
    flex-direction:column;
    gap:10px;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    padding:12px 12px 125px;
}

.drawer-btn{
    min-height:50px;
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 14px;
    background:#ffffff;
    color:#111827 !important;
    border:1px solid #e5e7eb;
    border-radius:16px;
    box-shadow:0 4px 12px rgba(15,23,42,.06);
    text-decoration:none;
    font-size:15px;
    font-weight:900;
}

.drawer-btn .svg-icon{
    width:22px;
    height:22px;
    flex:0 0 22px;
    stroke:var(--brand) !important;
    color:var(--brand) !important;
}

body.drawer-open{
    overflow:hidden;
}

/* =========================================================
   GLOBAL FORM LOADER
========================================================= */

.global-form-loader{
    position:fixed;
    inset:0;
    z-index:999999;
    display:none;
    align-items:center;
    justify-content:center;
    background:rgba(255,255,255,.72);
}

.global-form-loader.show{
    display:flex;
}

.loader-box{
    padding:18px 22px;
    background:#ffffff;
    border:1px solid var(--card-border);
    border-radius:22px;
    box-shadow:0 18px 45px rgba(15,23,42,.20);
    text-align:center;
}

.loader-spinner{
    width:34px;
    height:34px;
    margin:0 auto 10px;
    border:4px solid var(--brand-light);
    border-top-color:var(--brand);
    border-radius:50%;
    animation:loaderSpin .8s linear infinite;
}

.loader-text{
    color:var(--brand);
    font-size:14px;
    font-weight:900;
}

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

/* =========================================================
   INSTALL / SHARE BUTTON
========================================================= */

.app-download-btn,
.app-share-btn{
    position:relative;
    overflow:visible;
    background:#f8fafc !important;
    color:var(--brand) !important;
    border-color:#e5e7eb !important;
}

.app-download-btn .svg-icon,
.app-share-btn .svg-icon{
    stroke:var(--brand) !important;
    color:var(--brand) !important;
}

.app-install-count{
    position:absolute;
    top:-8px;
    right:-8px;
    z-index:99999;
    min-width:20px;
    height:20px;
    padding:0 6px;
    background:#ef4444;
    color:#ffffff;
    border:2px solid #ffffff;
    border-radius:999px;
    box-shadow:0 4px 12px rgba(239,68,68,.35);
    font-size:11px;
    font-weight:900;
    line-height:16px;
    text-align:center;
    white-space:nowrap;
}

#installAppBtn.installing{
    width:auto !important;
    min-width:92px !important;
    height:40px !important;
    padding:0 10px !important;
    gap:6px;
    background:linear-gradient(
        180deg,
        var(--brand),
        var(--brand-dark)
    ) !important;
    pointer-events:none;
}

#installAppBtn.installing .install-spin,
#installAppBtn .install-spin{
    width:18px;
    height:18px;
    flex:0 0 18px;
    border:3px solid rgba(255,255,255,.35);
    border-top-color:#ffffff;
    border-radius:50%;
    animation:installSpin .8s linear infinite;
}

#installAppBtn.installing .install-text,
#installAppBtn .install-text{
    color:#ffffff;
    font-size:11px;
    font-weight:900;
    white-space:nowrap;
}

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

/* =========================================================
   PAGE CONTENT
========================================================= */

.container{
    width:100%;
    max-width:1200px;
    margin:0 auto;
    padding:0 12px;
    box-sizing:border-box;
}

#mainContent{
    display:block;
    min-height:200px;
    padding-top:12px;
}

body[data-header-light-mode="1"] #mainContent{
    padding-top:0 !important;
}

/* =========================================================
   INSTALL PROGRESS POPUP
========================================================= */

#installProgressPopup{
    position:fixed;
    inset:0;
    z-index:9999999;
}

.install-progress-overlay{
    position:absolute;
    inset:0;
    background:rgba(15,23,42,.55);
    backdrop-filter:blur(4px);
}

.install-progress-card{
    position:absolute;
    left:16px;
    right:16px;
    bottom:105px;
    padding:22px 18px;
    background:#ffffff;
    border-radius:26px;
    box-shadow:0 24px 60px rgba(15,23,42,.35);
    text-align:center;
}

.install-progress-icon{
    width:58px;
    height:58px;
    margin:0 auto 12px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--brand);
    border:2px solid var(--brand);
    border-radius:50%;
}

.install-progress-icon .svg-icon{
    width:30px;
    height:30px;
    stroke:var(--brand) !important;
    color:var(--brand) !important;
}

.install-progress-title{
    color:#111827;
    font-size:18px;
    font-weight:900;
}

.install-progress-subtitle{
    margin-top:4px;
    color:#64748b;
    font-size:13px;
    font-weight:800;
}

.install-progress-percent{
    margin-top:14px;
    color:var(--brand);
    font-size:22px;
    font-weight:900;
}

.install-progress-track{
    height:12px;
    margin-top:12px;
    overflow:hidden;
    background:#e5e7eb;
    border-radius:999px;
}

.install-progress-fill{
    width:0%;
    height:100%;
    background:linear-gradient(
        90deg,
        var(--brand),
        var(--brand-dark)
    );
    border-radius:999px;
    transition:width .12s linear;
}

.install-progress-time{
    margin-top:8px;
    display:flex;
    justify-content:space-between;
    color:#64748b;
    font-size:12px;
    font-weight:800;
}

#installAppBtn.installing{
    min-width:64px !important;
}

/* =========================================================
   PWA INSTALL POPUP
========================================================= */

#buildsathiInstallPopup{
    position:fixed;
    inset:0;
    z-index:99999999;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
    background:rgba(15,23,42,.45);
}

#buildsathiInstallPopup .pwa-install-popup{
    width:100%;
    max-width:360px;
    padding:20px;
    background:#ffffff;
    border-radius:24px;
    box-shadow:0 20px 60px rgba(0,0,0,.25);
}

#buildsathiInstallPopup .pwa-install-popup-title{
    margin-bottom:8px;
    color:#111827;
    font-size:20px;
    font-weight:900;
}

#buildsathiInstallPopup .pwa-install-popup-text{
    margin-bottom:16px;
    color:#64748b;
    font-size:14px;
    line-height:1.6;
}

#buildsathiInstallPopup .pwa-install-popup-actions{
    display:flex;
    gap:10px;
}

#buildsathiInstallPopup .pwa-install-now{
    flex:1;
    padding:12px;
    background:linear-gradient(
        135deg,
        var(--brand),
        var(--brand-dark)
    );
    color:#ffffff;
    border:0;
    border-radius:14px;
    font-weight:900;
    cursor:pointer;
}

#buildsathiInstallPopup .pwa-install-later{
    padding:12px 16px;
    background:#f1f5f9;
    color:#111827;
    border:0;
    border-radius:14px;
    font-weight:900;
    cursor:pointer;
}

/* =========================================================
   MOBILE
========================================================= */

@media(max-width:768px){

    body,
    body[data-header-light-mode="1"]{
        padding-top:118px !important;
    }

    .topbar{
        top:8px;
        left:8px;
        right:8px;
        padding:8px;
        border-radius:22px;
    }

    .topbar-main{
        gap:8px;
    }

    .brand-link{
        gap:8px;
    }

    .brand-logo{
        width:40px;
        height:40px;
        flex:0 0 40px;
        border-radius:12px;
    }

    .brand-master-name{
        margin-bottom:2px;
        font-size:9px;
    }

    .brand-city-name{
        font-size:15px;
    }

    .menu-btn,
    .bell-btn,
    .header-login-link{
        width:40px;
        height:40px;
        flex:0 0 40px;
    }

    .header-live-search-input{
        height:40px;
        font-size:14px;
    }

    .header-live-search-btn{
        height:40px !important;
        padding:0 12px;
        font-size:13px;
    }
}

@media(max-width:420px){

    .topbar-main{
        gap:6px;
    }

    .topbar-right{
        gap:6px;
    }

    .brand-logo{
        width:38px;
        height:38px;
        flex:0 0 38px;
    }

    .brand-text-wrap{
        flex:1 1 auto;
        min-width:0;
    }

    .brand-master-name{
        font-size:8px;
    }

    .brand-city-name{
        width:100%;
        font-size:14px;
    }

    .menu-btn,
    .bell-btn,
    .header-login-link{
        width:38px;
        height:38px;
        flex:0 0 38px;
        border-radius:12px;
    }

    .install-progress-card{
        left:12px;
        right:12px;
        bottom:90px;
        padding:20px 16px;
    }
}

@media(max-width:360px){

    .brand-link{
        gap:6px;
    }

    .brand-logo{
        width:36px;
        height:36px;
        flex:0 0 36px;
    }

    .brand-master-name{
        font-size:7.5px;
    }

    .brand-city-name{
        font-size:13px;
    }

    .topbar-right{
        gap:4px;
    }

    .menu-btn,
    .bell-btn,
    .header-login-link{
        width:36px;
        height:36px;
        flex:0 0 36px;
    }

    #buildsathiInstallPopup{
        padding:14px;
    }

    #buildsathiInstallPopup .pwa-install-popup{
        padding:18px;
    }
}

/* =========================================================
   LARGE HEADER BRAND TEXT
========================================================= */

.brand-master-name{
    margin-bottom:4px !important;
    font-size:14px !important;
    font-weight:900 !important;
    line-height:1.05 !important;
}

.brand-city-name{
    font-size:20px !important;
    font-weight:1000 !important;
    line-height:1.1 !important;
}

@media(max-width:768px){
    .brand-master-name{
        font-size:13px !important;
    }

    .brand-city-name{
        font-size:19px !important;
    }
}

@media(max-width:420px){
    .brand-master-name{
        font-size:12px !important;
    }

    .brand-city-name{
        font-size:18px !important;
    }
}

@media(max-width:360px){
    .brand-master-name{
        font-size:11px !important;
    }

    .brand-city-name{
        font-size:17px !important;
    }
}

/* =========================================================
   INSTALL POPUP DYNAMIC BRAND
========================================================= */

.install-progress-brand{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:8px;
    margin:12px 0 14px;
}

.install-progress-logo{
    width:64px;
    height:64px;
    display:block;
    object-fit:contain;
    background:#ffffff;
    border:1px solid #e5e7eb;
    border-radius:16px;
    padding:4px;
    box-shadow:0 8px 20px rgba(15,23,42,.12);
}

.install-progress-app-name{
    max-width:100%;
    overflow:hidden;
    color:#111827;
    font-size:18px;
    font-weight:900;
    line-height:1.25;
    text-align:center;
    text-overflow:ellipsis;
    white-space:nowrap;
}

@media(max-width:420px){
    .install-progress-logo{
        width:58px;
        height:58px;
        border-radius:15px;
    }

    .install-progress-app-name{
        font-size:17px;
    }
}
