/* Home Page Custom Styles */

/* Hero Carousel */
.hero-carousel-wrapper {
    position: relative;
    overflow: hidden;
}

.hero-carousel {
    width: 100%;
}

.hero-carousel-item {
    position: relative;
    height: 700px !important;
    max-height: 700px !important;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.carousel-item img {
    width: 100%;
    height: 600px;
}

@media (max-width: 768px) {
    .carousel-item img {
        height: 300px;
    }
    .hero-carousel-wrapper .carousel-caption h5,
    .carousel-caption {
        font-size: 20px !important;
        display: block !important;
    }
    .carousel-caption .btn-link {
        display: none !important;
    }
}
.hero-carousel-placeholder {
    background: linear-gradient(
            135deg,
            rgba(var(--primary-rgb), 0.8),
            rgba(var(--primary-rgb), 0.5)
        ),
        url("../images/hero/hero-placeholder.jpg") center/cover no-repeat;
}

.hero-carousel-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1);
    transition: transform 8s ease, filter 0.8s ease;
    filter: brightness(0.9) contrast(1.1);
}

.carousel-item.active .hero-carousel-image {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.hero-carousel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.6) 40%,
        rgba(0, 0, 0, 0.4) 70%,
        rgba(0, 0, 0, 0.2) 100%
    );
    pointer-events: none;
}

.hero-carousel-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 clamp(24px, 8vw, 120px);
    z-index: 2;
    background: radial-gradient(
        ellipse at left center,
        rgba(0, 0, 0, 0.3) 0%,
        transparent 70%
    );
}

.hero-carousel-caption {
    position: relative;
    color: var(--white);
    padding: 40px 36px;
    border-radius: 24px;
    backdrop-filter: blur(20px);
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.12),
        rgba(255, 255, 255, 0.04)
    );
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    max-width: 650px;
    transform: translateY(0);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    animation: slideInLeft 1.2s ease-out;
}

.hero-carousel-wrapper .carousel-caption {
    top: 30%;
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translate(-70%, -80%);
    text-align: center;
    width: min(90%, 900px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 32px;
}

.hero-carousel-wrapper .carousel-caption h5 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--white);
    text-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}

.hero-carousel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(var(--secondary-rgb, 255, 194, 0), 0.12);
    color: var(--white);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-badge i {
    font-size: 1.1rem;
    color: var(--secondary);
}

.hero-slide-index {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.3em;
    color: rgba(255, 255, 255, 0.7);
}

.hero-slide-index .divider {
    width: 36px;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    display: inline-block;
}

.hero-carousel-subtitle {
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 18px;
}

.hero-carousel-title {
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    color: var(--white);
    margin-bottom: 24px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

.hero-carousel-caption .hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    margin-bottom: 32px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 35px rgba(238, 90, 36, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    color: var(--white);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.hero-carousel-caption .hero-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transition: left 0.5s ease;
    z-index: -1;
}

.hero-carousel-caption .hero-btn:hover::before {
    left: 100%;
}

.hero-carousel-caption .hero-btn:hover {
    transform: translateY(-3px) scale(1.05);
    background: linear-gradient(135deg, #ff7979 0%, #fd79a8 100%);
    box-shadow: 0 20px 50px rgba(238, 90, 36, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

.hero-carousel-caption .hero-btn:active {
    transform: translateY(-1px) scale(1.02);
}

.hero-carousel-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.7;
    margin-bottom: 28px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    max-width: 520px;
}

.hero-carousel-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 28px;
}

.hero-carousel-actions .hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding-inline: 28px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.hero-btn-secondary {
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    padding: 12px 26px;
    color: var(--white);
    transition: all 0.3s ease;
    background: transparent;
}

.hero-btn-secondary:hover,
.hero-btn-secondary:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.6);
    color: var(--white);
}

.hero-btn-secondary i {
    font-size: 1.2rem;
}

.hero-carousel-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 14px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.hero-stat {
    padding: 12px 0;
}

.hero-stat-number {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--white);
}

.hero-stat-label {
    display: block;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.hero-carousel .carousel-indicators [data-bs-target] {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.45);
    border: 0;
    margin: 0 6px;
    transition: all 0.3s ease;
}

.hero-carousel .carousel-indicators .active {
    background-color: var(--secondary);
    transform: scale(1.1);
}

.hero-carousel-control {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    transition: all 0.3s ease;
    top: 50%;
    transform: translateY(-50%);
}

.hero-carousel-control:hover,
.hero-carousel-control:focus {
    background: rgba(var(--primary-rgb), 0.75);
}

.hero-carousel-control .carousel-control-prev-icon,
.hero-carousel-control .carousel-control-next-icon {
    width: 22px;
    height: 22px;
}

[dir="rtl"] .hero-carousel-control .carousel-control-prev-icon,
[dir="rtl"] .hero-carousel-control .carousel-control-next-icon {
    transform: scaleX(-1);
}

[dir="rtl"] .hero-carousel-caption {
    text-align: right;
}

[dir="rtl"] .hero-carousel-subtitle {
    letter-spacing: 0.06em;
}

@media (max-width: 1199px) {
    .hero-carousel-item {
        height: 600px;
        max-height: 600px;
    }

    .hero-carousel-caption {
        padding: 28px;
    }
}

