/* ==========================================================================
   CPI Feni — Public Site Styles
   ========================================================================== */

:root {
    --cpi-primary: #0d6e3d;
    --cpi-primary-dark: #084d2a;
    --cpi-secondary: #f59e0b;
    --cpi-accent: #1e40af;
    --cpi-light: #f8fafc;
    --cpi-dark: #1e293b;
    --cpi-text: #334155;
    --cpi-muted: #64748b;
    --cpi-success: #10b981;
}

html[lang="bn"] body {
    font-family: 'Noto Sans Bengali', 'Hind Siliguri', system-ui, sans-serif;
}

html[lang="en"] body {
    font-family: 'Inter', system-ui, sans-serif;
}

body.public-site {
    color: var(--cpi-text);
    background-color: #fff;
    line-height: 1.65;
    margin-bottom: 0;
}

/* Prevent horizontal scroll on any page without breaking position:sticky on descendants.
   overflow-x:clip behaves like hidden visually but does NOT create a new scrolling context. */
html, body { overflow-x: clip; max-width: 100%; }
img, video, iframe, embed { max-width: 100%; }
/* Only apply height:auto when the element has NO explicit dimensions; otherwise we'd
   override <img height="50"> and stretch sized assets like the navbar logo. */
img:not([height]):not([width]), video:not([height]):not([width]) { height: auto; }
.ratio iframe { height: 100%; } /* ratio wrappers fill their box */
table { max-width: 100%; }

/* Navbar brand sizing — keep logo at fixed height; ensure breathing room before first nav item */
.site-header .navbar-brand img { height: 50px; width: auto; }
.site-header .navbar-brand { margin-right: 2rem; }

/* Mobile / tablet (below xl=1200px): hamburger is active. Keep brand + hamburger fitting cleanly. */
@media (max-width: 1199.98px) {
    .site-header .navbar-brand { max-width: calc(100% - 60px); margin-right: .5rem; }
}
@media (max-width: 767.98px) {
    .site-header .navbar-brand img { height: 38px !important; flex-shrink: 0; }
    .site-header .navbar-brand .d-block { font-size: .88rem !important; line-height: 1.2; white-space: normal; }
    .site-header .navbar-brand small { font-size: .68rem !important; line-height: 1.1; display: block; }
    .site-header .navbar-brand > span { min-width: 0; overflow: hidden; }
}
@media (max-width: 380px) {
    .site-header .navbar-brand small { display: none; }
    .site-header .navbar-brand .d-block { font-size: .82rem !important; }
}

a {
    color: var(--cpi-primary);
    text-decoration: none;
    transition: color .2s;
}
a:hover { color: var(--cpi-primary-dark); }

.bg-primary { background-color: var(--cpi-primary) !important; }
.btn-primary {
    background-color: var(--cpi-primary);
    border-color: var(--cpi-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--cpi-primary-dark);
    border-color: var(--cpi-primary-dark);
}
.text-primary { color: var(--cpi-primary) !important; }

/* ===== Top bar ===== */
.top-bar { font-size: .85rem; }
.top-bar a:hover { color: #fef3c7 !important; }

/* ===== Header ===== */
.site-header .navbar-brand small { font-size: .75rem; line-height: 1.1; }
.site-header .nav-link {
    font-weight: 500;
    color: var(--cpi-dark) !important;
    padding: .5rem .8rem !important;
    font-size: .92rem;
    position: relative;
    white-space: nowrap;
    border-radius: .6rem;
}
.site-header .nav-link i { opacity: .75; color: var(--cpi-primary); }
.site-header .nav-link { transition: background-color .18s ease, color .18s ease; }
.site-header .nav-link:hover { color: var(--cpi-primary) !important; background-color: rgba(13,110,61,.07); }
.site-header .nav-link:hover i { opacity: 1; }
.site-header .nav-link.active { color: var(--cpi-primary) !important; background-color: rgba(13,110,61,.10); font-weight: 600; }

/* ===== Figma-style light navbar ===== */
.site-header {
    background: rgba(255,255,255,.90) !important;
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    box-shadow: 0 1px 0 rgba(15,23,42,.06) !important;
    border-bottom: 1px solid #eceff3;
}
/* Highlighted project name */
.site-header .navbar-brand .site-brand-name {
    color: var(--cpi-primary) !important;
    font-weight: 800;
    line-height: 1.15;
    font-size: clamp(1.35rem, 1.05rem + 1.1vw, 1.7rem);
}
.site-header .navbar-brand .site-brand-name::after {
    content: "";
    display: block;
    width: 42px;
    height: 3px;
    margin-top: 3px;
    background: linear-gradient(90deg, var(--cpi-primary), var(--cpi-secondary));
    border-radius: 3px;
}
.site-header .navbar-brand small { color: var(--cpi-muted) !important; }

/* Animated dropdown caret (Figma-like chevron flip) */
.site-header .dropdown-toggle::after { transition: transform .2s ease; vertical-align: middle; }
.site-header .dropdown-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }

