/********** Template CSS **********/
:root {
    --bs-blue: #FFAC00;
    --bs-indigo: #1A685B;
    --bs-purple: #1A685B;
    --bs-pink: #1A685B;
    --bs-cyan: #1A685B;
    --bs-primary: #FFAC00;
    --bs-secondary: #1A685B;
    --bs-success: #198754;
    --bs-info: #1A685B;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #FDF8EA;
    --bs-dark: #051311;
    --bs-tertiary: #797E88;
}

.back-to-top {
    position: fixed;
    display: none;
    right: 30px;
    bottom: 120px;
    z-index: 99;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-medium {
    font-weight: 600 !important;
}

.fw-normal {
    font-weight: 400 !important;
}


/*** Spinner ***/
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease-out, visibility 0s linear .5s;
    z-index: 99999;
}

#spinner.show {
    transition: opacity .5s ease-out, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
}


/*** Button ***/
.btn {
    transition: .5s;
}

.btn-square {
    width: 38px;
    height: 38px;
}

.btn-sm-square {
    width: 32px;
    height: 32px;
}

.btn-lg-square {
    width: 48px;
    height: 48px;
}

.btn-square,
.btn-sm-square,
.btn-lg-square {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
}


/*** Top Bar ***/
.top-bar {
    height: 90px;
    padding: 0 90px;
}

.top-bar h6 {
    letter-spacing: 1px;
}


/*** Nav Bar ***/
.nav-bar {
    padding: 0 90px;
    transition: .5s;
}

.nav-bar.is-expanded {
    padding: 0;
}

.navbar .navbar-nav .nav-link {
    margin-right: 16px;
    padding: 20px 0;
    color: var(--bs-dark);
    font-size: 16px;
    outline: none;
}

.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link.active {
    color: var(--bs-white);
}

.navbar .dropdown-toggle::after {
    border: none;
    content: "\f107";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    vertical-align: middle;
    margin-left: 8px;
}

@media (max-width: 991.98px) {
    .navbar .navbar-nav .nav-link {
        margin-right: 0;
        padding: 10px 0;
    }

    .navbar .navbar-nav {
        margin-top: 20px;
        border-top: 1px solid var(--bs-white);
    }
}

@media (min-width: 992px) {
    .navbar .nav-item .dropdown-menu {
        display: block;
        border: none;
        margin-top: 0;
        top: 150%;
        opacity: 0;
        visibility: hidden;
        transition: .5s;
    }

    .navbar .nav-item:hover .dropdown-menu,
    .navbar .nav-item:focus-within .dropdown-menu,
    .navbar .nav-item .dropdown-menu.show {
        top: 100%;
        visibility: visible;
        transition: .5s;
        opacity: 1;
    }
}


/*** Header Carousel ***/
.header-carousel {
    position: relative;
    background: url(../img/bg.jpeg) center center no-repeat;
    background-size: cover;
}

.header-carousel .hero-title {
    font-size: clamp(2.25rem, 4vw, 3.75rem);
    line-height: 1.08;
}

.header-carousel .carousel-img {
    position: relative;
}

.header-carousel .owl-nav {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.header-carousel .owl-nav .owl-prev,
.header-carousel .owl-nav .owl-next {
    width: 45px;
    height: 45px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--bs-dark);
    background: var(--bs-primary);
}

.page-header {
    background: url(../img/bg.jpeg) center center no-repeat;
    background-size: cover;
}

.page-header .breadcrumb-item+.breadcrumb-item::before {
    color: var(--bs-tertiary);
}

.page-header .breadcrumb-item,
.page-header .breadcrumb-item a {
    font-size: 18px;
    color: var(--bs-primary);
}

.page-header .breadcrumb-item.active {
    color: var(--bs-dark);
}


/*** Section Title ***/
.section-title {
    position: relative;
    display: inline-block;
    text-transform: uppercase;
}

.section-title::before {
    position: absolute;
    content: "";
    width: calc(100% + 80px);
    height: 0px;
    top: 5px;
    left: -40px;
    border-top: 2px solid var(--bs-primary);
    z-index: -1;
}

