:root {
    --hafsa-primary: #0f766e;
    --hafsa-primary-dark: #115e59;
    --hafsa-accent: #d6a84f;
    --hafsa-bg: #f6f8fb;
    --hafsa-card: #ffffff;
    --hafsa-text: #162033;
    --hafsa-muted: #6b7280;
    --hafsa-border: #e5e7eb;
    --hafsa-radius: 22px;
    --hafsa-shadow: 0 18px 50px rgba(15, 23, 42, .08);
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at top left, rgba(15,118,110,.10), transparent 32%),
        radial-gradient(circle at top right, rgba(214,168,79,.11), transparent 30%),
        var(--hafsa-bg) !important;
    color: var(--hafsa-text);
    font-family: "Noto Sans Tamil", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.page {
    background: transparent !important;
}

.container.content-area {
    padding-top: 24px;
}

.hafsa-topbar {
    background: linear-gradient(135deg, var(--hafsa-primary-dark), var(--hafsa-primary));
    color: #fff;
    font-size: 14px;
}

.hafsa-topbar-inner {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.hafsa-topbar a {
    color: #fff;
    text-decoration: none;
}

.hafsa-language {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hafsa-language a {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.13);
    transition: .2s ease;
}

.hafsa-language a:hover,
.hafsa-language a.active {
    background: #fff;
    color: var(--hafsa-primary-dark);
}

.hafsa-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(229,231,235,.9);
    box-shadow: 0 10px 35px rgba(15, 23, 42, .06);
}

.hafsa-brand-row {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.hafsa-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--hafsa-text);
    text-decoration: none;
}

.hafsa-brand:hover {
    color: var(--hafsa-text);
    text-decoration: none;
}

.hafsa-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 25px rgba(15,23,42,.08);
    padding: 6px;
}

.hafsa-brand-text strong {
    display: block;
    font-size: 22px;
    line-height: 1.25;
    color: var(--hafsa-primary-dark);
}

.hafsa-brand-text span {
    display: block;
    color: var(--hafsa-muted);
    font-size: 14px;
    margin-top: 2px;
}

.hafsa-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hafsa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--hafsa-primary), var(--hafsa-primary-dark));
    color: #fff !important;
    font-weight: 700;
    text-decoration: none !important;
    box-shadow: 0 12px 28px rgba(15,118,110,.22);
    transition: .22s ease;
}

.hafsa-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(15,118,110,.28);
}

.hafsa-menu-toggle {
    display: none;
    border: 0;
    background: #eef8f6;
    color: var(--hafsa-primary-dark);
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 22px;
    cursor: pointer;
}

.hafsa-nav-wrap {
    background: #fff;
    border-top: 1px solid rgba(229,231,235,.8);
}

.hafsa-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hafsa-nav > li {
    position: relative;
}

.hafsa-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 15px 13px;
    color: #263244;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 12px;
    transition: .2s ease;
}

.hafsa-nav a:hover {
    color: var(--hafsa-primary-dark);
    background: #eef8f6;
    text-decoration: none;
}

.hafsa-nav li.active > a,
.hafsa-nav li.active-parent > a,
.hafsa-nav a.active {
    color: var(--hafsa-primary-dark);
    background: #eef8f6;
}

.hafsa-submenu li.active > a {
    font-weight: 900;
    background: rgba(15, 118, 110, .10);
}

.hafsa-submenu {
    position: absolute;
    left: 0;
    top: 100%;
    min-width: 230px;
    background: #fff;
    border: 1px solid var(--hafsa-border);
    border-radius: 16px;
    box-shadow: var(--hafsa-shadow);
    list-style: none;
    padding: 8px;
    margin: 0;
    display: none;
    z-index: 1001;
}

.hafsa-nav li:hover > .hafsa-submenu {
    display: block;
}

.hafsa-submenu a {
    padding: 11px 12px;
    font-size: 14px;
}

