/**
 * BDP Responsive Fixes
 * Mobile-first responsive design fixes for BDP theme
 */

/* Base responsive styles */
html, body {
    width: 100%;
    overflow-x: hidden;
}

/* Mobile breakpoint: <= 767px */
@media (max-width: 767px) {
    /* Mobile Header Sticky */
    .menu.titles.small {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background-color: #6d5fa3;
        width: 100%;
        height: 140px;
        border-radius: 20px;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        display: block !important;
        padding: 0;
        margin: 0;
        transition: height 0.3s ease, border-radius 0.3s ease, box-shadow 0.3s ease;
    }
    
    /* Compact mobile header */
    .menu.titles.small.sticky.compact {
        height: 70px !important;
        border-radius: 0 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    }
    
    /* Hide desktop nav on mobile */
    nav.main.big {
        display: none;
    }
    
    /* Adjust body padding for sticky header */
    body {
        padding-top: 150px;
        transition: padding-top 0.3s ease;
    }
    
    /* Adjust body padding for compact header */
    body.compact-header {
        padding-top: 80px;
    }
    
    /* Mobile header text styling */
    .menu.titles.small .lightblue {
        color: #6ffff0;
        padding-top: 15px;
        padding-left: 30px;
        font-weight: bold;
        font-size: 1.6rem;
        font-family: Calibri;
    }
    
    .menu.titles.small .orange {
        color: #ffb922;
        padding: 5px 0px 10px 30px;
        font-size: 0.96rem;
        line-height: 1.3rem;
        font-weight: bold;
        font-family: Calibri;
    }
    
    /* Mobile header hamburger icon */
    .menu.titles.small .mobile-nav-icon {
        position: absolute;
        right: 5%;
        top: 27%;
        font-size: 3rem;
        color: #fff;
        width: auto;
        height: auto;
        background: transparent;
        border: none;
        cursor: pointer;
    }
    
    .menu.titles.small .mobile-nav-icon i {
        color: #fff;
        font-size: 3rem;
    }
    
    .menu.titles.small .mobile-nav-icon:hover i {
        color: #ffb922;
    }
    
    /* Compact header text styling for mobile */
    .menu.titles.small.sticky.compact .lightblue {
        font-size: 1.2rem !important;
        padding-top: 8px !important;
        padding-left: 20px !important;
    }
    
    .menu.titles.small.sticky.compact .orange {
        font-size: 0.7rem !important;
        padding: 2px 0px 5px 20px !important;
        line-height: 1.1rem !important;
    }
    
    /* Compact header hamburger for mobile */
    .menu.titles.small.sticky.compact .mobile-nav-icon {
        top: 15% !important;
        font-size: 2.2rem !important;
    }
    
    .menu.titles.small.sticky.compact .mobile-nav-icon i {
        font-size: 2.2rem !important;
    }
    
    /* Logo in compact header for mobile */
    .menu.titles.small.sticky.compact .header-logo {
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: 50px;
        height: 50px;
        display: block !important;
        z-index: 51;
        opacity: 0;
        animation: fadeInLogo 0.3s ease forwards;
    }
    
    .menu.titles.small.sticky.compact .header-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    /* Compact header layout for mobile */
    .menu.titles.small.sticky.compact .col.span-1-of-2 {
        width: 60%;
        margin-left: 80px;
    }
    
    .menu.titles.small.sticky.compact .mobile-nav-icon {
        right: 3%;
    }
    
    /* Mobile header layout */
    .menu.titles.small .col.span-1-of-2 {
        width: 70%;
        float: left;
    }
    
    .menu.titles.small .span-2-of-2 {
        display: block;
        width: 100%;
    }
    
    /* Animation for logo fade in */
    @keyframes fadeInLogo {
        from {
            opacity: 0;
            transform: translateY(-50%) scale(0.8);
        }
        to {
            opacity: 1;
            transform: translateY(-50%) scale(1);
        }
    }
    
    /* Hide sidebar on mobile */
    .sidebar, .main-nav {
        display: none !important;
    }
    
    /* Ensure full width on mobile */
    .container, .row {
        width: 100%;
        max-width: 100%;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Mobile modal adjustments */
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 15px;
    }
    
    .modal-close-btn {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    /* Mobile header responsive adjustments */
    @media (max-width: 480px) {
        .menu.titles.small {
            height: 120px;
        }
        
        .menu.titles.small .lightblue {
            font-size: 1.4rem;
            padding-top: 10px;
            padding-left: 20px;
        }
        
        .menu.titles.small .orange {
            font-size: 0.8rem;
            padding: 3px 0px 8px 20px;
        }
        
        .menu.titles.small .mobile-nav-icon {
            right: 3%;
            top: 25%;
            font-size: 2.5rem;
        }
        
        .menu.titles.small .mobile-nav-icon i {
            font-size: 2.5rem;
        }
        
        body {
            padding-top: 130px;
        }
        
        body.compact-header {
            padding-top: 70px;
        }
        
        /* Compact header adjustments for small mobile */
        .menu.titles.sticky.compact {
            height: 60px !important;
        }
        
        .menu.titles.sticky.compact .lightblue {
            font-size: 1rem !important;
            padding-top: 5px !important;
            padding-left: 15px !important;
        }
        
        .menu.titles.sticky.compact .orange {
            font-size: 0.6rem !important;
            padding: 1px 0px 3px 15px !important;
        }
        
        .menu.titles.sticky.compact .mobile-nav-icon {
            top: 12% !important;
            font-size: 1.8rem !important;
        }
        
        .menu.titles.sticky.compact .mobile-nav-icon i {
            font-size: 1.8rem !important;
        }
        
        .menu.titles.sticky.compact .header-logo {
            left: 15px;
            width: 40px;
            height: 40px;
        }
    }
    
    /* Mobile text adjustments */
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.2;
    }
    
    /* Mobile image adjustments */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Mobile card adjustments */
    .card {
        margin-bottom: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
}

/* Tablet breakpoint: 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Hide mobile header on tablet */
    .menu.titles.small {
        display: none !important;
    }
    
    /* Show desktop nav on tablet */
    nav.main.big {
        display: block;
    }
    
    /* Remove body padding on tablet */
    body {
        padding-top: 0;
    }
    
    /* Disable compact header on tablet */
    .menu.titles.sticky.compact {
        height: 140px !important;
        border-radius: 20px !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
    
    .menu.titles.sticky.compact .header-logo {
        display: none !important;
    }
    
    .menu.titles.sticky.compact .col.span-1-of-2 {
        width: 70%;
        margin-left: 0;
    }
    
    /* Fix title overflow */
    .titles .span-2-of-2,
    .titles div {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        min-width: 0;
    }
    
    /* Ensure proper text wrapping */
    .lightblue, .orange, .lightgreen, .lightviolet, .darkorange, .violet, .pink {
        word-break: break-word;
        line-height: 1.2;
        max-width: 100%;
    }
    
    /* Fix grid layout for tablet */
    .col.span-1-of-2,
    .col.span-2-of-2,
    .col.span-1-of-3,
    .col.span-2-of-3 {
        min-width: 0;
        flex: 1 1 auto;
    }
    
    /* Ensure images are responsive */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Fix button and icon alignment */
    .mobile-nav-icon {
        flex-shrink: 0;
    }
    
    /* Improve text readability */
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Fix card layouts */
    .card {
        min-width: 0;
        overflow: hidden;
    }
    
    .card-body {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Desktop breakpoint: >= 1024px */
@media (min-width: 1024px) {
    /* Hide mobile header on desktop */
    .menu.titles.small {
        display: none !important;
    }
    
    /* Show desktop nav */
    nav.main.big {
        display: block;
    }
    
    /* Remove body padding on desktop */
    body {
        padding-top: 0;
    }
}

/* Sticky header styles */
.menu.titles.sticky {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 50 !important;
    background-color: #6d5fa3 !important;
    width: 100% !important;
    height: 140px !important;
    border-radius: 20px !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    transition: height 0.3s ease, padding 0.3s ease;
}

/* Compact sticky header when scrolled */
.menu.titles.sticky.compact {
    height: 70px !important;
    border-radius: 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    transition: height 0.3s ease, border-radius 0.3s ease, box-shadow 0.3s ease !important;
}

/* Compact header text adjustments */
.menu.titles.sticky.compact .lightblue {
    font-size: 1.2rem !important;
    padding-top: 8px !important;
    padding-left: 20px !important;
}

.menu.titles.sticky.compact .orange {
    font-size: 0.7rem !important;
    padding: 2px 0px 5px 20px !important;
    line-height: 1.1rem !important;
}

/* Compact header hamburger adjustments */
.menu.titles.sticky.compact .mobile-nav-icon {
    top: 15% !important;
    font-size: 2.2rem !important;
}

.menu.titles.sticky.compact .mobile-nav-icon i {
    font-size: 2.2rem !important;
}

/* Logo in compact header */
.menu.titles.sticky.compact .header-logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    display: block;
    z-index: 51;
    opacity: 0;
    animation: fadeInLogo 0.3s ease forwards;
}

.menu.titles.sticky.compact .header-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Animation for logo fade in */
@keyframes fadeInLogo {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Compact header layout adjustments */
.menu.titles.sticky.compact .col.span-1-of-2 {
    width: 60%;
    margin-left: 80px;
}

.menu.titles.sticky.compact .mobile-nav-icon {
    right: 3%;
}

/* Body scroll lock */
body.menu-open,
body.modal-open {
    overflow: hidden !important;
}

/* Modal close button styles */
.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.modal-close-btn:hover {
    background: #d32f2f;
}

.modal-close-btn .close-icon {
    line-height: 1;
    font-weight: bold;
}

/* Modal overlay */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: none;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    position: relative;
}

/* Hamburger menu improvements */
.mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.mobile-nav-icon:hover {
    transform: scale(1.1);
}

.mobile-nav-icon i {
    font-size: 24px;
    color: #333;
    transition: color 0.3s ease;
}

.mobile-nav-icon:hover i {
    color: #635ea9;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #635ea9;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modal-close-btn {
        border: 2px solid #000;
    }
    
    .mobile-nav-icon i {
        color: #000;
    }
}

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


