/* ========================================
   Hero Banner Carousel Styles
   Supports: Dark/Light Mode & RTL/LTR
   ======================================== */

/* CSS Variables - Theme System */
:root {
    /* Light Mode Colors */
    --hero-bg-color: #5b9bd5;
    --hero-text-color: #ffffff;
    --hero-text-secondary: rgba(255, 255, 255, 0.7);
    --hero-accent-color: #00d9ff;
    --hero-btn-bg: #ffffff;
    --hero-btn-text: #5b9bd5;
    --hero-progress-bg: rgba(255, 255, 255, 0.2);
    --hero-progress-fill: #00d9ff;
    --hero-pill-bg: rgba(255, 255, 255, 0.1);
    --hero-pill-active: rgba(255, 255, 255, 0.3);
    --hero-pill-text: #ffffff;
    --hero-overlay: rgba(10, 10, 31, 0.3);
}

/* ========================================
   Hero Banner Container
   ======================================== */
.hero-banner {
    position: relative;
    width: 100%;
    height: calc(100vh - 56px); /* Subtract header height */
    min-height: 600px;
    overflow: hidden;
    background: #5b9bd5;
}

/* ========================================
   Hero Slide Backgrounds
   ======================================== */
.hero-slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-slide-bg-color {
    background: #5b9bd5;
}

.hero-slide-bg-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-slide-bg-night {
    background: linear-gradient(135deg, #0a0e1a 0%, #0d1b3e 40%, #122a5c 70%, #1a3a6e 100%);
}

.hero-slide-bg-light {
    background: linear-gradient(135deg, #dce8f8 0%, #c8ddf0 30%, #b8d0ea 60%, #d5e4f4 100%);
}

.hero-sky-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Glow blobs for sky backgrounds */
.hero-slide-bg .hero-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
}

.hero-slide-bg .hero-glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #5b9bd5, transparent 70%);
    top: -100px;
    right: -100px;
    animation: heroGlowDrift1 12s ease-in-out infinite alternate;
}

.hero-slide-bg .hero-glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #2ecc9b, transparent 70%);
    bottom: -80px;
    left: -80px;
    animation: heroGlowDrift2 15s ease-in-out infinite alternate;
}

.hero-slide-bg .hero-glow-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #a855f7, transparent 70%);
    top: 40%;
    left: 50%;
    opacity: 0.15;
    animation: heroGlowDrift3 10s ease-in-out infinite alternate;
}