@media (max-width: 991px) {
    .hero-carousel-item {
        height: 500px;
        max-height: 500px;
    }

    .hero-carousel-content {
        justify-content: center;
        padding-inline: clamp(18px, 6vw, 48px);
    }

    .hero-carousel-caption {
        margin-inline: auto;
        text-align: center;
        padding: 32px 24px;
        max-width: 90%;
    }

    .hero-carousel-title {
        font-size: clamp(2.2rem, 5vw, 3.2rem);
    }

    .hero-carousel-top {
        flex-direction: column;
        gap: 10px;
    }

    .hero-carousel-subtitle {
        margin-bottom: 12px;
    }

    .hero-carousel-title {
        margin-bottom: 14px;
    }

    .hero-carousel-text {
        margin-bottom: 22px;
    }

    .hero-carousel-control {
        width: 48px;
        height: 48px;
    }

    .hero-carousel-actions {
        justify-content: center;
    }

    .hero-carousel-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .hero-carousel-item {
        height: 300px;
        max-height: 300px;
    }

    .hero-carousel-caption {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .hero-carousel-content {
        padding-inline: 18px;
    }

    .hero-carousel-title {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
        margin-bottom: 16px;
    }

    .hero-carousel-text {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .hero-carousel-caption .hero-btn {
        width: 100%;
        justify-content: center;
        padding: 16px 32px;
        font-size: 1rem;
    }

    .hero-carousel-subtitle {
        font-size: 0.8rem;
    }

    .hero-carousel-text {
        font-size: 0.95rem;
    }

    .hero-carousel-actions {
        flex-direction: column;
        gap: 12px;
    }

    .hero-carousel-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Counter Section */
.counter-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    padding: 80px 0;
}

.counter-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23ffffff" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>')
        repeat;
    pointer-events: none;
}

.counter-card {
    position: relative;
    border-radius: 22px;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.18),
        rgba(255, 255, 255, 0.06)
    );
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(22px);
    box-shadow: 0 32px 60px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: all 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    text-align: center;
}

.counter-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.18),
        transparent
    );
    transition: left 0.6s ease;
}

.counter-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 38px 80px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.counter-card:hover::before {
    left: 100%;
}

.counter-card-inner {
    position: relative;
    z-index: 1;
    padding: 38px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.counter-icon-badge {
    width: 74px;
    height: 74px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(var(--secondary-rgb), 0.16);
    color: var(--secondary, #ffd700);
    font-size: 32px;
    box-shadow: 0 16px 32px rgba(255, 215, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.35s ease;
}

.counter-card:hover .counter-icon-badge {
    transform: translateY(-6px) scale(1.05);
    box-shadow: 0 22px 48px rgba(255, 215, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.counter-value {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.counter-number {
    font-size: clamp(2.8rem, 4.6vw, 3.6rem);
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #eceff4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.35s ease;
}

.counter-card:hover .counter-number {
    transform: translateY(-4px);
}

.counter-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    text-transform: capitalize;
    letter-spacing: 0.45px;
    line-height: 1.5;
}

.counter-description {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.98rem;
    line-height: 1.6;
    max-width: 240px;
}

/* RTL Support for Counters */
[dir="rtl"] .counter-card {
    text-align: center;
}

[dir="rtl"] .counter-icon-badge i {
    transform: scaleX(-1);
}

[dir="rtl"] .counter-card:hover .counter-icon-badge i {
    transform: scaleX(-1) scale(1.05);
}

@media (max-width: 768px) {
    .counter-section {
        padding: 60px 0;
    }

    .counter-card-inner {
        padding: 32px 26px;
    }

    .counter-icon-badge {
        width: 66px;
        height: 66px;
        font-size: 28px;
    }

    .counter-number {
        font-size: clamp(2.4rem, 5vw, 3rem);
    }

    .counter-description {
        font-size: 0.95rem;
    }
}

@media (max-width: 575px) {
    .counter-section {
        padding: 50px 0;
    }

    .counter-card-inner {
        padding: 26px 20px;
        gap: 14px;
    }

    .counter-icon-badge {
        width: 58px;
        height: 58px;
        font-size: 26px;
    }

    .counter-number {
        font-size: clamp(2rem, 8vw, 2.6rem);
    }

    .counter-description {
        font-size: 0.9rem;
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes titleGlow {
    0% {
        text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }
    100% {
        text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7),
            0 0 40px rgba(255, 255, 255, 0.1);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hero Section RTL Support */
[dir="rtl"] .hero-caption {
    text-align: right;
}

[dir="rtl"] .hero-image {
    order: -1;
}

/* Better spacing for RTL */
[dir="rtl"] .gap-20 {
    gap: 20px;
    flex-direction: row-reverse;
}

[dir="rtl"] .gap-22 {
    gap: 22px;
    flex-direction: row-reverse;
}

/* Smooth Scrolling and Performance */
html {
    scroll-behavior: smooth;
}

/* Loading Animation */
.hero-carousel-item,
.counter-card,
.helpful-card,
.single-blog,
.single-donate {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.hero-carousel-item {
    animation-delay: 0.2s;
}

.counter-card:nth-child(1) {
    animation-delay: 0.1s;
}
.counter-card:nth-child(2) {
    animation-delay: 0.2s;
}
.counter-card:nth-child(3) {
    animation-delay: 0.3s;
}
.counter-card:nth-child(4) {
    animation-delay: 0.4s;
}

.helpful-card:nth-child(1) {
    animation-delay: 0.1s;
}
.helpful-card:nth-child(2) {
    animation-delay: 0.2s;
}
.helpful-card:nth-child(3) {
    animation-delay: 0.3s;
}
.helpful-card:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Focus States */
.hero-btn:focus,
.btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.carousel-control-prev:focus,
.carousel-control-next:focus {
    outline: 2px solid var(--white);
    outline-offset: 2px;
}

@media (min-width: 1200px) {
    .col-xl-custom-5 {
        flex: 0 0 20%;
        max-width: 20%;
        padding-right: 12px;
        padding-left: 12px;
    }
}