.hafsa-hero {
    position: relative;
    margin: 24px auto 28px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--hafsa-shadow);
    background:
        linear-gradient(135deg, rgba(15,118,110,.92), rgba(17,94,89,.85)),
        url("../images/brand/header1.jpg") center/cover no-repeat;
    min-height: 310px;
    display: flex;
    align-items: center;
}

.hafsa-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,.20), transparent 30%),
        linear-gradient(90deg, rgba(0,0,0,.15), transparent);
}

.hafsa-hero-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    padding: 40px;
    color: #fff;
}

.hafsa-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 999px;
    padding: 8px 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.hafsa-hero h1 {
    color: #fff;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 1.15;
    margin: 0 0 14px;
    font-weight: 900;
}

.hafsa-hero p {
    color: rgba(255,255,255,.90);
    font-size: 18px;
    line-height: 1.75;
    margin: 0 0 22px;
}

.hafsa-hero-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hafsa-hero-buttons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 800;
    text-decoration: none;
}

.hafsa-hero-primary {
    background: #fff;
    color: var(--hafsa-primary-dark);
}

.hafsa-hero-secondary {
    background: rgba(255,255,255,.14);
    color: #fff;
    border: 1px solid rgba(255,255,255,.30);
}

.card {
    border: 1px solid rgba(229,231,235,.9) !important;
    border-radius: var(--hafsa-radius) !important;
    box-shadow: var(--hafsa-shadow) !important;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #ffffff, #f8fafc) !important;
    border-bottom: 1px solid var(--hafsa-border) !important;
    color: var(--hafsa-primary-dark) !important;
    font-weight: 900;
    font-size: 18px;
}

.card-body {
    line-height: 1.8;
}

.feature .icon,
.fa-stack.icon {
    border-radius: 18px !important;
    box-shadow: 0 14px 28px rgba(15,118,110,.18);
}

.bg-green {
    background: linear-gradient(135deg, var(--hafsa-primary), var(--hafsa-primary-dark)) !important;
}

.btn-primary,
.btn-success {
    background: linear-gradient(135deg, var(--hafsa-primary), var(--hafsa-primary-dark)) !important;
    border-color: var(--hafsa-primary) !important;
    border-radius: 999px !important;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(15,118,110,.20);
}

img {
    max-width: 100%;
    height: auto;
}

.card img {
    border-radius: 16px;
    object-fit: cover;
}

.side-app .row {
    row-gap: 20px;
}

.footer,
.hafsa-footer {
    background: #0f172a !important;
    color: #d1d5db;
    border-radius: 28px 28px 0 0;
    margin-top: 40px;
    padding: 34px 0 16px;
}

.hafsa-footer a,
.footer a {
    color: #fff;
    text-decoration: none;
}

.hafsa-footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 24px;
}

.hafsa-footer h4 {
    color: #fff;
    font-weight: 900;
    margin-bottom: 12px;
}

.hafsa-footer p,
.hafsa-footer li {
    color: #cbd5e1;
    line-height: 1.8;
}

.hafsa-footer ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

.hafsa-footer-bottom {
    border-top: 1px solid rgba(255,255,255,.10);
    margin-top: 22px;
    padding-top: 16px;
    text-align: center;
    color: #94a3b8;
}

#back-to-top {
    border-radius: 999px !important;
    background: var(--hafsa-primary) !important;
    box-shadow: 0 12px 30px rgba(15,118,110,.28);
}