.section-title::after {
    position: absolute;
    content: "";
    width: calc(100% + 120px);
    height: 0px;
    bottom: 6px;
    left: -60px;
    border-bottom: 2px solid var(--bs-primary);
    z-index: -1;
}

.section-title.text-start::before {
    width: calc(100% + 40px);
    left: 0;
}

.section-title.text-start::after {
    width: calc(100% + 60px);
    left: 0;
}


/*** About ***/
.about-img {
    position: relative;
}

.about-img::before,
.about-img::after {
    position: absolute;
    content: "";
    width: 33%;
    height: 90px;
    background: var(--bs-white);
}

.about-img::before {
    top: 0px;
    left: 0px;
}

.about-img::after {
    right: 0px;
    bottom: 0px;
}


/*** Service ***/
.service-title {
    height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: url(../img/bg.jpeg) center center no-repeat;
    background-size: cover;
}

.service-title h2 {
    min-width: 0;
    font-size: clamp(1.1rem, 2.2vw, 2rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.service-item {
    overflow: hidden;
}

.service-item .btn-square {
    width: 65px;
    height: 65px;
}

.service-item a {
    position: relative;
    padding: 0;
    font-size: 14px;
    line-height: 14px;
    text-transform: uppercase;
    transition: .5s;
}

.service-item a::after {
    position: absolute;
    content: "";
    width: 500%;
    height: 0;
    left: 100%;
    bottom: 3px;
    margin-left: 10px;
    border-bottom: 2px solid var(--bs-primary);
}


/*** Donation ***/
.donation-item {
    box-shadow: 0 0 30px rgba(0, 0, 0, .05);
    transition: .5s;
}

.donation-item:hover {
    box-shadow: 0 0 30px rgba(0, 0, 0, .1);
}

.donation-item .donation-progress {
    width: 80px;
}

.donation-item .progress .progress-bar {
    height: 20px;
    overflow: visible;
    transition: 3s;
}


/*** Banner ***/
.banner .banner-inner {
    position: relative;
    padding: clamp(1.25rem, 5vw, 3rem);
    background: url(../img/bg.jpeg) center center no-repeat;
    background-size: cover;
}

.banner .banner-inner > * {
    position: relative;
    z-index: 1;
}

.banner .banner-inner h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.banner .banner-inner p {
    max-width: 48rem;
    margin-right: auto;
    margin-left: auto;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.banner-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.banner-actions .btn {
    margin: 0;
}

.banner .banner-inner::before,
.banner .banner-inner::after {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
}

.banner .banner-inner::before {
    top: 0;
    left: 0;
    border-top: 150px solid var(--bs-primary);
    border-right: 150px solid transparent;
}

.banner .banner-inner::after {
    right: 0;
    bottom: 0;
    border-bottom: 150px solid var(--bs-secondary);
    border-left: 150px solid transparent;
}


/*** Event ***/
.event-item {
    box-shadow: 0 0 30px rgba(0, 0, 0, .05);
    transition: .5s;
}

.event-item:hover {
    box-shadow: 0 0 30px rgba(0, 0, 0, .1);
}


/*** Donate ***/
.donate .donate-text {
    position: relative;
    background: url(../img/bg.jpeg) center center no-repeat;
    background-size: cover;
}

.donate .donate-text::before,
.donate .donate-text::after {
    position: absolute;
    content: "";
    width: 0;
    height: 0;
}

.donate .donate-text::before {
    top: 0;
    left: 0;
    border-top: 150px solid var(--bs-primary);
    border-right: 150px solid transparent;
}

.donate .donate-text::after {
    right: 0;
    bottom: 0;
    border-bottom: 150px solid var(--bs-secondary);
    border-left: 150px solid transparent;
}

.donate .donate-form .form-control {
    border: none;
    background: rgba(255, 255, 255, .5);
}

.donate .donate-form .btn-group {
    display: flex;
}

.donate .donate-form .btn-group .btn {
    margin: 0;
    padding: 0;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--bs-tertiary);
    background: rgba(255, 255, 255, .5);
}

.donate .donate-form .btn-group .btn-check:checked+.btn {
    border: none;
    background: var(--bs-white);
}



/*** Team ***/
.team-item {
    box-shadow: 0 0 30px rgba(0, 0, 0, .05);
    transition: .5s;
}

.team-item:hover {
    box-shadow: 0 0 30px rgba(0, 0, 0, .1);
}

.team-item .team-detail span {
    letter-spacing: 2px;
}



/*** Testimonial ***/
.testimonial-carousel {
    position: relative;
}

.testimonial-title {
    height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: url(../img/bg.jpeg) center center no-repeat;
    background-size: cover;
}

.testimonial-img {
    position: relative;
    padding: 45px 0 45px 90px;
}

.testimonial-img::before {
    position: absolute;
    content: "";
    top: 0;
    left: 0;
    width: calc(50% + 45px);
    height: 100%;
    background: var(--bs-primary);
    z-index: -1;
}

.testimonial-carousel .owl-nav {
    position: absolute;
    top: 50%;
    left: 1.5rem;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
}

.testimonial-carousel .owl-prev,
.testimonial-carousel .owl-next {
    width: 45px;
    height: 45px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--bs-white);
    background: var(--bs-secondary);
    transition: .5s;
}

.testimonial-carousel .owl-prev:hover,
.testimonial-carousel .owl-next:hover {
    color: var(--bs-secondary);
    background: var(--bs-white);
}

@media (max-width: 768px) {
    .testimonial-carousel .owl-nav {
        top: 6.3rem;
    }
}



/*** Footer ***/
.footer {
    color: var(--bs-tertiary);
    background: linear-gradient(rgba(5, 19, 17, .95), rgba(5, 19, 17, .95)), url(../img/bg-footer.jpeg) center center no-repeat;
    background-size: cover;
}

.footer .btn.btn-link {
    display: block;
    margin-bottom: 5px;
    padding: 0;
    text-align: left;
    color: var(--bs-tertiary);
    font-weight: normal;
    text-transform: capitalize;
    transition: .3s;
}

.footer .btn.btn-link::before {
    position: relative;
    content: "\f105";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-right: 10px;
}

.footer .btn.btn-link:hover {
    color: var(--bs-light);
    letter-spacing: 1px;
    box-shadow: none;
}

.footer .copyright {
    border-top: 1px solid rgba(255, 255, 255, .1);
}

.top-bar {
    height: auto;
    min-height: 84px;
    padding: 12px clamp(16px, 4vw, 60px);
}

.top-bar > .row {
    min-height: 60px;
}

.top-bar .brand-name {
    max-width: 100%;
    font-size: clamp(1.35rem, 2.4vw, 2.1rem);
    line-height: 1.1;
    white-space: nowrap;
}

.top-bar .row .row {
    row-gap: 12px;
}

.top-bar .row .row > div {
    min-width: 0;
}

.top-bar .row .row > div > .d-flex {
    justify-content: flex-start !important;
}

.top-bar .row .row > div span {
    font-size: 0.85rem;
}

.nav-bar .navbar-nav .nav-link {
    margin-right: 12px;
    font-size: 15px;
}

.nav-bar .navbar-nav .dropdown-button {
    white-space: nowrap;
}

.page-header .display-3 {
    font-size: clamp(2rem, 4vw, 3.75rem);
}

.container,
.container-fluid,
.row > *,
.navbar,
.navbar-nav,
.donation-detail,
.team-detail {
    min-width: 0;
}

main h1,
main h2,
main h3,
main h4,
main h5,
main h6 {
    overflow-wrap: normal;
    word-break: normal;
    text-wrap: balance;
}

.testimonial-title .testimonial-heading {
    font-size: clamp(1.25rem, 2.2vw, 2rem);
    line-height: 1.18;
    overflow-wrap: normal;
    word-break: normal;
    text-wrap: pretty;
}

@media (max-width: 1199.98px) {
    .nav-bar {
        padding-right: 32px;
        padding-left: 32px;
    }

    .nav-bar.is-expanded {
        padding-right: 0;
        padding-left: 0;
    }

    .top-bar {
        padding-right: 32px;
        padding-left: 32px;
    }
}

@media (max-width: 991.98px) {
    .top-bar {
        padding: 12px 20px;
    }

    .top-bar > .row {
        min-height: 48px;
    }

    .nav-bar,
    .nav-bar.is-expanded {
        padding: 0 16px;
    }

    .navbar .navbar-nav .nav-link {
        margin-right: 0;
        padding: 10px 0;
    }
}

@media (max-width: 575.98px) {
    .header-carousel .hero-title {
        font-size: clamp(2rem, 9vw, 3rem);
    }

    .hero-carousel .display-1 {
        font-size: clamp(2rem, 9vw, 3rem);
    }

    .banner .banner-inner::before {
        border-top-width: 80px;
        border-right-width: 80px;
    }

    .banner .banner-inner::after {
        border-bottom-width: 80px;
        border-left-width: 80px;
    }

    .banner-actions {
        flex-direction: column;
        align-items: center;
    }

    .banner-actions .btn {
        width: min(100%, 16rem);
    }
}

/*** Admin dashboard — original Charity brand colors ***/
.admin-layout {
    --admin-primary: #FFAC00;
    --admin-secondary: #1A685B;
    --admin-success: #198754;
    --admin-warning: #f6b51e;
    --admin-error: #ef4444;
    --admin-info: #1A685B;
    --admin-dark: #051311;
    --admin-white: #ffffff;
    --admin-sidebar-fg: #1f2d2b;
    --admin-body-bg: #f5f5f5;
    --admin-border: #dfe5ef;
    --admin-lightprimary: rgba(255, 172, 0, 0.12);
}

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--admin-white);
    color: var(--admin-sidebar-fg);
    height: 100vh;
    position: sticky;
    top: 0;
    border-right: 1px solid var(--admin-border);
    box-shadow: 0 0 1rem rgba(0,0,0,.05);
}