.hero-slide-bg-light .hero-glow { opacity: 0.35; }
.hero-slide-bg-light .hero-glow-1 { background: radial-gradient(circle, #5b9bd5, transparent 70%); }
.hero-slide-bg-light .hero-glow-2 { background: radial-gradient(circle, #7ec8e3, transparent 70%); }
.hero-slide-bg-light .hero-glow-3 { background: radial-gradient(circle, #b8a9e8, transparent 70%); }

@keyframes heroGlowDrift1 { to { transform: translate(-40px, 30px); } }
@keyframes heroGlowDrift2 { to { transform: translate(30px, -20px); } }
@keyframes heroGlowDrift3 { to { transform: translate(-20px, -30px); } }

/* Light sky text overrides */
.hero-slide[data-bg-type="light_sky"] .hero-title {
    color: #0d1b3e;
}

.hero-slide[data-bg-type="light_sky"] .hero-description {
    color: #4a5568;
}

.hero-slide[data-bg-type="light_sky"] .btn-hero {
    background: #5b9bd5;
    color: #ffffff;
}

.hero-carousel {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ========================================
 Hero Slide
 ======================================== */
.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* ========================================
   Backdrop (Background Image)
   ======================================== */
.hero-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.backdrop-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    object-fit: cover;
    opacity: 0;
    transition: transform 0.3s ease-out;
}

/* Animate backdrop when slide becomes active */
.hero-slide.active .backdrop-image {
    animation: fadeInBackdrop 1.2s ease-out forwards,
        floatBackdrop 20s ease-in-out 1.2s infinite;
}

/* When slide is NOT active, hide backdrop */
.hero-slide:not(.active) .backdrop-image {
    opacity: 0 !important;
    animation: none !important;
}

/* Fade in animation for backdrop */
@keyframes fadeInBackdrop {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Float animation for backdrop */
@keyframes floatBackdrop {
    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-48%, -52%) scale(1.05);
    }
}

/* ========================================
   Hero Content
   ======================================== */
.hero-content {
    position: relative;
    z-index: 3;
    height: 100%;
    padding: 0 !important;
}

.hero-content .row {
    height: 100%;
    margin: 0;
}

.hero-text {
    z-index: 10;
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    opacity: 0;
    transform: translateY(30px);
}

.hero-visual {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    opacity: 0;
    transform: translateX(30px);
}

/* Animate ONLY when slide is active */
.hero-slide.active .hero-text {
    animation: fadeInUp 1s ease-out forwards;
}

.hero-slide.active .hero-visual {
    animation: fadeInRight 1s ease-out forwards;
}

/* When slide is NOT active, ensure elements are hidden */
.hero-slide:not(.active) .hero-text,
.hero-slide:not(.active) .hero-visual {
    opacity: 0 !important;
    animation: none !important;
}

/* RTL animation for visual */
[dir="rtl"] .hero-slide.active .hero-visual {
    animation: fadeInLeft 1s ease-out forwards;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--hero-text-color);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

/* Force typewriter text to be on its own line */
.hero-title tw {
    display: block;
    margin-top: 0.5rem;
    opacity: 0;
}

tw.tw-ready {
    opacity: 1;
}

.hero-description {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--hero-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
    max-width: 600px;
}

/* RTL Support for Text */
[dir="rtl"] .hero-title,
[dir="rtl"] .hero-description {
    text-align: right;
}

[dir="ltr"] .hero-title,
[dir="ltr"] .hero-description {
    text-align: left;
}

/* ========================================
 Typewriter Effect Component
 ======================================== */
.typewriter-text {
    display: inline-block;
    color: var(--hero-accent-color);
    position: relative;
}

.typewriter-text::after {
    content: "|";
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%,
    49% {
        opacity: 1;
    }
    50%,
    100% {
        opacity: 0;
    }
}

/* ========================================
   Hero Button with Holographic Effect
   ======================================== */
.btn-hero {
    position: relative;
    display: inline-block;
    padding: 14px 36px;
    background: var(--hero-btn-bg);
    color: var(--hero-btn-text);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.5s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 1;
}

/* Holographic shine effect */
.btn-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        0deg,
        transparent,
        transparent 30%,
        rgba(0, 217, 255, 0.4)
    );
    transform: rotate(-45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.btn-hero:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.5),
        0 6px 25px rgba(0, 217, 255, 0.3);
    color: var(--hero-btn-text);
}

.btn-hero:hover::before {
    opacity: 1;
    transform: rotate(-45deg) translateY(100%);
}

/* ========================================
 Hero Image/Visual
 ======================================== */

.hero-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.hero-image {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
}

/* Normal float animation - always running */
.hero-slide.active .hero-image:not(.flipped) {
    animation: float 6s ease-in-out infinite;
}

/* Float animation for flipped images - always running */
.hero-slide.active .hero-image.flipped {
    animation: floatFlipped 6s ease-in-out infinite;
}

/* Flip image horizontally */
.hero-image.flipped {
    transform: scaleX(-1);
}

/* Float animation - up and down */
@keyframes float {
    0%,
    100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Float animation for flipped images - maintains flip while floating */
@keyframes floatFlipped {
    0%,
    100% {
        transform: scaleX(-1) translateY(0px);
    }
    50% {
        transform: scaleX(-1) translateY(-20px);
    }
}

/* RTL Image positioning */
[dir="rtl"] .hero-image-wrapper {
    margin-right: 0;
    margin-left: auto;
}

/* ========================================
   Progress Bars Container
   ======================================== */
.hero-progress-container {
    position: absolute;
    bottom: 100px;
    left: 0;
    width: 100%;
    display: flex;
    gap: 10px;
    padding: 0 20px;
    z-index: 4;
}

.hero-progress {
    flex: 1;
    height: 4px;
    background: var(--hero-progress-bg);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--hero-progress-fill);
    border-radius: 2px;
    transition: none;
}

.progress-bar.animating {
    transition: width 10s linear !important;
    width: 100% !important;
}

/* ========================================
   Navigation Pills
   ======================================== */
.hero-navigation {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    z-index: 5;
    overflow: hidden;
    padding: 0;
}

.nav-pills {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 0 20px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 217, 255, 0.5) transparent;
    width: 100%;
}

/* Custom scrollbar styling */
.nav-pills::-webkit-scrollbar {
    height: 4px;
}

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

.nav-pills::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.5);
    border-radius: 2px;
}

