/* =============================================
   MTs Persis Cisomang - Custom Animations
   ============================================= */

/* Preloader Styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0F3D2E 0%, #1a5c48 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loader img {
    filter: drop-shadow(0 0 20px rgba(244, 196, 48, 0.3));
}

.loader-text {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    animation: fadeInOut 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 196, 48, 0.4);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 20px rgba(244, 196, 48, 0);
    }
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Global Mobile Fix - Prevent Horizontal Scroll */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

html {
    scroll-behavior: smooth;
}

body {
    position: relative;
}

/* Fix for all sections */
section,
header,
footer,
nav,
div {
    max-width: 100%;
}

/* Hero Slider Mobile Fix */
#hero-slider {
    overflow: hidden;
}

.hero-slide {
    overflow: hidden;
}

/* Marquee Container Mobile Fix */
.marquee-container {
    max-width: 100vw;
}

/* Button Hover Effects */
.btn-animate {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-animate:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(31, 173, 121, 0.4);
}

.btn-animate:active {
    transform: translateY(-1px);
}

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Card Hover Effects */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* Image Zoom on Hover */
.img-zoom {
    overflow: hidden;
}

.img-zoom img,
.img-zoom .bg-cover {
    transition: transform 0.5s ease;
}

.img-zoom:hover img,
.img-zoom:hover .bg-cover {
    transform: scale(1.1);
}

/* Link Hover Underline Animation */
.link-animate {
    position: relative;
}

.link-animate::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #1fad79;
    transition: width 0.3s ease;
}

.link-animate:hover::after {
    width: 100%;
}

/* Icon Float Animation */
.icon-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Counter Animation (will be controlled by JS) */
.counter {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.counter.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Section Divider Wave */
.wave-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.wave-divider svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
}

/* Mobile Menu Animation */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: #0F3D2E;
    z-index: 100;
    transition: right 0.3s ease;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Form Input Focus Animation */
.input-animate {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-animate:focus {
    border-color: #1fad79;
    box-shadow: 0 0 0 4px rgba(31, 173, 121, 0.15);
}

/* Parallax Effect */
.parallax-bg {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

@media (max-width: 768px) {
    .parallax-bg {
        background-attachment: scroll;
    }
}

/* Fade In Up Animation */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Animation for Children */
.stagger-children>* {
    opacity: 0;
    transform: translateY(20px);
}

.stagger-children.visible>*:nth-child(1) {
    animation: staggerIn 0.5s ease 0.1s forwards;
}

.stagger-children.visible>*:nth-child(2) {
    animation: staggerIn 0.5s ease 0.2s forwards;
}

.stagger-children.visible>*:nth-child(3) {
    animation: staggerIn 0.5s ease 0.3s forwards;
}

.stagger-children.visible>*:nth-child(4) {
    animation: staggerIn 0.5s ease 0.4s forwards;
}

.stagger-children.visible>*:nth-child(5) {
    animation: staggerIn 0.5s ease 0.5s forwards;
}

.stagger-children.visible>*:nth-child(6) {
    animation: staggerIn 0.5s ease 0.6s forwards;
}

@keyframes staggerIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glow Effect */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 10px rgba(31, 173, 121, 0.3);
    }

    to {
        box-shadow: 0 0 20px rgba(31, 173, 121, 0.6), 0 0 40px rgba(31, 173, 121, 0.3);
    }
}

/* Typing Cursor */
.typing-cursor::after {
    content: '|';
    animation: blink 0.7s infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #1fad79, #F4C430);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Navigation Active State */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link.active {
    color: #F4C430;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #F4C430;
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.lightbox-close:hover {
    transform: rotate(90deg);
}

/* Shake Animation (for form validation) */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-10px);
    }

    40%,
    80% {
        transform: translateX(10px);
    }
}

/* Text Gradient Animation */
.text-gradient-animate {
    background: linear-gradient(90deg, #1fad79, #F4C430, #1fad79);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% center;
    }

    50% {
        background-position: 100% center;
    }

    100% {
        background-position: 0% center;
    }
}

/* Infinite Scroll / Marquee Animation */
.marquee-container {
    overflow: hidden;
    width: 100%;
    position: relative;
}

.marquee-container::before,
.marquee-container::after {
    content: '';
    position: absolute;
    top: 0;
    width: 100px;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.marquee-container::before {
    left: 0;
    background: linear-gradient(to right, white, transparent);
}

.marquee-container::after {
    right: 0;
    background: linear-gradient(to left, white, transparent);
}

.marquee-track {
    display: flex;
    gap: 2rem;
    animation: marquee 15s linear infinite;
    width: max-content;
}

/* Specific fix for guru marquee track - override any max-width constraints */
#guru-marquee-track,
#prestasi-marquee-track {
    width: max-content !important;
    max-width: none !important;
    flex-shrink: 0;
}

.marquee-track:hover {
    animation-play-state: paused;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-33.33%);
    }
}

.teacher-card {
    flex-shrink: 0;
    width: 180px;
    text-align: center;
    transition: transform 0.3s ease;
}

.teacher-card:hover {
    transform: scale(1.05);
}

.teacher-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 0.75rem;
    border: 3px solid #1fad79;
    box-shadow: 0 8px 20px rgba(31, 173, 121, 0.2);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.teacher-card:hover img {
    border-color: #F4C430;
    box-shadow: 0 12px 30px rgba(244, 196, 48, 0.3);
}

/* Prestasi Achievement Cards - Style handled in prestasi.html */

/* =============================================
   Mobile Responsive Fixes
   ============================================= */

/* Preloader Center Fix */
#preloader {
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.loader {
    max-width: 90vw;
    text-align: center;
}

.loader-text {
    word-wrap: break-word;
    max-width: 90vw;
}

/* Hero Section Mobile Fix */
@media (max-width: 768px) {
    #hero-slider {
        min-height: 100vh;
        height: auto;
    }

    .hero-slide {
        min-height: 100vh;
        height: auto;
        padding-top: 80px;
        padding-bottom: 60px;
    }

    .hero-slide>div:first-child {
        min-height: 100vh;
    }

    .hero-slide>div:first-child img {
        object-position: center top;
    }

    .hero-slide h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .hero-slide p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .hero-slide .max-w-2xl {
        padding: 0 0.5rem;
    }

    .hero-slide .flex.flex-wrap.gap-4 {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-slide .flex.flex-wrap.gap-4 a {
        width: 100%;
        text-align: center;
    }

    #hero-prev,
    #hero-next {
        width: 36px;
        height: 36px;
    }

    #hero-prev {
        left: 8px;
    }

    #hero-next {
        right: 8px;
    }

    .hero-dot {
        width: 8px;
        height: 8px;
    }
}

/* Profil Section Mobile Fix */
@media (max-width: 768px) {
    .img-zoom img {
        width: 100%;
        max-width: 100%;
    }

    section h1,
    section h2,
    section h3 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    section p {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Fix elements that might cause horizontal overflow */
img {
    max-width: 100%;
    height: auto;
}

/* Footer Mobile Fix */
@media (max-width: 768px) {
    footer .grid {
        gap: 2rem;
    }

    footer span {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Contact Section Mobile Fix */
@media (max-width: 768px) {
    #kontak .bg-white {
        padding: 1.5rem;
    }

    #kontak p {
        word-wrap: break-word;
        line-break: anywhere;
    }
}

/* General Text Overflow Prevention */
* {
    box-sizing: border-box;
}

p,
span,
h1,
h2,
h3,
h4,
h5,
h6,
li,
a {
    max-width: 100%;
}

/* Fix for decorative elements that might overflow */
.absolute {
    max-width: 100vw;
}