/**
 * Enhanced Responsive CSS for ISM Ministers Prayer Network
 * Fixes for all responsiveness issues across the website
 */

/* ============================================
   1. GLOBAL RESPONSIVE UTILITIES
   ============================================ */

/* Make all images responsive by default */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive containers */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 576px) {
    .container { max-width: 540px; }
}

@media (min-width: 768px) {
    .container { max-width: 720px; }
}

@media (min-width: 992px) {
    .container { max-width: 960px; }
}

@media (min-width: 1200px) {
    .container { max-width: 1140px; }
}

@media (min-width: 1400px) {
    .container { max-width: 1320px; }
}

/* ============================================
   2. RESPONSIVE TYPOGRAPHY
   ============================================ */

/* Fluid typography scaling */
html {
    font-size: 16px;
}

@media (max-width: 1200px) {
    html { font-size: 15px; }
}

@media (max-width: 992px) {
    html { font-size: 14px; }
}

@media (max-width: 768px) {
    html { font-size: 14px; }
}

@media (max-width: 576px) {
    html { font-size: 13px; }
}

/* Responsive heading sizes */
h1, .h1 { font-size: 2.5rem; }
h2, .h2 { font-size: 2rem; }
h3, .h3 { font-size: 1.75rem; }
h4, .h4 { font-size: 1.5rem; }
h5, .h5 { font-size: 1.25rem; }
h6, .h6 { font-size: 1rem; }

@media (max-width: 992px) {
    h1, .h1 { font-size: 2.2rem; }
    h2, .h2 { font-size: 1.8rem; }
    h3, .h3 { font-size: 1.5rem; }
}

@media (max-width: 768px) {
    h1, .h1 { font-size: 2rem; }
    h2, .h2 { font-size: 1.6rem; }
    h3, .h3 { font-size: 1.4rem; }
    h4, .h4 { font-size: 1.2rem; }
}

@media (max-width: 576px) {
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.4rem; }
    h3, .h3 { font-size: 1.2rem; }
    h4, .h4 { font-size: 1.1rem; }
}

/* ============================================
   3. RESPONSIVE NAVIGATION
   ============================================ */

/* Mobile menu toggle button - always visible on mobile */
.menu-toggle #menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    padding: 10px;
    background: #202020;
    border: 1px solid #0C0C0C;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px;
}

@media (max-width: 991px) {
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .react-inner-menus {
        position: relative;
    }
    
    /* Hide the regular menu on mobile */
    .react-menus {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #fff;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        z-index: 9999;
        display: none;
        margin-bottom: 12px;
    }
    
    .react-menus.menu-active {
        display: block;
    }
    
    .react-menus > li {
        border-bottom: 1px solid #f5f3f3;
        float: none;
    }
    
    .react-menus > li > a {
        padding: 14px 24px 14px 24px;
        font-size: 15px;
        color: #0a0a0a;
    }
    
    /* Submenu styling for mobile */
    .react-menus li ul.sub-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        padding: 0;
    }
    
    .react-menus li ul.sub-menu li a {
        padding: 12px 40px 12px 50px;
        font-size: 14px;
    }
    
    .react-menus .has-sub .arrow {
        width: 55px;
        height: 54px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        position: absolute;
        right: 0;
        top: 0;
        z-index: 99;
        cursor: pointer;
        border-left: 1px solid #f5f3f3;
    }
    
    .react-menus .has-sub .arrow:after {
        content: "";
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 10px solid #0d1e50;
    }
    
    .react-menus .has-sub.menu-active > .arrow:after {
        border-top: none;
        border-bottom: 10px solid #0d1e50;
    }
    
    /* Search bar on mobile */
    .searchbar-part {
        display: none !important;
    }
    
    .searchbar-part.mobile-search-active {
        display: flex !important;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        padding: 15px;
        background: #fff;
        z-index: 1000;
    }
    
    .search-form {
        width: 100%;
    }
    
    .search-form input {
        width: 100% !important;
        min-width: unset !important;
    }
}

/* ============================================
   4. RESPONSIVE CARD LAYOUTS
   ============================================ */

/* Card base styles */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0,0,0,0.125);
    border-radius: 0.25rem;
}

@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
}

/* Responsive grid for cards */
.card-deck {
    display: flex;
    flex-flow: row wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.card-deck .card {
    flex: 1 0 0%;
    margin-right: 15px;
    margin-bottom: 0;
    margin-left: 15px;
}

@media (max-width: 992px) {
    .card-deck .card {
        flex: 0 0 calc(50% - 30px);
        max-width: calc(50% - 30px);
    }
}

@media (max-width: 576px) {
    .card-deck {
        flex-direction: column;
    }
    
    .card-deck .card {
        flex: 0 0 calc(100% - 30px);
        max-width: calc(100% - 30px);
        margin-left: 15px;
        margin-right: 15px;
    }
}

/* Service cards responsive */
.service-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    height: 100%;
}

@media (max-width: 992px) {
    .service-card {
        padding: 25px 20px;
    }
}

