/* ============================================
   HOMEPAGE FIXES - Complete Responsive Overhaul
   Fix all alignment, spacing, and animation issues
   ============================================ */

/* ============================================
   1. HIDE ORANGE DIVIDER ON DESKTOP (non-mobile)
   The orange triangle under headings
   Only show on mobile devices
   ============================================ */

/* Hide heading decorations on desktop - PPID section */
@media (min-width: 769px) {
    section#ppid .heading::before,
    section#ppid .heading::after,
    section.ppid .heading::before,
    section.ppid .heading::after,
    #ppid h3.feature-heading::before,
    #ppid h3.feature-heading::after {
        display: none !important;
        content: none !important;
        visibility: hidden !important;
    }
}

/* ============================================
   2. BANNER TO SECTION SPACING - Mobile
   Reduce gap between banner and next section
   ============================================ */

/* Mobile - reduce spacing after banner */
@media (max-width: 768px) {
    #home {
        margin-bottom: 0 !important;
    }
    
    /* First section after banner */
    #home + section,
    section#ppid {
        padding-top: 1.5rem !important;
        margin-top: 0 !important;
    }
    
    /* General section spacing on mobile */
    .section {
        padding: 2rem 0 !important;
    }
    
    /* Reduce padding for PPID section specifically */
    section.ppid {
        padding-top: 1rem !important;
    }
}

/* Desktop - normal spacing */
@media (min-width: 769px) {
    section#ppid,
    section.ppid {
        padding-top: 4rem;
    }
}

/* ============================================
   3. PIMPINAN PPID - Mobile Centering
   Center the team cards properly on mobile
   ============================================ */

@media (max-width: 768px) {
    /* Team section container - force center */
    section.team,
    .section.team {
        padding: 2rem 0 !important;
    }
    
    section.team .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    /* Center the row - FORCE */
    section.team .row,
    section.team .row.gy-4,
    section.team .row.gy-4.justify-content-center {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 350px !important;
    }
    
    /* Center each column - FORCE */
    section.team .row > div[class*="col-"],
    section.team .row.gy-4 > div[class*="col-"],
    section.team .row.gy-4.justify-content-center > div[class*="col-"] {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 auto 1.5rem auto !important;
        flex: 0 0 100% !important;
    }
    
    /* Team card styling - FORCE CENTER */
    section.team .team-card,
    .team-card {
        margin: 0 auto !important;
        max-width: 300px !important;
        width: 100% !important;
        display: block !important;
        float: none !important;
    }
    
    section.team .team-card-img,
    .team-card-img {
        display: block !important;
        width: 100% !important;
        margin: 0 auto !important;
        text-align: center !important;
    }
    
    section.team .team-card-img img,
    .team-card-img img {
        width: 100% !important;
        height: auto !important;
        object-fit: cover !important;
        display: block !important;
        margin: 0 auto !important;
    }
    
    section.team .team-card-text-2,
    .team-card-text-2 {
        text-align: center !important;
        padding: 1rem !important;
    }
    
    /* Heading center */
    section.team .heading {
        text-align: center !important;
    }
    
    /* Button center */
    section.team .text-center {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
}

/* ============================================
   4. BANNER CAROUSEL - Smooth Animation Fix
   Prevent content shift during transitions
   ============================================ */

/* Banner section - prevent any overflow */
#home {
    width: 100% !important;
    max-width: 100vw !important;
    overflow: hidden !important;
    position: relative !important;
}

/* Carousel container */
#ppidCarousel {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    position: relative !important;
}

.carousel-inner {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    position: relative !important;
}

/* Carousel item - prevent shift */
.carousel-item {
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    transform-style: flat !important;
    -webkit-transform-style: flat !important;
}

/* FADE CAROUSEL - Smooth transition without slide */
.carousel-fade .carousel-item {
    opacity: 0;
    transition: opacity 0.8s ease-in-out !important;
    -webkit-transition: opacity 0.8s ease-in-out !important;
    transform: none !important;
    -webkit-transform: none !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
}

.carousel-fade .carousel-item.active {
    opacity: 1;
    position: relative !important;
    z-index: 1;
}

.carousel-fade .carousel-item-next,
.carousel-fade .carousel-item-prev {
    transform: none !important;
    -webkit-transform: none !important;
}

.carousel-fade .carousel-item-next.carousel-item-start,
.carousel-fade .carousel-item-prev.carousel-item-end {
    opacity: 1;
    transform: none !important;
}

.carousel-fade .active.carousel-item-start,
.carousel-fade .active.carousel-item-end {
    opacity: 0;
    transform: none !important;
}

