/* Mobile-First Responsive Fixes for PUPR Website */

/* ===== GLOBAL NAVBAR STYLES ===== */
.navbar-store,
.navbar-fixed-top {
    background-color: transparent !important;
    backdrop-filter: blur(5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid transparent;
    z-index: 1060 !important;
}

.navbar-collapse {
    position: relative;
    z-index: 1061 !important;
    background-color: transparent;
}

/* Scrolled State */
.navbar.navbar-store.scrolled,
.navbar.navbar-fixed-top.scrolled,
nav.navbar-store.scrolled,
nav.navbar-fixed-top.scrolled {
    background-color: #212e60 !important;
    border-bottom-left-radius: 50px !important;
    border-bottom-right-radius: 50px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(33, 46, 96, 0.15);
}

/* ===== GLOBAL MOBILE IMPROVEMENTS ===== */
* {
    box-sizing: border-box;
}

body {
    font-size: 14px; /* Better mobile readability */
    line-height: 1.6;
}

/* ===== CONTAINER AND LAYOUT FIXES ===== */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* ===== HERO SECTION MOBILE ===== */
@media (max-width: 768px) {
    .hero-section {
        height: auto !important;
        min-height: 400px;
        padding: 60px 0 40px 0;
    }

    .hero-content h1 {
        font-size: 1.8rem !important;
        line-height: 1.3;
        margin-bottom: 1rem;
    }

    .hero-content p {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .hero-image img {
        max-height: 300px !important;
        object-fit: cover;
        width: 100%;
    }
}

/* ===== NAVBAR MOBILE IMPROVEMENTS - OPTIMIZED ===== */
@media (max-width: 767.98px) {
    .navbar-brand .navbar-logo {
        height: 35px !important;
        width: auto !important;
        transition: height 0.2s ease;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        color: #ffffff !important;
        transition: all 0.2s ease;
        border-radius: 4px;
        margin: 2px 0;
    }

    .navbar-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
        transform: translateX(5px);
    }

    /* OPTIMIZED HAMBURGER BUTTON */
    .navbar-toggler {
        padding: 0.35rem 0.6rem !important;
        font-size: 1.1rem !important;
        border: 2px solid rgba(255, 255, 255, 0.5) !important;
        border-radius: 6px !important;
        z-index: 1062 !important;
        transition: all 0.3s ease !important;
        background-color: transparent !important;
        position: relative !important;
    }

    .navbar-toggler:hover {
        border-color: rgba(255, 255, 255, 0.8) !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        transform: scale(1.05);
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.3) !important;
        outline: none !important;
    }

    .navbar-toggler:not(.collapsed) {
        border-color: rgba(255, 255, 255, 1) !important;
        background-color: rgba(255, 255, 255, 0.15) !important;
    }

    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
        transition: opacity 0.2s ease !important; /* Changed from transform to prevent conflicts */
    }

    /* Simplified hover effect - no rotation conflicts */
    .navbar-toggler:not(.collapsed) .navbar-toggler-icon {
        opacity: 0.8;
    }

    /* OPTIMIZED COLLAPSED NAVBAR - Better Performance */
    .navbar .navbar-collapse,
    .navbar-store .navbar-collapse,
    .navbar-fixed-top .navbar-collapse {
        background: linear-gradient(
            135deg,
            #212e60 0%,
            #1a2454 100%
        ) !important;
        margin: 0 -15px !important;
        padding: 1.2rem 15px !important;
        border-radius: 0 0 20px 20px !important;
        margin-top: 12px !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
        z-index: 1061 !important;
        position: relative !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(10px) !important;
    }

    /* OPTIMIZED ANIMATIONS - Bootstrap Compatible */
    .navbar-collapse.collapsing {
        transition: height 0.25s ease-in-out !important;
    }

    /* OPTIMIZED DROPDOWN - Lightweight */
    .navbar .dropdown-menu,
    .navbar-collapse .dropdown-menu {
        background: rgba(255, 255, 255, 0.12) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 8px !important;
        margin-top: 8px !important;
        backdrop-filter: blur(5px) !important;
        transition: opacity 0.15s ease !important; /* Simplified animation */
    }

    .navbar .dropdown-item,
    .navbar-collapse .dropdown-item {
        color: #ffffff !important;
        padding: 0.6rem 1.5rem !important;
        font-size: 0.85rem !important;
        border-radius: 4px !important;
        margin: 2px 4px !important;
        transition: all 0.2s ease !important;
    }

    .navbar .dropdown-item:hover,
    .navbar .dropdown-item:focus,
    .navbar-collapse .dropdown-item:hover,
    .navbar-collapse .dropdown-item:focus {
        background: rgba(255, 255, 255, 0.25) !important;
        color: #ffffff !important;
        /* Removed transform to prevent conflicts - keeping simple background change */
    }

    /* PERFORMANCE OPTIMIZATIONS */
    .navbar-nav,
    .navbar-collapse {
        will-change: transform;
        backface-visibility: hidden;
    }
}