@media (max-width: 991px) {
    .hafsa-brand-row {
        min-height: 74px;
    }

    .hafsa-brand-text strong {
        font-size: 18px;
    }

    .hafsa-brand-text span {
        display: none;
    }

    .hafsa-logo {
        width: 54px;
        height: 54px;
    }

    .hafsa-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .hafsa-actions .hafsa-btn {
        display: none;
    }

    .hafsa-nav-wrap {
        display: none;
    }

    .hafsa-nav-wrap.open {
        display: block;
    }

    .hafsa-nav {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 0;
    }

    .hafsa-nav a {
        justify-content: space-between;
        padding: 13px 12px;
    }

    .hafsa-submenu {
        position: static;
        display: block;
        box-shadow: none;
        border-radius: 14px;
        margin: 0 10px 8px;
        background: #f8fafc;
    }

    .hafsa-hero {
        min-height: 260px;
        margin-top: 16px;
    }

    .hafsa-hero-content {
        padding: 28px 22px;
    }

    .hafsa-hero p {
        font-size: 16px;
    }

    .hafsa-footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575px) {
    .hafsa-topbar-inner {
        justify-content: center;
        text-align: center;
    }

    .hafsa-brand {
        gap: 10px;
    }

    .hafsa-brand-text strong {
        font-size: 16px;
    }

    .container.content-area {
        padding-left: 12px;
        padding-right: 12px;
    }

    .hafsa-hero h1 {
        font-size: 28px;
    }

    .card-body {
        padding: 16px !important;
    }
}

/* =========================================================
   Horizontal menu fixes
   Desktop: horizontal scroll
   Mobile: collapsible submenus
========================================================= */

/* Desktop horizontal scroll */
@media (min-width: 992px) {
    .hafsa-nav-wrap {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: rgba(15, 118, 110, .45) transparent;
    }

    .hafsa-nav-wrap::-webkit-scrollbar {
        height: 7px;
    }

    .hafsa-nav-wrap::-webkit-scrollbar-track {
        background: transparent;
    }

    .hafsa-nav-wrap::-webkit-scrollbar-thumb {
        background: rgba(15, 118, 110, .35);
        border-radius: 999px;
    }

    .hafsa-nav {
        flex-wrap: nowrap;
        width: max-content;
        min-width: 100%;
    }

    .hafsa-nav > li {
        flex: 0 0 auto;
    }

    .hafsa-nav > li:hover > .hafsa-submenu {
        display: block;
    }
}

/* Mobile menu */
@media (max-width: 991px) {
    .hafsa-nav-wrap {
        max-height: calc(100vh - 90px);
        overflow-y: auto;
        overflow-x: hidden;
        border-top: 1px solid rgba(229,231,235,.9);
    }

    .hafsa-nav {
        gap: 4px;
    }

    .hafsa-nav > li {
        width: 100%;
    }

    .hafsa-nav > li > a {
        width: 100%;
        border-radius: 14px;
    }

    /* Hide all mobile submenus by default */
    .hafsa-submenu {
        display: none !important;
        position: static !important;
        min-width: 100%;
        box-shadow: none;
        border: 1px solid rgba(229,231,235,.9);
        border-radius: 14px;
        margin: 0 0 8px;
        background: #f8fafc;
        padding: 8px;
    }

    /* Show submenu only when clicked */
    .hafsa-nav > li.open > .hafsa-submenu {
        display: block !important;
    }

    .hafsa-nav > li.open > a {
        background: #eef8f6;
        color: var(--hafsa-primary-dark);
    }

    .hafsa-submenu a {
        white-space: normal;
        padding: 11px 14px;
        font-size: 14px;
    }

    .hafsa-nav li:hover > .hafsa-submenu {
        display: none !important;
    }

    .hafsa-nav li.open:hover > .hafsa-submenu {
        display: block !important;
    }
}

/* =========================================================
   Desktop dropdown fix:
   Keep horizontal menu scrollable but show submenu outside
========================================================= */