@media (max-width: 768px) {
    .service-card {
        padding: 20px 15px;
    }
    
    .service-card .icon-circle {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* ============================================
   5. RESPONSIVE TABLES
   ============================================ */

/* Table responsive wrapper */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 600px; /* Ensures table doesn't squish too much */
}

@media (max-width: 768px) {
    .table-responsive {
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
    }
    
    .table-responsive table {
        margin-bottom: 0;
    }
    
    .table-responsive table > thead > tr > th,
    .table-responsive table > tbody > tr > th,
    .table-responsive table > tbody > tr > td {
        white-space: nowrap;
    }
}

/* ============================================
   6. RESPONSIVE FORMS
   ============================================ */

/* Form controls */
.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

@media (max-width: 576px) {
    .form-control {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Form groups */
.form-group {
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 0.75rem;
    }
}

/* Button responsive sizing */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

@media (max-width: 576px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-block-sm {
        display: block;
        width: 100%;
    }
}

/* ============================================
   7. RESPONSIVE SECTIONS & PADDING
   ============================================ */

/* Responsive padding */
.section-padding {
    padding: 60px 0;
}

@media (min-width: 768px) {
    .section-padding {
        padding: 80px 0;
    }
}

@media (min-width: 992px) {
    .section-padding {
        padding: 100px 0;
    }
}

/* Topbar responsive */
.topbar-area.style1 {
    display: block;
}

@media (max-width: 991px) {
    .topbar-area.style1 {
        display: none;
    }
}

/* ============================================
   8. RESPONSIVE HEADER & NAV
   ============================================ */

/* Header styles */
.react-header {
    position: relative;
}

@media (max-width: 991px) {
    .react-header .menu-part {
        position: relative;
    }
    
    .react-inner-menus {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .logo {
        margin-bottom: 10px;
    }
    
    .logo img {
        max-height: 40px;
    }
}

/* ============================================
   9. RESPONSIVE FOOTER
   ============================================ */

@media (max-width: 991px) {
    .modern-footer {
        padding: 40px 0 20px;
    }
    
    .modern-footer .footer-card {
        margin-bottom: 20px;
        padding: 20px;
    }
    
    .modern-footer .footer-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .modern-footer {
        text-align: center;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form input {
        border-radius: 25px;
        margin-bottom: 10px;
    }
    
    .newsletter-form button {
        border-radius: 25px;
    }
    
    .social-icons {
        justify-content: center;
    }
}

/* ============================================
   10. RESPONSIVE GRID COLUMNS
   ============================================ */

@media (max-width: 991px) {
    .col-lg-4.col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 768px) {
    .col-lg-4.col-md-6,
    .col-lg-3.col-md-6,
    .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ============================================
   11. RESPONSIVE SLIDER
   ============================================ */

@media (max-width: 768px) {
    .home-sliders .slider-content {
        padding: 20px;
    }
    
    .home-sliders .slider-title {
        font-size: 1.5rem;
    }
    
    .home-sliders .slider-pretitle {
        font-size: 1rem;
    }
    
    .slider-btn {
        margin-top: 15px;
    }
}

/* ============================================
   12. RESPONSIVE UTILITY CLASSES
   ============================================ */

/* Hide on mobile */
@media (max-width: 991px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 992px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Text alignment */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
    
    .text-left-mobile {
        text-align: left !important;
    }
    
    .text-right-mobile {
        text-align: right !important;
    }
}

/* Margin and padding utilities for mobile */
@media (max-width: 768px) {
    .mb-4-mobile {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-4-mobile {
        margin-top: 1.5rem !important;
    }
    
    .py-4-mobile {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* ============================================
   13. FIX FOR OVERLAPPING ELEMENTS
   ============================================ */

/* Clear floats */
.clearfix::after {
    display: block;
    clear: both;
    content: "";
}

/* Z-index fixes */
@media (max-width: 991px) {
    .react-menus {
        z-index: 9999;
    }
    
    .react-header {
        z-index: 1000;
    }
    
    #backscrollUp {
        z-index: 999;
    }
}

/* ============================================
   14. RESPONSIVE MODALS
   ============================================ */

.modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
}

@media (max-width: 576px) {
    .modal-dialog {
        max-width: calc(100% - 30px);
        margin: 1rem auto;
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
}

/* ============================================
   15. RESPONSIVE BADGES & TAGS
   ============================================ */

@media (max-width: 576px) {
    .badge {
        font-size: 0.75rem;
        padding: 0.25em 0.5em;
    }
}

/* ============================================
   16. FIX FOR SPECIFIC PAGE LAYOUTS
   ============================================ */

/* Contact page */
@media (max-width: 991px) {
    .react-contact-page .address-sec {
        display: block;
    }
    
    .react-contact-page .address-sec li {
        display: block;
        text-align: center;
        padding: 20px 0;
    }
    
    .react-contact-page .address-sec li .icon {
        margin-right: 0;
        margin-bottom: 15px;
        display: block;
    }
}

/* Blog/News pages */
@media (max-width: 991px) {
    .react-sidebar {
        margin-top: 40px;
    }
}

/* Programs page */
@media (max-width: 768px) {
    .program-card .card-img-top {
        height: 180px !important;
    }
}

/* ============================================
   17. RESPONSIVE VIDEO PLAYER
   ============================================ */

/* Video.js responsive */
.video-js {
    width: 100%;
    aspect-ratio: 16/9;
}

#media-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
}

@media (max-width: 991px) {
    #media-container {
        aspect-ratio: 4/3;
    }
}

@media (max-width: 576px) {
    #media-container {
        aspect-ratio: 16/9;
        border-radius: 10px;
    }
}

/* ============================================
   18. PRINT STYLES
   ============================================ */

@media print {
    .react-header,
    .modern-footer,
    #backscrollUp {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
    }
    
    img {
        max-width: 100% !important;
    }
}