/* Mobile navbar fixes for very small screens */
@media (max-width: 576px) {
    .navbar-brand .navbar-logo {
        height: 30px !important;
    }

    .navbar-nav .nav-link {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }

    .dropdown-item {
        font-size: 0.8rem;
        padding: 0.4rem 1.2rem;
    }
}

/* ===== CARDS AND CONTENT MOBILE ===== */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1.5rem;
    }

    .card-img-top {
        height: 180px; /* Consistent card image height */
        object-fit: cover;
    }

    .card-title {
        font-size: 1rem;
        line-height: 1.3;
    }

    .card-text {
        font-size: 0.85rem;
        display: -webkit-box;
        -webkit-line-clamp: 3; /* Limit text lines */
        line-clamp: 3; /* Standard property for compatibility */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}

/* ===== CAROUSEL MOBILE FIXES ===== */
@media (max-width: 768px) {
    .carousel-item {
        padding: 0 10px;
    }

    .carousel-inner {
        border-radius: 10px;
        overflow: hidden;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 8%; /* Smaller controls on mobile */
    }

    .carousel-indicators {
        bottom: -30px; /* Move indicators below carousel */
    }

    .carousel-indicators [data-bs-target] {
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }
}

/* ===== PROFILE SECTION MOBILE ===== */
@media (max-width: 768px) {
    .profil-title {
        font-size: 1.5rem !important;
        margin-bottom: 1rem;
    }

    .col-md-6 {
        margin-bottom: 2rem;
    }

    .col-md-6:last-child {
        margin-bottom: 0;
    }

    /* Stack profile content vertically */
    .profile-section .row {
        flex-direction: column;
    }
}

/* ===== MODAL MOBILE IMPROVEMENTS ===== */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-content {
        border-radius: 10px;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    #modalImage {
        max-height: 250px !important;
        width: 100%;
        object-fit: contain;
    }
}

/* ===== ANNOUNCEMENT BANNER MOBILE ===== */
@media (max-width: 768px) {
    .announcement-banner {
        top: 56px !important; /* Adjust for mobile navbar height */
        padding: 8px 0;
        font-size: 0.8rem;
    }

    .announcement-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 0 15px;
    }

    .announcement-text {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}

/* ===== INFO BANNER MOBILE ===== */
@media (max-width: 768px) {
    .info-banner {
        max-width: 95% !important;
        min-width: 280px;
        padding: 15px 20px;
        font-size: 0.85rem;
        margin: 0 10px;
    }

    .banner-close-btn {
        top: 8px;
        right: 15px;
        font-size: 20px;
    }
}

/* ===== TABLE MOBILE IMPROVEMENTS ===== */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }

    .custom-table {
        font-size: 0.8rem;
    }

    .custom-table th,
    .custom-table td {
        padding: 0.5rem 0.25rem;
        vertical-align: middle;
    }

    /* Make table scrollable horizontally */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== MODERN FOOTER - MOBILE FIRST DESIGN ===== */

/* Base Footer Styles */
.footer-modern {
    background: linear-gradient(135deg, #212e60 0%, #1a2454 100%);
    color: #ffffff;
    border-top-left-radius: 50px;
    border-top-right-radius: 50px;
    margin: 80px 20px 0;
    position: relative;
    overflow: hidden;
}

.footer-modern::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
}

.footer-content {
    padding: 3rem 0 1rem;
}

/* Mobile-First Grid Layout */
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    text-align: center;
}

/* Typography Scale */
.footer-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.footer-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.social-title {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

/* Contact Information Styles */
.footer-contact {
    margin-bottom: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.contact-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.contact-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    color: #64b5f6;
    min-width: 20px;
    flex-shrink: 0;
}

.contact-text,
.contact-link {
    color: #e3f2fd;
    font-size: 0.9rem;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-link:hover,
.contact-link:focus {
    color: #ffffff;
    text-decoration: underline;
}

/* Social Media Links - Touch Optimized */
.footer-social {
    margin-bottom: 1.5rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.3rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.social-link:hover,
.social-link:focus {
    background: rgba(100, 181, 246, 0.2);
    border-color: #64b5f6;
    color: #ffffff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(100, 181, 246, 0.3);
}

.social-link:active {
    transform: translateY(0) scale(1);
}

/* Footer Navigation */
.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    color: #e3f2fd;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    line-height: 1.4;
}

.footer-link:hover,
.footer-link:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(4px);
}

.footer-link-icon {
    margin-right: 0.5rem;
    font-size: 1rem;
    color: #64b5f6;
    flex-shrink: 0;
}

/* Copyright Section */
.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
    text-align: center;
}