@media (min-width: 992px) {
    .hafsa-nav-wrap {
        overflow-x: auto;
        overflow-y: hidden;
        position: relative;
        z-index: 1000;
    }

    .hafsa-nav {
        position: relative;
    }

    .hafsa-submenu {
        position: fixed !important;
        top: auto;
        left: auto;
        display: none !important;
        z-index: 99999 !important;
        min-width: 240px;
        max-width: 320px;
        background: #fff;
        border: 1px solid var(--hafsa-border);
        border-radius: 16px;
        box-shadow: 0 20px 55px rgba(15, 23, 42, .18);
        padding: 8px;
    }

    .hafsa-nav > li:hover > .hafsa-submenu,
    .hafsa-nav > li.desktop-open > .hafsa-submenu {
        display: block !important;
    }

    .hafsa-submenu a {
        white-space: normal;
    }
}

html,
body {
    direction: rtl;
}

body {
    font-family: "Noto Naskh Arabic", "Markazi Text", system-ui, sans-serif;
}

.hafsa-topbar-inner,
.hafsa-brand-row,
.hafsa-language,
.hafsa-actions,
.hafsa-brand,
.hafsa-nav,
.hafsa-hero-buttons {
    direction: rtl;
}

.hafsa-nav {
    justify-content: flex-start;
}

.hafsa-submenu {
    text-align: right;
}

.hafsa-hero {
    background:
        linear-gradient(135deg, rgba(15,118,110,.92), rgba(17,94,89,.85)),
        url("../images/brand/header1.jpg") center/cover no-repeat;
}

.hafsa-hero::after {
    background:
        radial-gradient(circle at 80% 30%, rgba(255,255,255,.20), transparent 30%),
        linear-gradient(270deg, rgba(0,0,0,.18), transparent);
}

.hafsa-hero-content {
    text-align: right;
}

@media (min-width: 992px) {
    .hafsa-submenu {
        text-align: right;
    }
}

/* =========================================================
   Phase 3C: Modern post and category pages
========================================================= */

.hafsa-post-card {
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 26px;
    box-shadow: 0 18px 50px rgba(15,23,42,.08);
    overflow: hidden;
    margin-bottom: 24px;
}

.hafsa-post-header {
    padding: 28px 30px 18px;
    background:
        radial-gradient(circle at top left, rgba(15,118,110,.10), transparent 34%),
        linear-gradient(135deg, #ffffff, #f8fafc);
    border-bottom: 1px solid rgba(229,231,235,.85);
}

.hafsa-post-title {
    color: var(--hafsa-primary-dark);
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1.35;
    font-weight: 900;
    margin: 0 0 14px;
}

.hafsa-post-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--hafsa-muted);
    font-size: 14px;
}

.hafsa-post-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 999px;
    padding: 7px 11px;
}

.hafsa-post-body {
    padding: 30px;
    font-size: 17px;
    line-height: 2;
    color: #243044;
}

.hafsa-post-body p {
    line-height: 2;
}

.hafsa-post-body img {
    max-width: 100%;
    height: auto !important;
    border-radius: 18px;
    box-shadow: 0 12px 34px rgba(15,23,42,.10);
}

.hafsa-post-footer {
    padding: 16px 30px 24px;
    border-top: 1px solid rgba(229,231,235,.85);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hafsa-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 9px 14px;
    background: linear-gradient(135deg, var(--hafsa-primary), var(--hafsa-primary-dark));
    color: #fff !important;
    font-weight: 700;
    text-decoration: none !important;
    border: 0;
}

.hafsa-comment-card {
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 22px;
    box-shadow: 0 12px 36px rgba(15,23,42,.07);
    overflow: hidden;
    margin-bottom: 22px;
}

.hafsa-comment-card .card-header {
    background: #f8fafc !important;
}

.hafsa-comment-item {
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
}

.hafsa-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.hafsa-category-card {
    display: block;
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 16px 42px rgba(15,23,42,.08);
    text-decoration: none !important;
    color: var(--hafsa-text);
    transition: transform .25s ease, box-shadow .25s ease;
}

.hafsa-category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 22px 58px rgba(15,23,42,.13);
    color: var(--hafsa-primary-dark);
}