.nav-pills::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.8);
}

.nav-pill {
    background: var(--hero-pill-bg);
    border: none;
    border-radius: 3px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
    white-space: nowrap;
    min-width: fit-content;
}

.nav-pill:hover {
    background: var(--hero-pill-active);
    transform: translateY(-2px);
}

.nav-pill.active {
    background: var(--hero-pill-active);
}

.pill-title {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hero-pill-text);
    margin-bottom: 2px;
}

.pill-description {
    display: none;
    font-size: 0.75rem;
    color: var(--hero-text-secondary);
}

/* Show descriptions on desktop */
@media (min-width: 768px) {
    .pill-description {
        display: block;
    }

    .nav-pill {
        padding: 15px 25px;
    }
}

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

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

/* RTL version of fadeInRight */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Apply different animation for RTL */
[dir="ltr"] .hero-visual {
    animation: fadeInRight 1s ease-out;
}

[dir="rtl"] .hero-visual {
    animation: fadeInLeft 1s ease-out;
}

/* ========================================
   Responsive Design
   ======================================== */

/* Ensure text always stays above image on overlap */
@media (max-width: 1199px) {
    .hero-text {
        margin-bottom: 2rem;
    }
}

/* Tablet */
@media (max-width: 991px) {
    .hero-banner {
        height: 100vh; /* Full height on mobile */
    }

    .hero-content .row {
        flex-direction: column;
    }

    .hero-text,
    .hero-visual {
        text-align: center;
        justify-content: center;
    }

    .hero-text {
        order: 1;
        padding-bottom: 2rem;
    }

    .hero-visual {
        order: 2;
    }

    .hero-title {
        font-size: clamp(2rem, 4vw, 3rem);
    }

    .hero-description {
        margin-left: auto;
        margin-right: auto;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .hero-banner {
        height: 100vh;
        min-height: 500px;
    }

    .hero-title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        margin-bottom: 1rem;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .btn-hero {
        padding: 12px 28px;
        font-size: 0.875rem;
    }

    .hero-image-wrapper {
        max-width: 400px;
    }

    /* Hide progress bars on mobile */
    .hero-progress-container {
        display: none;
    }

    /* Show navigation pills prominently on mobile */
    .hero-navigation {
        bottom: 10px;
    }

    .nav-pills {
        gap: 10px;
    }

    .nav-pill {
        padding: 10px 16px;
    }

    .pill-title {
        font-size: 0.75rem;
    }
}

/* Very small mobile */
@media (max-width: 375px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .nav-pill {
        padding: 8px 12px;
        font-size: 0.7rem;
    }
}

/* ========================================
 Accessibility
 ======================================== */
.hero-slide:focus,
.nav-pill:focus {
    outline: 2px solid var(--hero-accent-color);
    outline-offset: 2px;
}

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

/* ========================================
 Print Styles
 ======================================== */
@media print {
    .hero-banner {
        height: auto;
        page-break-inside: avoid;
    }

    .hero-navigation,
    .hero-progress {
        display: none;
    }
}