.copyright-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.copyright-text {
    margin: 0;
    font-size: 0.85rem;
    color: #b0bec5;
    line-height: 1.4;
}

.copyright-icon {
    margin-right: 0.25rem;
    font-size: 0.8rem;
}

.copyright-link {
    color: #64b5f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.copyright-link:hover,
.copyright-link:focus {
    color: #90caf9;
    text-decoration: underline;
}

/* Heart animation styles removed - element no longer exists */

/* Tablet Styles */
@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: 2fr 1fr;
        gap: 3rem;
        text-align: left;
    }

    .footer-main {
        grid-row: 1 / 3;
    }

    .contact-item,
    .footer-link {
        justify-content: flex-start;
    }

    .social-links {
        justify-content: flex-start;
    }

    .copyright-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* Desktop Styles */
@media (min-width: 992px) {
    .footer-content {
        padding: 4rem 0 2rem;
    }

    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: 2rem;
    }

    .footer-main {
        grid-row: auto;
    }

    .footer-title {
        font-size: 1.75rem;
    }

    .social-link {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .footer-grid {
        max-width: 1140px;
        margin: 0 auto;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .footer-modern {
        border-top-left-radius: 60px;
        border-top-right-radius: 60px;
    }
}

/* Performance Optimizations */
.footer-modern * {
    will-change: auto;
}

.social-link,
.footer-link {
    will-change: transform;
    backface-visibility: hidden;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .social-link,
    .footer-link,
    .contact-item {
        transition: none;
    }

    /* Heart animation removed */
}

/* Focus Styles for Keyboard Navigation */
.social-link:focus,
.footer-link:focus,
.contact-link:focus,
.copyright-link:focus {
    outline: 2px solid #64b5f6;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .footer-modern {
        background: none !important;
        color: #000 !important;
        border-radius: 0 !important;
        margin: 20px 0 !important;
    }

    .social-links {
        display: none;
    }
}

/* ===== BACK TO TOP BUTTON MOBILE ===== */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
}

/* ===== GALLERY SECTION MOBILE ===== */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: 1fr 1fr; /* 2 columns on mobile */
        gap: 10px;
    }

    .gallery-item img {
        height: 120px;
        object-fit: cover;
        border-radius: 8px;
    }
}

/* ===== BERITA/NEWS SECTION MOBILE ===== */
@media (max-width: 768px) {
    .news-section .row {
        margin: 0 -8px;
    }

    .news-section .col-md-4 {
        padding: 0 8px;
        margin-bottom: 1rem;
    }

    .news-card {
        height: auto;
        min-height: 300px;
    }

    .news-card .card-img-top {
        height: 140px;
    }

    .news-card .card-body {
        padding: 1rem 0.75rem;
    }
}

/* ===== TOUCH IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Increase touch target size for better usability */
    .btn,
    .nav-link,
    .carousel-control-prev,
    .carousel-control-next,
    .close,
    .btn-close {
        min-height: 44px; /* Apple's recommended touch target size */
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Prevent zoom on input focus */
    input,
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    /* Better spacing for mobile */
    .section-spacing {
        padding: 2rem 0;
    }

    .mb-4 {
        margin-bottom: 2rem !important;
    }

    .mt-4 {
        margin-top: 2rem !important;
    }
}

/* ===== LANDSCAPE MOBILE ADJUSTMENTS ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: 300px;
        padding: 40px 0 20px 0;
    }

    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ===== SMALL MOBILE (< 480px) ===== */
@media (max-width: 479px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .hero-content h1 {
        font-size: 1.5rem !important;
    }

    .card-img-top {
        height: 160px;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr; /* 1 column on very small screens */
    }

    .profil-title {
        font-size: 1.3rem !important;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Focus states for keyboard navigation */
    .btn:focus,
    .nav-link:focus,
    .card:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }

    /* Skip to content link for screen readers */
    .skip-link {
        position: absolute;
        top: -40px;
        left: 6px;
        background: #000;
        color: #fff;
        padding: 8px;
        text-decoration: none;
        z-index: 9999;
    }

    .skip-link:focus {
        top: 6px;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    /* Optimize animations for mobile */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }

    /* Reduce motion for users who prefer it */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}