.hafsa-category-image {
    height: 210px;
    overflow: hidden;
    background: #e5e7eb;
}

.hafsa-category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    transition: transform .35s ease;
}

.hafsa-category-card:hover img {
    transform: scale(1.05);
}

.hafsa-category-content {
    padding: 18px;
}

.hafsa-category-title {
    font-size: 18px;
    line-height: 1.55;
    font-weight: 900;
    margin: 0 0 10px;
    color: var(--hafsa-primary-dark);
}

.hafsa-empty-state {
    background: #fff;
    border: 1px dashed rgba(15,118,110,.35);
    border-radius: 22px;
    padding: 30px;
    text-align: center;
    color: var(--hafsa-muted);
}

@media (max-width: 991px) {
    .hafsa-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hafsa-post-header,
    .hafsa-post-body {
        padding: 22px;
    }
}

@media (max-width: 575px) {
    .hafsa-category-grid {
        grid-template-columns: 1fr;
    }

    .hafsa-category-image {
        height: 190px;
    }

    .hafsa-post-footer {
        padding: 16px 22px 22px;
    }
}

/* =========================================================
   Phase 3D: Modern sidebar
========================================================= */

.hafsa-sidebar {
    display: grid;
    gap: 18px;
}

.hafsa-side-card {
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 24px;
    box-shadow: 0 16px 42px rgba(15,23,42,.08);
    overflow: hidden;
}

.hafsa-side-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    color: var(--hafsa-text);
    text-decoration: none !important;
    transition: transform .22s ease, box-shadow .22s ease;
}

.hafsa-side-link:hover {
    color: var(--hafsa-primary-dark);
    transform: translateY(-3px);
}

.hafsa-side-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hafsa-primary), var(--hafsa-primary-dark));
    color: #fff;
    font-size: 22px;
    box-shadow: 0 12px 28px rgba(15,118,110,.22);
    flex: 0 0 auto;
}

.hafsa-side-title {
    margin: 0;
    font-size: 17px;
    line-height: 1.4;
    font-weight: 900;
    color: var(--hafsa-primary-dark);
}

.hafsa-side-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--hafsa-muted);
    line-height: 1.5;
}

.hafsa-side-header {
    padding: 16px 18px;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-bottom: 1px solid rgba(229,231,235,.9);
}

.hafsa-side-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 900;
    color: var(--hafsa-primary-dark);
}

.hafsa-side-body {
    padding: 18px;
}

.hafsa-status-result {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid rgba(229,231,235,.9);
    color: var(--hafsa-text);
    line-height: 1.7;
}

.hafsa-mini-post img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 18px;
    margin-bottom: 12px;
}

.hafsa-mini-post h4 {
    margin: 0 0 10px;
    color: var(--hafsa-primary-dark);
    font-size: 18px;
    line-height: 1.5;
    font-weight: 900;
}

.hafsa-mini-post p {
    color: var(--hafsa-muted);
    line-height: 1.7;
}

@media (max-width: 767px) {
    .hafsa-sidebar {
        margin-top: 20px;
    }
}

/* =========================================================
   Phase 3D-2: Modern homepage content cards
========================================================= */

.hafsa-home-section {
    margin-bottom: 28px;
}

.hafsa-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.hafsa-section-title h2 {
    margin: 0;
    color: var(--hafsa-primary-dark);
    font-size: clamp(22px, 2.4vw, 34px);
    font-weight: 900;
    line-height: 1.35;
}

.hafsa-section-title p {
    margin: 4px 0 0;
    color: var(--hafsa-muted);
    line-height: 1.7;
}

.hafsa-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.hafsa-stat-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 26px;
    box-shadow: 0 18px 50px rgba(15,23,42,.08);
    padding: 22px;
}

.hafsa-stat-card::after {
    content: "";
    position: absolute;
    width: 130px;
    height: 130px;
    inset-inline-end: -42px;
    top: -42px;
    background: radial-gradient(circle, rgba(15,118,110,.12), transparent 70%);
}