/* Right-aligned CTA pill button */
.site-header .nav-cta {
    background: var(--cpi-primary);
    color: #fff !important;
    padding: .5rem 1.15rem !important;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(13,110,61,.26);
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.site-header .nav-cta:hover {
    background: var(--cpi-primary-dark);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(13,110,61,.32);
}
.site-header .nav-cta i { color: #fff !important; opacity: 1; }

/* ===== Figma-style dropdown panels ===== */
.site-header .dropdown-menu {
    border: 1px solid #eef1f4;
    border-radius: 16px;
    padding: .5rem;
    margin-top: .55rem;
    min-width: 268px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .14);
    animation: navDropFade .18s ease;
}
@keyframes navDropFade {
    from { opacity: 0; transform: translateY(7px); }
    to   { opacity: 1; transform: translateY(0); }
}
.site-header .dropdown-item {
    border-radius: 10px;
    padding: .6rem .8rem;
    font-weight: 500;
    color: var(--cpi-dark);
    transition: background-color .15s ease, color .15s ease;
}
.site-header .dropdown-item:hover,
.site-header .dropdown-item:focus {
    background-color: #f2f5f8; /* neutral Figma-like row hover */
    color: var(--cpi-primary);
}
.site-header .dropdown-item i { color: var(--cpi-primary); width: 1.1rem; text-align: center; }
.site-header .dropdown-header {
    font-weight: 700;
    font-size: .7rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--cpi-muted);
    padding: .5rem .8rem .25rem;
}
.site-header .dropdown-divider { margin: .4rem .3rem; opacity: .45; }
.site-header .dropdown-item.active { background-color: rgba(13,110,61,.10); color: var(--cpi-primary); }

/* Multi-column dropdown (e.g. About Us) — opens as a grid instead of a tall list.
   Grid only applies on the expanded desktop navbar; mobile keeps a single column. */
@media (min-width: 1200px) {
    .site-header .dropdown-menu.dropdown-grid { min-width: 480px; }
    .site-header .dropdown-menu.dropdown-grid.show {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .1rem .35rem;
    }

    /* Flowbase-style mega dropdown — each section becomes its own column */
    .site-header .dropdown-menu.dropdown-mega { min-width: 560px; }
    .site-header .dropdown-menu.dropdown-mega.show {
        display: grid;
        grid-template-columns: repeat(3, minmax(170px, 1fr));
        gap: .1rem .25rem;
    }
    .site-header .dropdown-mega .mega-col { display: flex; flex-direction: column; }
    .site-header .dropdown-mega .mega-col + .mega-col {
        border-left: 1px solid #eef1f4;
        padding-left: .3rem;
    }
}

/* Menu is shown expanded only at xl (1200px+). Tighten progressively at smaller expanded widths. */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .site-header .nav-link { padding: .45rem .4rem !important; font-size: .82rem; }
    .site-header .navbar-brand { margin-right: 1rem !important; }
    .site-header .navbar-brand img { height: 42px !important; }
    .site-header .navbar-brand .d-block { font-size: .92rem !important; }
    .site-header .navbar-brand small { font-size: .65rem; }
}
@media (min-width: 1400px) and (max-width: 1599.98px) {
    .site-header .nav-link { padding: .5rem .5rem !important; font-size: .88rem; }
    .site-header .navbar-brand { margin-right: 1.25rem !important; }
}
@media (min-width: 1600px) {
    .site-header .nav-link { padding: .55rem .8rem !important; }
}