/* Carousel image - prevent shift */
.carousel-image {
    width: 100% !important;
    height: auto !important;
    max-height: 600px;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

/* Carousel controls */
.carousel-control-prev,
.carousel-control-next {
    z-index: 10 !important;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

/* Carousel indicators */
.carousel-indicators {
    z-index: 10 !important;
}

/* ============================================
   5. FAQ TEXT JUSTIFY
   ============================================ */

/* FAQ in Beranda */
.faq-section .faq-answer p,
.faq-section .faq-answer,
.faq-accordion .faq-answer p,
.faq-accordion .faq-answer {
    text-align: justify !important;
    text-justify: inter-word !important;
    line-height: 1.7;
}

/* FAQ in Daftar Informasi */
.faq-answer-complete p,
.faq-answer-complete,
.faq-item-complete .faq-answer-complete p,
.faq-item-complete .faq-answer-complete {
    text-align: justify !important;
    text-justify: inter-word !important;
    line-height: 1.7;
}

/* General accordion body */
.accordion-body p,
.accordion-body {
    text-align: justify !important;
    text-justify: inter-word !important;
    line-height: 1.7;
}

/* ============================================
   6. GENERAL MOBILE RESPONSIVENESS
   ============================================ */

@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden !important;
    }
    
    html {
        overflow-x: hidden !important;
    }
    
    /* Fix sections */
    section,
    .section {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* Container padding */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    /* Fix headings */
    .heading {
        font-size: 1.5rem !important;
    }
    
    h1 { font-size: 1.75rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }
    
    /* Fix cards */
    .card,
    .ppid-feature-card,
    .news-card {
        margin-bottom: 1rem !important;
    }
    
    /* Fix grid */
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .row > [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    .heading {
        font-size: 1.25rem !important;
    }
    
    .team-card {
        max-width: 280px !important;
    }
}

/* ============================================
   7. IMAGES - Prevent Overflow
   ============================================ */

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

/* ============================================
   8. FEATURE HEADING MOBILE FIX
   ============================================ */

/* ============================================
   HIDE ORANGE OVAL ON DESKTOP/TABLET/LAPTOP
   Only show on mobile devices
   ============================================ */

/* Hide oval decoration on desktop, tablet, and laptop (min-width: 768px) */
@media (min-width: 768px) {
    .feature-heading .first-letter::before,
    .feature-heading .first-letter-styled::before,
    .feature .feature-heading .first-letter::before,
    .feature .feature-heading .first-letter-styled::before,
    .ppid .feature-heading .first-letter::before,
    .ppid .feature-heading .first-letter-styled::before,
    section.ppid .feature-heading .first-letter::before,
    section.ppid .feature-heading .first-letter-styled::before,
    h3.feature-heading .first-letter::before,
    h3.feature-heading .first-letter-styled::before {
        display: none !important;
        content: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* First letter styled - same size as rest (all screen sizes) */
.feature-heading .first-letter-styled,
.ppid .feature-heading .first-letter-styled,
section.ppid .feature-heading .first-letter-styled,
h3.feature-heading .first-letter-styled {
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
}

@media (max-width: 768px) {
    .feature-heading {
        font-size: 1.25rem !important;
    }
    
    /* First letter same size as other letters on mobile */
    .feature-heading .first-letter,
    .feature-heading .first-letter.mobile-style {
        font-size: inherit !important;
        font-weight: inherit !important;
        line-height: inherit !important;
    }
    
    /* Hide oval decoration on mobile */
    .feature-heading .first-letter::before,
    .feature-heading .first-letter.mobile-style::before {
        display: none !important;
        content: none !important;
    }
    
    /* Hide desktop style on mobile */
    .feature-heading .first-letter.desktop-style {
        display: inline !important;
    }
    
    /* First letter styled - same size */
    .feature-heading .first-letter-styled {
        font-size: inherit !important;
    }
}

/* ============================================
   9. TEAM/PIMPINAN SECTION - FIX SOCIAL LINKS
   ============================================ */

/* Force card image container to be relative for icon positioning */
.team .team-card .team-card-img {
    position: relative !important;
    overflow: visible !important;
}

/* Force social icons container visibility and positioning */
.team .team-card .team-card-img .team-social-icons {
    position: absolute !important;
    left: 30px;
    bottom: 0;
    z-index: 100;
    display: block !important;
    visibility: visible !important;
}

.team .team-card .team-card-img .team-social-icons ul {
    display: flex !important;
    margin: 0;
    padding: 0;
    list-style: none;
}

.team .team-card .team-card-img .team-social-icons ul li {
    display: inline-block !important;
    transition: 0.5s ease-in-out;
    transform: rotateX(90deg);
    transform-origin: bottom;
    opacity: 0;
}

.team .team-card:hover .team-card-img .team-social-icons ul li {
    transform: rotateX(0deg) !important;
    opacity: 1 !important;
}

.team .team-card:hover .team-card-img .team-social-icons ul li:nth-child(1) {
    transition-delay: 0s;
}

.team .team-card:hover .team-card-img .team-social-icons ul li:nth-child(2) {
    transition-delay: 0.1s;
}

.team .team-card:hover .team-card-img .team-social-icons ul li:nth-child(3) {
    transition-delay: 0.2s;
}

/* ============================================
   10. STATISTIK PPID - PARALLAX EFFECT (same as CTA/Maklumat)
   ============================================ */

/* Parallax effect is now handled in statistik-ppid.css with fixed background */
/* Only disable on mobile for performance */
@media (max-width: 768px) {
    .statistik-ppid {
        background-attachment: scroll !important;
    }
}

/* ============================================
   11. CONTACT SECTION RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .contact .row {
        flex-direction: column;
    }
    
    .contact .col-lg-6 {
        width: 100%;
    }
    
    .contact-info-card,
    .contact-form-card {
        margin-bottom: 1.5rem;
    }
}

/* ============================================
   12. FAQ SECTION RESPONSIVE
   ============================================ */

.faq-section .faq-accordion {
    max-width: 100%;
}

.faq-section .faq-item {
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.faq-section .faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
}

.faq-section .faq-question:hover {
    background: #fff8f0;
}

.faq-section .faq-item.active .faq-question {
    background: linear-gradient(135deg, #ff9000, #ff7b00);
    color: #fff;
}

.faq-section .faq-question span {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    flex: 1;
    padding-right: 1rem;
}

.faq-section .faq-item.active .faq-question span {
    color: #fff;
}

.faq-section .faq-question i {
    font-size: 1.4rem;
    color: #ff9000;
    transition: transform 0.3s ease;
}

.faq-section .faq-item.active .faq-question i {
    transform: rotate(180deg);
    color: #fff;
}

.faq-section .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-section .faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-section .faq-answer p {
    padding: 1.25rem 1.5rem;
    color: #6b7280;
    line-height: 1.8;
    margin: 0;
    background: #fafafa;
}

@media (max-width: 768px) {
    .faq-section .faq-question {
        padding: 1rem 1.25rem;
    }
    
    .faq-section .faq-question span {
        font-size: 0.95rem;
    }
    
    .faq-section .faq-answer p {
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
    }
    
    /* Fix scroll issue on mobile - prevent internal scrolling */
    .faq-section,
    .faq-section .container,
    .faq-section .row,
    .faq-accordion,
    .faq-item {
        overflow: visible !important;
        -webkit-overflow-scrolling: auto !important;
        touch-action: pan-y !important;
    }
}

/* ============================================
   13. SURAT EDARAN CAROUSEL RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .surat-carousel-3d-wrapper {
        padding: 0 10px;
    }
    
    .surat-carousel-nav {
        width: 36px;
        height: 36px;
    }
    
    .surat-carousel-item {
        min-width: 280px;
    }
    
    .surat-preview-card {
        padding: 1rem;
    }
}

/* ============================================
   14. FOTO KEGIATAN GALLERY RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .foto-gallery-container {
        padding: 1rem;
    }
    
    .foto-gallery-item {
        border-radius: 12px;
    }
    
    .foto-gallery-info {
        padding: 1rem;
    }
    
    .foto-gallery-title {
        font-size: 1.1rem;
    }
}

/* ============================================
   15. NEWS SECTION RESPONSIVE
   ============================================ */

@media (max-width: 991px) {
    .news-container {
        flex-direction: column;
    }
    
    .main-news,
    .news-sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    .news-sidebar {
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    .main-news-title {
        font-size: 1.25rem;
    }
    
    .main-news-excerpt {
        font-size: 0.9rem;
    }
    
    .news-item {
        padding: 0.75rem;
    }
    
    .news-item-title {
        font-size: 0.9rem;
    }
}

/* ============================================
   16. AGENDA KAMPUS RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .agenda-item {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .agenda-date {
        margin-bottom: 1rem;
    }
    
    .agenda-content {
        margin-bottom: 1rem;
    }
    
    .agenda-action {
        width: 100%;
    }
}