.hafsa-stat-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.hafsa-stat-icon {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hafsa-primary), var(--hafsa-primary-dark));
    color: #fff;
    font-size: 26px;
    box-shadow: 0 14px 30px rgba(15,118,110,.25);
    flex: 0 0 auto;
}

.hafsa-stat-number {
    display: block;
    color: var(--hafsa-primary-dark);
    font-size: 34px;
    line-height: 1;
    font-weight: 900;
}

.hafsa-stat-label {
    display: block;
    color: var(--hafsa-muted);
    font-weight: 700;
    line-height: 1.6;
    margin-top: 6px;
}

.hafsa-feature-card {
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 28px;
    box-shadow: 0 18px 50px rgba(15,23,42,.08);
    overflow: hidden;
    margin-bottom: 24px;
}

.hafsa-feature-grid {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 0;
}

.hafsa-feature-image {
    min-height: 230px;
    background: #e5e7eb;
    overflow: hidden;
}

.hafsa-feature-image img {
    width: 100%;
    height: 100%;
    min-height: 230px;
    object-fit: cover;
    border-radius: 0;
    transition: transform .35s ease;
}

.hafsa-feature-card:hover .hafsa-feature-image img {
    transform: scale(1.05);
}

.hafsa-feature-content {
    padding: 26px;
}

.hafsa-feature-title {
    margin: 0 0 10px;
    color: var(--hafsa-primary-dark);
    font-size: clamp(22px, 2.3vw, 32px);
    line-height: 1.45;
    font-weight: 900;
}

.hafsa-feature-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--hafsa-muted);
    font-size: 13px;
}

.hafsa-feature-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(229,231,235,.9);
    background: #f8fafc;
    border-radius: 999px;
    padding: 6px 10px;
}

.hafsa-feature-text {
    color: #334155;
    line-height: 1.9;
    margin-bottom: 18px;
}

.hafsa-latest-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.hafsa-latest-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 16px 42px rgba(15,23,42,.08);
    color: var(--hafsa-text);
    text-decoration: none !important;
    transition: transform .25s ease, box-shadow .25s ease;
}

.hafsa-latest-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 22px 58px rgba(15,23,42,.13);
    color: var(--hafsa-primary-dark);
}

.hafsa-latest-image {
    height: 180px;
    overflow: hidden;
    background: #e5e7eb;
}

.hafsa-latest-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    transition: transform .35s ease;
}

.hafsa-latest-card:hover .hafsa-latest-image img {
    transform: scale(1.05);
}

.hafsa-latest-content {
    padding: 18px;
}

.hafsa-latest-content h3 {
    margin: 0 0 10px;
    color: var(--hafsa-primary-dark);
    font-size: 18px;
    line-height: 1.55;
    font-weight: 900;
}

.hafsa-latest-content p {
    margin: 0;
    color: var(--hafsa-muted);
    line-height: 1.7;
}

.hafsa-gallery-strip {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 18px;
}

.hafsa-gallery-main,
.hafsa-gallery-small {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 24px;
    background: #e5e7eb;
    box-shadow: 0 16px 42px rgba(15,23,42,.08);
}

.hafsa-gallery-main img,
.hafsa-gallery-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    transition: transform .35s ease;
}

.hafsa-gallery-main {
    min-height: 330px;
}

.hafsa-gallery-small-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.hafsa-gallery-small {
    height: 158px;
}

.hafsa-gallery-main:hover img,
.hafsa-gallery-small:hover img {
    transform: scale(1.05);
}

.hafsa-gallery-caption {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 18px;
    background: linear-gradient(0deg, rgba(0,0,0,.70), transparent);
    color: #fff;
    font-weight: 900;
    line-height: 1.5;
}