/* Force at least a small visible gap between brand and the first nav item even when menu fills */
.site-header .navbar > .container { column-gap: 1rem; }

/* ===== Contact map (responsive height) ===== */
.contact-map-frame { min-height: 380px; }
@media (max-width: 768px) { .contact-map-frame { min-height: 280px; } }
@media (max-width: 576px) { .contact-map-frame { min-height: 220px; } }

/* ===== Display headings (mobile scale) ===== */
@media (max-width: 576px) {
    .display-3 { font-size: 2rem !important; }
    .display-4 { font-size: 1.85rem !important; }
    .display-5 { font-size: 1.6rem !important; }
    .display-6 { font-size: 1.4rem !important; }
}

/* ===== Hero ===== */
.hero-section {
    background: linear-gradient(135deg, rgba(13,110,61,.92), rgba(30,64,175,.85));
    color: white;
    padding: 6rem 0 5rem;
    position: relative;
    overflow: hidden;
}
.hero-section h1 { font-weight: 700; line-height: 1.2; }

/* ===== Stats counter ===== */
.stat-card {
    text-align: center;
    padding: 1.5rem 1rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    transition: transform .25s;
}
.stat-card:hover { transform: translateY(-4px); }
.stat-card .stat-number {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--cpi-primary);
    line-height: 1;
}
.stat-card .stat-label { color: var(--cpi-muted); font-weight: 500; }

/* ===== Department cards ===== */
.dept-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
    transition: all .3s;
    border: 1px solid #f1f5f9;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.dept-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(13,110,61,0.15);
    border-color: rgba(13,110,61,0.3);
}
.dept-card .dept-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(13,110,61,.1), rgba(30,64,175,.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--cpi-primary);
    font-size: 1.5rem;
}
.dept-card h5 { font-weight: 600; margin-bottom: .5rem; }
.dept-card p { color: var(--cpi-muted); flex-grow: 1; font-size: .92rem; }