.admin-brand {
    font-size: 1.25rem;
    border-bottom: 1px solid var(--admin-border);
    color: var(--admin-sidebar-fg);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.admin-nav-item {
    color: var(--admin-sidebar-fg) !important;
    transition: .2s;
    border-left: 3px solid transparent;
    background: transparent;
    margin-bottom: 0.25rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.admin-nav-item:hover,
.admin-nav-item:focus {
    color: var(--admin-primary) !important;
    background: var(--admin-lightprimary);
    border-left-color: var(--admin-primary);
}

.admin-nav-item.active {
    color: var(--admin-primary) !important;
    background: var(--admin-lightprimary);
    border-left-color: var(--admin-primary);
    font-weight: 600;
}

.admin-topbar {
    background: var(--admin-dark);
    color: var(--admin-white);
    border-bottom: 1px solid rgba(0,0,0,.1);
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.admin-main {
    min-height: calc(100vh - 72px);
    background: var(--admin-body-bg);
    padding: 2rem !important;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed;
        left: -100%;
        transition: .3s;
        z-index: 1050;
        height: 100vh;
        overflow-y: auto;
    }
    .admin-main {
        width: 100%;
        padding: 1rem;
    }
}

/* Ensure all buttons are always visible */
.admin-layout .btn {
    border: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.admin-layout .btn-outline-primary {
    color: var(--admin-primary);
    border-color: var(--admin-primary);
    background: transparent;
}
.admin-layout .btn-outline-primary:hover {
    background: var(--admin-primary);
    color: #fff;
}

.admin-layout .btn-outline-secondary {
    color: #6c757d;
    border-color: #dee2e6;
    background: transparent;
}
.admin-layout .btn-outline-secondary:hover {
    background: #f8f9fa;
    color: #212529;
}

.admin-layout .btn-primary {
    background: var(--admin-primary);
    color: #fff;
}
.admin-layout .btn-primary:hover {
    background: color-mix(in oklab, var(--admin-primary) 85%, black);
    color: #fff;
}

.admin-layout .btn-success {
    background: var(--admin-success);
    color: #000;
}
.admin-layout .btn-success:hover {
    background: color-mix(in oklab, var(--admin-success) 85%, black);
    color: #000;
}

.admin-layout .btn-danger {
    background: var(--admin-error);
    color: #fff;
}
.admin-layout .btn-danger:hover {
    background: color-mix(in oklab, var(--admin-error) 85%, black);
    color: #fff;
}

.admin-layout .btn-outline-danger {
    color: var(--admin-error);
    border-color: var(--admin-error);
    background: transparent;
}
.admin-layout .btn-outline-danger:hover {
    background: var(--admin-error);
    color: #fff;
}

.admin-layout .btn-outline-info {
    color: var(--admin-info);
    border-color: var(--admin-info);
    background: transparent;
}
.admin-layout .btn-outline-info:hover {
    background: var(--admin-info);
    color: #fff;
}

/* Table styles */
.admin-layout .table thead th {
    background: #f8f9fa;
    color: var(--admin-sidebar-fg);
    font-weight: 600;
    border-bottom: 2px solid var(--admin-border);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-layout .table tbody tr {
    transition: background 0.2s ease;
}

.admin-layout .table tbody tr:hover {
    background: var(--admin-lightprimary);
}

/* Card styles */
.admin-layout .card {
    border: 1px solid var(--admin-border);
    border-radius: 0.75rem;
    box-shadow: 0 0 1rem rgba(0,0,0,.04);
    transition: box-shadow 0.2s ease;
}

.admin-layout .card:hover {
    box-shadow: 0 0 1.5rem rgba(0,0,0,.08);
}

.admin-layout .card-body {
    padding: 1.5rem;
}

/* Badge styles */
.admin-layout .badge {
    font-weight: 600;
    padding: 0.4em 0.8em;
    border-radius: 0.5rem;
}

/* Form controls */
.admin-layout .form-control, .admin-layout .form-select {
    border: 1px solid var(--admin-border);
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
}
.admin-layout .form-control:focus, .admin-layout .form-select:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 0.2rem color-mix(in oklab, var(--admin-primary) 20%, transparent);
    outline: none;
}

/* List group */
.admin-layout .list-group-item {
    border: none;
    border-bottom: 1px solid var(--admin-border);
    padding: 0.875rem 1rem;
}
.admin-layout .list-group-item:last-child {
    border-bottom: none;
}

/* Alert styles */
.admin-layout .alert {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}
.admin-layout .alert-info {
    background: color-mix(in oklab, var(--admin-primary) 10%, transparent);
    color: var(--admin-primary-emphasis, var(--admin-primary));
}
.admin-layout .alert-danger {
    background: color-mix(in oklab, var(--admin-error) 10%, transparent);
    color: var(--admin-error);
}

/* Admin dashboard enhancements */
.admin-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.admin-dashboard .stat-card {
    background: var(--admin-white);
    border: 1px solid var(--admin-border) !important;
}

.admin-dashboard .stat-card .stat-icon {
    font-size: 1.5rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-dashboard .empty-state i {
    color: var(--admin-sidebar-fg);
}

.admin-layout .table-responsive {
    overflow-x: auto;
}

.admin-layout .table th,
.admin-layout .table td {
    vertical-align: middle;
    padding: 0.875rem 1rem;
}

.admin-layout .card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--admin-border) !important;
    padding: 1rem 1.5rem;
}

.admin-layout .card-footer {
    background: transparent !important;
    border-top: 1px solid var(--admin-border) !important;
    padding: 1rem 1.5rem;
}

/* Toast notifications */
.toast-container {
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 450px;
    margin-bottom: 1rem;
    animation: toastSlideIn 0.3s ease-out forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast .btn-close {
    filter: invert(1);
    opacity: 0.7;
}

.toast .btn-close:hover {
    opacity: 1;
}

/* Prevent horizontal scrolling on admin pages */
.admin-main {
    overflow-x: hidden;
}

.admin-layout .table-responsive {
    overflow-x: auto;
    max-width: 100%;
}

.admin-layout .table {
    min-width: 100%;
}

/* Ensure images don't overflow containers */
.admin-layout img {
    max-width: 100%;
    height: auto;
}

/* Clickable table rows */
.cursor-pointer {
    cursor: pointer;
}

/* ============================================================
   Responsive admin sidebar — mobile offcanvas (below 992px)
   ============================================================ */
.admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1040;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.admin-overlay.open {
  display: block;
  opacity: 1;
}

@media (max-width: 991.98px) {
  .admin-sidebar.show {
    left: 0;
    box-shadow: 0 0 1.5rem rgba(0, 0, 0, 0.1);
  }

  /* Lock body scroll while the mobile sidebar is open */
  body.admin-sidebar-open,
  html.admin-sidebar-open {
    overflow: hidden;
    width: 100%;
    height: 100%;
  }

  .admin-topbar {
    flex-wrap: wrap;
  }
}

@media (min-width: 992px) {
  .admin-sidebar {
    left: 0 !important;
    position: sticky !important;
  }
  .admin-overlay {
    display: none !important;
  }
}

/* ============================================================
   Responsive admin dashboard — all devices
   Mobile-first: base styles target phones, media queries scale up
   ============================================================ */

/* Fluid, safe padding for the main content area on every screen */
.admin-main {
  padding: clamp(0.75rem, 3vw, 2rem) !important;
  min-height: calc(100dvh - 72px);
}

/* Topbar: stack brand + toggle on narrow screens, keep usable heights */
.admin-topbar {
  min-height: auto;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  gap: 0.5rem;
}
.admin-topbar .d-flex.align-items-center.gap-2 {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Sidebar brand + nav: tighter on phones */
.admin-brand {
  font-size: 1.15rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.admin-nav-item {
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
}

/* Mobile sidebar: full-height offcanvas, readable width on small phones */
@media (max-width: 991.98px) {
  .admin-sidebar {
    width: min(280px, 85vw);
    max-width: 85vw;
  }
  .admin-main {
    padding: clamp(0.6rem, 3vw, 1rem) !important;
  }
}

/* Stat cards: 4 per row on md+, 2 per row below, 1 per row on very small phones */
.admin-dashboard .row.g-4 > .col-md-3,
.admin-dashboard .row.g-4 > [class*="col-"] {
  min-width: 0;
}
@media (max-width: 575.98px) {
  .admin-dashboard .row.g-4 > .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Dashboard two-column layout: stack cleanly, no horizontal overflow */
.admin-dashboard .row.g-4 {
  flex-wrap: wrap;
}
.admin-dashboard .col-lg-8,
.admin-dashboard .col-lg-4 {
  min-width: 0;
}

/* Cards: readable on small screens */
.admin-layout .card {
  margin-bottom: 1rem;
}
.admin-layout .card-body {
  padding: 1.25rem;
}
.admin-layout .card-header {
  padding: 0.875rem 1.25rem;
}

/* Tables: legible text and touch-friendly padding on phones */
.admin-layout .table {
  font-size: 0.875rem;
}
.admin-layout .table th,
.admin-layout .table td {
  padding: 0.6rem 0.75rem;
  vertical-align: middle;
}
.admin-layout .table-responsive {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Buttons: minimum touch target 44px, full-width or sensible on phones */
.admin-layout .btn {
  min-height: 44px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
}
.admin-layout .btn-sm {
  min-height: 40px;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
}
.admin-layout .btn.w-100,
.admin-layout .d-grid .btn {
  width: 100% !important;
}

/* Stack action button groups on phones */
.admin-layout .d-flex.gap-2,
.admin-layout .d-flex.gap-1 {
  flex-wrap: wrap;
}

/* Form controls: full width and easy to tap on phones */
.admin-layout .form-control,
.admin-layout .form-select {
  min-height: 44px;
  font-size: 1rem; /* prevents iOS zoom on focus */
  width: 100%;
}
.admin-layout .form-label {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.admin-layout .form-text {
  font-size: 0.85rem;
}

/* List group items: tap-friendly */
.admin-layout .list-group-item {
  min-height: 48px;
  display: flex;
  align-items: center;
}

/* Alerts: readable, full width */
.admin-layout .alert {
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
}

/* Badges: legible on small screens */
.admin-layout .badge {
  font-size: 0.8rem;
  padding: 0.35em 0.7em;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

/* Dashboard section headers: don't wrap awkwardly */
.admin-layout .card-header.d-flex.justify-content-between.align-items-center {
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center !important;
}
.admin-layout .card-header h5 {
  font-size: 1.1rem;
}

/* Partnership/card articles: stack details on phones */
.admin-layout .article,
.admin-layout .card .row.g-2 > div {
  min-width: 0;
}
@media (max-width: 575.98px) {
  .admin-layout .card .row.g-2 > .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Empty states and headings: scale down on phones */
.admin-dashboard h1,
.admin-dashboard .h3 {
  font-size: clamp(1.25rem, 5vw, 1.75rem);
}
.admin-dashboard h2,
.admin-dashboard .h5 {
  font-size: clamp(1rem, 4vw, 1.35rem);
}
.admin-dashboard p.text-muted.small,
.admin-dashboard .text-muted {
  font-size: 0.875rem;
}

/* Ensure no horizontal scroll anywhere in admin */
.admin-layout,
.admin-main,
.admin-dashboard {
  overflow-x: hidden;
  max-width: 100%;
}

/* Detail page tables (supporters/contributions/[id]) — stack on phones */
@media (max-width: 575.98px) {
  .admin-layout .table th,
  .admin-layout .table td {
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
  }
  .admin-layout .table thead {
    display: table-header-group; /* keep headers visible when scrolling */
  }
}

/* Toast: position safely on mobile */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 1060;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  pointer-events: auto;
  width: 100%;
  max-width: none;
  margin: 0;
}
@media (min-width: 576px) {
  .toast-container {
    top: 1rem;
    right: 1rem;
    left: auto;
    flex-direction: column;
    align-items: flex-end;
  }
  .toast {
    min-width: 300px;
    max-width: 450px;
    width: auto;
  }
}

/* ============================================================
   Additional mobile safety nets
   ============================================================ */

/* Stack w-50 buttons inside d-flex.gap-2 on phones (review actions, etc.) */
@media (max-width: 575.98px) {
  .admin-layout .d-flex.gap-2 .btn.w-50,
  .admin-layout .d-flex.gap-2 .btn.w-md-50 {
    width: 100% !important;
  }
  .admin-layout .d-flex.gap-2 {
    flex-direction: column !important;
  }
}

/* Ensure admin header rows wrap instead of overflowing on phones */
@media (max-width: 575.98px) {
  .admin-layout .d-flex.justify-content-between {
    flex-wrap: wrap !important;
  }
  .admin-layout .d-flex.justify-content-between > * {
    flex: 0 0 auto;
  }
}

/* Mobile-safe viewport height (accounts for browser address bar) */
.admin-layout {
  min-height: -webkit-fill-available;
  min-height: stretch;
}

/* Auth page: card should not overflow on narrow phones */
.admin-auth-page {
  padding: 1rem;
}
.admin-auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 1.25rem;
}

/* Detail page images: never overflow on phones */
.admin-layout img[style*="width: \"140px\""],
.admin-layout .rounded-circle {
  max-width: 100%;
  height: auto;
}

/* Supporter detail avatar: cap size on phones */
@media (max-width: 575.98px) {
  .admin-layout .rounded-circle.border[style] {
    width: 100px !important;
    height: 100px !important;
  }
}

/* Prevent any remaining horizontal overflow on admin */
.admin-layout * {
  max-width: 100%;
}