@media (max-width: 991px) {
    .hafsa-feature-grid,
    .hafsa-gallery-strip {
        grid-template-columns: 1fr;
    }

    .hafsa-latest-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hafsa-feature-image,
    .hafsa-feature-image img {
        min-height: 220px;
    }
}

@media (max-width: 575px) {
    .hafsa-stats-grid,
    .hafsa-latest-grid {
        grid-template-columns: 1fr;
    }

    .hafsa-section-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .hafsa-gallery-small-grid {
        grid-template-columns: 1fr;
    }

    .hafsa-gallery-small {
        height: 190px;
    }
}

/* =========================================================
   Phase 3E: Modern forms
========================================================= */

.hafsa-form-card {
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 28px;
    box-shadow: 0 18px 50px rgba(15,23,42,.08);
    overflow: hidden;
}

.hafsa-form-header {
    padding: 28px 30px;
    background:
        radial-gradient(circle at top left, rgba(15,118,110,.12), transparent 35%),
        linear-gradient(135deg, #ffffff, #f8fafc);
    border-bottom: 1px solid rgba(229,231,235,.9);
}

.hafsa-form-header h1 {
    margin: 0;
    color: var(--hafsa-primary-dark);
    font-size: clamp(25px, 3vw, 40px);
    line-height: 1.35;
    font-weight: 900;
}

.hafsa-form-header p {
    margin: 8px 0 0;
    color: var(--hafsa-muted);
    line-height: 1.7;
}

.hafsa-form-body {
    padding: 30px;
}

.hafsa-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.hafsa-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.hafsa-form-field-full {
    grid-column: 1 / -1;
}

.hafsa-form-card label {
    font-weight: 800;
    color: #334155;
    margin-bottom: 8px;
}

.hafsa-form-card .form-control {
    min-height: 46px;
    border-radius: 14px !important;
    border: 1px solid rgba(203,213,225,.95) !important;
    box-shadow: none !important;
}

.hafsa-form-card .form-control:focus {
    border-color: var(--hafsa-primary) !important;
    box-shadow: 0 0 0 4px rgba(15,118,110,.13) !important;
}

.hafsa-form-footer {
    padding: 20px 30px 30px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.hafsa-alert {
    border-radius: 18px;
    padding: 16px 18px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    line-height: 1.7;
}

.hafsa-alert-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.hafsa-alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.hafsa-application-number {
    font-size: 24px;
    font-weight: 900;
    color: var(--hafsa-primary-dark);
}

@media (max-width: 991px) {
    .hafsa-form-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .hafsa-form-body,
    .hafsa-form-header,
    .hafsa-form-footer {
        padding: 22px;
    }

    .hafsa-form-grid,
    .hafsa-form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Phase 3F: Search and public list pages
========================================================= */

.hafsa-page-card {
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 28px;
    box-shadow: 0 18px 50px rgba(15,23,42,.08);
    overflow: hidden;
    margin-bottom: 26px;
}

.hafsa-page-header {
    padding: 28px 30px;
    background:
        radial-gradient(circle at top left, rgba(15,118,110,.12), transparent 35%),
        linear-gradient(135deg, #ffffff, #f8fafc);
    border-bottom: 1px solid rgba(229,231,235,.9);
}

.hafsa-page-header h1 {
    margin: 0;
    color: var(--hafsa-primary-dark);
    font-size: clamp(25px, 3vw, 40px);
    line-height: 1.35;
    font-weight: 900;
}

.hafsa-page-header p {
    margin: 8px 0 0;
    color: var(--hafsa-muted);
    line-height: 1.7;
}

.hafsa-page-body {
    padding: 30px;
}

.hafsa-search-list {
    display: grid;
    gap: 18px;
}

.hafsa-search-item {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 18px;
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(15,23,42,.07);
    color: var(--hafsa-text);
    text-decoration: none !important;
    transition: transform .25s ease, box-shadow .25s ease;
}

.hafsa-search-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 56px rgba(15,23,42,.12);
    color: var(--hafsa-primary-dark);
}

.hafsa-search-image {
    min-height: 150px;
    background: #e5e7eb;
    overflow: hidden;
}

.hafsa-search-image img {
    width: 100%;
    height: 100%;
    min-height: 150px;
    object-fit: cover;
    border-radius: 0;
}

.hafsa-search-content {
    padding: 18px;
}

.hafsa-search-content h2 {
    margin: 0 0 10px;
    color: var(--hafsa-primary-dark);
    font-size: 20px;
    line-height: 1.5;
    font-weight: 900;
}

.hafsa-search-content p {
    color: var(--hafsa-muted);
    line-height: 1.8;
    margin: 0 0 12px;
}

.hafsa-search-meta {
    color: var(--hafsa-muted);
    font-size: 13px;
}

.hafsa-batch-card {
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 24px;
    box-shadow: 0 14px 34px rgba(15,23,42,.07);
    overflow: hidden;
    margin-bottom: 22px;
}

.hafsa-batch-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-bottom: 1px solid rgba(229,231,235,.9);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.hafsa-batch-header h2 {
    margin: 0;
    color: var(--hafsa-primary-dark);
    font-size: 20px;
    line-height: 1.5;
    font-weight: 900;
}

.hafsa-batch-count {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 12px;
    background: #eef8f6;
    color: var(--hafsa-primary-dark);
    font-weight: 900;
}

.hafsa-table-wrap {
    overflow-x: auto;
}

.hafsa-modern-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

.hafsa-modern-table th,
.hafsa-modern-table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(229,231,235,.9);
    vertical-align: middle;
}

.hafsa-modern-table th {
    background: #f8fafc;
    color: var(--hafsa-primary-dark);
    font-weight: 900;
    white-space: nowrap;
}

.hafsa-modern-table tr:last-child td {
    border-bottom: 0;
}

.hafsa-modern-table tbody tr:hover {
    background: #f8fafc;
}

@media (max-width: 575px) {
    .hafsa-page-header,
    .hafsa-page-body {
        padding: 22px;
    }

    .hafsa-search-item {
        grid-template-columns: 1fr;
    }

    .hafsa-search-image,
    .hafsa-search-image img {
        min-height: 190px;
    }
}

/* =========================================================
   Phase 3F-2: Selected students page
========================================================= */

.hafsa-selected-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.hafsa-student-card {
    background: #fff;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(15,23,42,.07);
    padding: 18px;
    transition: transform .25s ease, box-shadow .25s ease;
}

.hafsa-student-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 56px rgba(15,23,42,.12);
}

.hafsa-student-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.hafsa-student-avatar {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--hafsa-primary), var(--hafsa-primary-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 12px 28px rgba(15,118,110,.22);
    flex: 0 0 auto;
}

.hafsa-student-name {
    margin: 0 0 8px;
    color: var(--hafsa-primary-dark);
    font-size: 18px;
    line-height: 1.5;
    font-weight: 900;
}

.hafsa-student-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--hafsa-muted);
    font-size: 13px;
}

.hafsa-student-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid rgba(229,231,235,.9);
    border-radius: 999px;
    padding: 6px 10px;
}

.hafsa-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 7px 12px;
    background: #ecfdf5;
    color: #065f46;
    font-weight: 900;
    border: 1px solid #a7f3d0;
}

@media (max-width: 767px) {
    .hafsa-selected-grid {
        grid-template-columns: 1fr;
    }
}
/* =========================================================
   Phase 3H: Performance cleanup helpers
========================================================= */

#back-to-top {
    display: none;
    position: fixed;
    inset-inline-end: 18px;
    bottom: 18px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hafsa-primary), var(--hafsa-primary-dark));
    color: #fff !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .22);
    text-decoration: none !important;
}

#back-to-top:hover {
    transform: translateY(-2px);
}