/* ===== Notice list ===== */
.notice-card {
    background: white;
    border-left: 4px solid var(--cpi-primary);
    padding: 1rem 1.2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    margin-bottom: .8rem;
    transition: all .2s;
}
.notice-card:hover { transform: translateX(4px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.notice-card.pinned { border-left-color: var(--cpi-secondary); background: #fffaeb; }
.notice-card .notice-date { font-size: .8rem; color: var(--cpi-muted); }
.notice-card .notice-title { font-weight: 600; color: var(--cpi-dark); margin: .3rem 0; }

/* ===== Section ===== */
.section { padding: 4rem 0; }
.section-title { text-align: center; margin-bottom: 3rem; }
.section-title h2 {
    font-weight: 700;
    color: var(--cpi-dark);
    position: relative;
    display: inline-block;
    padding-bottom: .8rem;
}
.section-title h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--cpi-primary);
    border-radius: 2px;
}
.section-title p { color: var(--cpi-muted); max-width: 600px; margin: .8rem auto 0; }

/* ===== Notice ticker ===== */
.notice-ticker {
    background: #fffaeb;
    border-top: 1px solid #fde68a;
    border-bottom: 1px solid #fde68a;
    padding: .7rem 0;
    overflow: hidden;
    display: flex;
    align-items: center;
}
.notice-ticker .ticker-label {
    background: var(--cpi-secondary);
    color: white;
    padding: .35rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
    font-size: .9rem;
}
.notice-ticker .ticker-content {
    overflow: hidden;
    white-space: nowrap;
    flex-grow: 1;
}
.notice-ticker .ticker-content span {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 30s linear infinite;
}
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ===== Footer ===== */
.site-footer h5, .site-footer h6 { font-weight: 600; }
.site-footer .social-links a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.site-footer .social-links a:hover { background: var(--cpi-primary); }
.site-footer a { transition: color .2s; }
.site-footer a:hover { color: #fff !important; }

/* ===== Login Page ===== */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--cpi-primary), var(--cpi-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.auth-card {
    max-width: 440px;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}
.auth-card .auth-header {
    background: linear-gradient(135deg, var(--cpi-primary), var(--cpi-primary-dark));
    color: white;
    padding: 2rem;
    text-align: center;
}
.auth-card .auth-body { padding: 2rem; }
.auth-card .form-control {
    height: 48px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding-left: 1rem;
}
.auth-card .form-control:focus {
    border-color: var(--cpi-primary);
    box-shadow: 0 0 0 .2rem rgba(13,110,61,.15);
}
.auth-card .btn-primary {
    height: 48px;
    border-radius: 10px;
    font-weight: 600;
}

/* ===== Admin Layout ===== */
body.admin-site {
    background: #f1f5f9;
    margin-bottom: 0;
}
.admin-sidebar {
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, var(--cpi-dark), #0f172a);
    color: #cbd5e1;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    overflow-y: auto;
}
.admin-sidebar .brand {
    padding: 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: white !important;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    transition: background-color .15s;
}
.admin-sidebar .brand:hover { background-color: rgba(255,255,255,0.05); color: #fff !important; }
.admin-sidebar .brand i { color: var(--cpi-secondary); margin-right: .6rem; }
.admin-sidebar .nav-section {
    padding: 1rem 1rem .3rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    font-weight: 600;
}
/* ===== Collapsible sidebar groups (accordion) ===== */
.admin-sidebar .nav-group { border: 0; }
.admin-sidebar summary.nav-section {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    padding: .7rem 1rem;
    margin-top: .15rem;
    transition: color .15s, background-color .15s;
}
.admin-sidebar summary.nav-section::-webkit-details-marker { display: none; }
.admin-sidebar summary.nav-section::after {
    content: "\f078"; /* chevron-down */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: .6rem;
    color: #64748b;
    transition: transform .2s ease;
}
.admin-sidebar details[open] > summary.nav-section::after { transform: rotate(180deg); }
.admin-sidebar summary.nav-section:hover { color: #e2e8f0; background: rgba(255,255,255,0.04); }
/* Active section header gets a subtle accent so you know which group you're in */
.admin-sidebar details:has(.nav-link.active) > summary.nav-section { color: var(--cpi-secondary); }
.admin-sidebar .nav-link {
    color: #cbd5e1 !important;
    padding: .65rem 1.2rem;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    transition: all .15s;
    font-size: .92rem;
}
.admin-sidebar .nav-link i {
    width: 22px;
    text-align: center;
    margin-right: .6rem;
    color: #94a3b8;
}
.admin-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: white !important;
    border-left-color: var(--cpi-secondary);
}
.admin-sidebar .nav-link.active {
    background: rgba(13,110,61,0.2);
    color: white !important;
    border-left-color: var(--cpi-primary);
}
.admin-sidebar .nav-link.active i { color: var(--cpi-secondary); }

.admin-content { margin-left: 260px; min-height: 100vh; }
.admin-topbar {
    background: white;
    height: 64px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}
.admin-main { padding: 1.5rem; }

@media (max-width: 991px) {
    .admin-sidebar { transform: translateX(-100%); transition: transform .25s; }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-content { margin-left: 0; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero-section { padding: 3rem 0 2.5rem; }
    .hero-section h1 { font-size: 2rem; }
    .section { padding: 2.5rem 0; }
    .stat-card .stat-number { font-size: 1.8rem; }
}

/* Nested dropdown for Departments menu */
.dropdown-submenu { position: relative; }
.dropdown-submenu > .dropdown-menu {
    top: 0; left: 100%; margin-top: -.25rem; margin-left: .1rem;
    border-radius: .4rem;
}
.dropdown-submenu > .dropdown-toggle::after {
    transform: rotate(-90deg);
    margin-left: .5em;
    vertical-align: middle;
}
.dropdown-submenu:hover > .dropdown-menu { display: block; }
@media (max-width: 991.98px) {
    .dropdown-submenu > .dropdown-menu {
        position: static; margin: 0 0 0 1rem;
        border: none; box-shadow: none;
        display: none;
    }
    .dropdown-submenu.open > .dropdown-menu { display: block; }
}
.depts-dropdown .dropdown-menu { min-width: 230px; }

/* ===================== Task Management ===================== */
.task-page .stat-card { border: 0; border-radius: 14px; }
.task-page .stat-card .stat-icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
}

/* Filter / toolbar */
.task-toolbar { background: #fff; border: 1px solid #eef1f4; border-radius: 14px; }
.task-tabs .btn { border-radius: 999px; }

/* Status & priority badges */
.tk-badge { font-weight: 600; font-size: .72rem; padding: .3rem .6rem; border-radius: 999px; }
.tk-st-Pending     { background: #fff7ed; color: #b45309; }
.tk-st-InProgress  { background: #eff6ff; color: #1e40af; }
.tk-st-Completed   { background: #ecfdf5; color: #047857; }
.tk-st-Cancelled   { background: #f1f5f9; color: #64748b; }
.tk-pri-Low    { background: #f1f5f9; color: #475569; }
.tk-pri-Medium { background: #eff6ff; color: #1d4ed8; }
.tk-pri-High   { background: #fff7ed; color: #c2410c; }
.tk-pri-Urgent { background: #fef2f2; color: #b91c1c; }
.tk-cat { font-weight: 600; font-size: .72rem; padding: .25rem .55rem; border-radius: 999px; color: #fff; }

/* Task list cards */
.task-card { border: 1px solid #eef1f4; border-radius: 14px; transition: box-shadow .15s, transform .15s; background:#fff; }
.task-card:hover { box-shadow: 0 10px 26px rgba(15,23,42,.08); transform: translateY(-1px); }
.task-card.task-overdue { border-left: 4px solid #ef4444; }
.task-card.task-done { opacity: .72; }
.task-card.task-done .task-title { text-decoration: line-through; }
.task-due.overdue { color: #dc2626; font-weight: 600; }
.task-due.soon { color: #b45309; font-weight: 600; }

/* Kanban board */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 1rem; }
.kanban-col { background: #f1f5f9; border-radius: 14px; padding: .75rem; min-height: 120px; }
.kanban-col > .kanban-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: .85rem; margin-bottom: .6rem; padding: 0 .25rem; }
.kanban-col .kanban-head .count { background: #fff; border-radius: 999px; padding: .05rem .5rem; font-size: .72rem; color: #475569; }
.kanban-card { background: #fff; border: 1px solid #e7ebef; border-radius: 12px; padding: .7rem .8rem; margin-bottom: .6rem; display: block; text-decoration: none; color: inherit; transition: box-shadow .15s; }
.kanban-card:hover { box-shadow: 0 8px 20px rgba(15,23,42,.10); color: inherit; }
.kanban-card.task-overdue { border-left: 4px solid #ef4444; }
@media (max-width: 991px) {
    .kanban { display: flex; overflow-x: auto; gap: .85rem; padding-bottom: .5rem; scroll-snap-type: x mandatory; }
    .kanban-col { flex: 0 0 80%; max-width: 320px; scroll-snap-align: start; }
}

/* Checklist progress */
.checklist-item { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed #eef1f4; }
.checklist-item .ck-text.done { text-decoration: line-through; color: #94a3b8; }

/* Comments */
.task-comment { display: flex; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid #f1f5f9; }
.task-comment .avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover; background: var(--cpi-primary); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; overflow:hidden; }

/* Sidebar/nav pending badge */
.task-nav-badge { background:#ef4444; color:#fff; font-size:.65rem; font-weight:700; border-radius:999px; padding:.05rem .4rem; vertical-align:middle; }

/* ===================== Admin Dashboard ===================== */
.dash-hero {
    background: linear-gradient(135deg, var(--cpi-primary), var(--cpi-primary-dark));
    color: #fff;
}
.dash-hero .btn-light { font-weight: 600; }
.kpi-card { transition: transform .15s, box-shadow .15s; }
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15,23,42,.10) !important; }
.kpi-card .rounded-3 { transition: transform .15s; }
.kpi-card:hover .rounded-3 { transform: scale(1.08); }
.attn-card { transition: transform .15s, box-shadow .15s; }
.attn-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,.10) !important; }
.attn-card.attn-hot { background: #fffdf7; }
.min-w-0 { min-width: 0; }
