/* Mobile Optimization Styles */
:root {
    --touch-target-min: 44px; /* Minimum touch target size */
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
}

/* Base mobile styles */
@media (max-width: 768px) {
    /* Center align all text and content */
    body, 
    .container,
    .container-fluid,
    .row,
    .col,
    .col-*,
    .col-md-*,
    .col-lg-*,
    .col-xl-*,
    .card,
    .card-body,
    .text-start,
    .text-end,
    .text-left,
    .text-right,
    .text-justify {
        text-align: center !important;
    }

    /* Center all headings */
    h1, h2, h3, h4, h5, h6,
    .h1, .h2, .h3, .h4, .h5, .h6 {
        text-align: center !important;
        margin-left: auto;
        margin-right: auto;
    }

    /* Center all content in cards */
    .card {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    /* Stack buttons vertically but keep badges in a row */
    .btn-group:not(.badge-container),
    .btn-toolbar:not(.badge-container),
    .d-flex:not(.badge-container),
    .btn-container:not(.badge-container),
    .button-container:not(.badge-container) {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    /* Keep badges in a single line with horizontal scrolling */
    .badge-container {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        justify-content: flex-start !important;
        padding-bottom: 5px;
        width: 100%;
    }
    
    /* Hide scrollbar for badges but keep functionality */
    .badge-container::-webkit-scrollbar {
        display: none;
    }

    /* Make buttons full width on mobile */
    .btn {
        width: 100% !important;
        max-width: 300px !important;
        margin: 5px 0 !important;
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Center images */
    img {
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
    }

    /* Center form elements */
    .form-control,
    .form-select,
    .input-group {
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 300px !important;
    }

    /* Center lists */
    ul, ol {
        display: inline-block;
        text-align: left;
        padding-left: 1.5rem;
        margin-left: 0;
        width: auto;
    }

    /* Center tables */
    .table-responsive {
        display: flex;
        justify-content: center;
    }

    /* Center footer content */
    footer .row > div {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    /* Center footer lists and list items */
    footer ul.list-unstyled {
        display: flex !important;
        flex-direction: column;
        align-items: center !important;
        padding-left: 0;
        width: 100%;
    }
    
    footer .list-unstyled li {
        text-align: center;
        width: 100%;
        padding: 0.25rem 0;
    }
    
    footer .list-unstyled li a {
        display: inline-block;
        width: 100%;
        padding: 0.5rem 0;
    }
    
    /* Center contact info items */
    footer .d-flex {
        justify-content: center !important;
        text-align: center;
    }

    /* Center social icons */
    .social-links {
        justify-content: center !important;
    }

    /* Keep navbar brand aligned to the left */
    .navbar-brand {
        margin-right: auto;
        margin-left: 0;
        display: flex;
        align-items: center;
        text-align: left;
    }

    /* Center dropdown menus */
    .dropdown-menu {
        text-align: center;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    /* Center align table cells */
    .table td, .table th {
        text-align: center;
    }
}

/* Ensure dropdown menus work on mobile */
.navbar .dropdown-menu {
    position: absolute;
    z-index: 1000;
    display: none;
    min-width: 10rem;
    padding: 0.5rem 0;
    margin: 0;
    font-size: 1rem;
    color: #212529;
    text-align: left;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.25rem;
}

.navbar .dropdown-menu.show {
    display: block;
}

.navbar .dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.255em;
    vertical-align: 0.255em;
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
}

/* Improved mobile form inputs */
input, select, textarea, button {
    font-size: 16px; /* Prevents zoom on focus on iOS */
}

/* Better touch feedback */
a, button, [role="button"], .btn, .nav-link, .dropdown-item {
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    -webkit-tap-highlight-color: transparent;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Ensure minimum touch target size */
    .btn, .nav-link, .dropdown-item, .form-check-label {
        padding: 12px 16px;
        min-height: var(--touch-target-min);
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        max-width: 300px;
        margin-left: auto !important;
        margin-right: auto !important;
        text-align: center;
    }
    
    /* Center align form check labels */
    .form-check {
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
    
    .form-check-input {
        margin-right: 8px;
    }
    
    /* Keep logo container aligned to the left */
    .logo-container {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 15px;
        text-align: left;
    }
    
    /* Keep toggler aligned to the right */
    .navbar-toggler {
        margin-left: auto;
        margin-right: 0;
        display: block;
    }
    
    /* Keep nav items left-aligned */
    .navbar-nav {
        align-items: flex-start;
        text-align: left;
    }
    
    .logo-main {
        height: 80px !important;
        width: auto !important;
        max-width: none;
        object-fit: contain;
    }
    
    .logo-text {
        display: flex;
        flex-direction: column;
        justify-content: center;
        line-height: 1.2;
    }
    
    .logo-text span {
        display: block;
        white-space: nowrap;
        font-weight: 500;
        margin: 1px 0;
    }
    
    @media (min-width: 768px) {
        .logo-main {
            height: 100px !important;
        }
        .logo-text span {
            font-size: 0.85rem !important;
            margin: 2px 0;
        }
        .logo-text span:first-child {
            font-size: 0.95rem !important;
        }
    }
    
    @media (max-width: 767.98px) {
        .logo-main {
            height: 70px !important;
        }
        .logo-text span {
            font-size: 0.7rem !important;
            margin: 1px 0;
        }
        .logo-text span:first-child {
            font-size: 0.8rem !important;
        }
    }
    
    /* Center About Section on Mobile */
    #about .row {
        text-align: center !important;
    }
    
    #about .section-title,
    #about p,
    #about .btn {
        text-align: center !important;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Center paragraphs in about section */
    #about .container p {
        text-align: center !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
    }
    
    /* Mobile Footer Styling */
    @media (max-width: 768px) {
        footer {
            font-size: 0.9rem;
            padding: 1.5rem 0;
        }
        
        footer .row > div {
            margin-bottom: 1.5rem;
        }
        
        footer .list-unstyled {
            margin-bottom: 0;
        }
        
        footer .list-unstyled li {
            margin: 0 !important;
            padding: 0.25rem 0 !important;
            line-height: 1.2 !important;
        }
        
        footer h5 {
            margin: 0 0 0.5rem 0 !important;
            font-size: 1rem;
        }
        
        footer .social-icons {
            margin-top: 0.75rem;
        }
        
        footer p {
            margin-bottom: 0.5rem !important;
        }
    }
    
    /* Hero Slider Mobile Optimization */
    .hero-slider-container {
        position: relative;
        width: 100%;
        height: 0;
        padding-bottom: 62.5%; /* 16:10 aspect ratio */
        overflow: hidden;
    }
    
    .hero-slider-container .carousel-inner,
    .hero-slider-container .carousel-item,
    .hero-slider-container .carousel-item.active {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }
    
    /* Hero Text Container - Mobile */
    .hero-slider-container .slider-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 1rem;
        background: rgba(0, 0, 0, 0.5);
        z-index: 2;
    }
    
    .hero-slider-container .hero-text {
        width: 100%;
        margin-top: -25px !important; /* Adjusted to move content down further */
        padding: 1rem;
        position: relative;
        top: 35px; /* Increased from 25px to 35px to move content down further */
    }
    
    .hero-slider-container .hero-text h1 {
        font-size: 1.8rem !important;
        margin: 0 0 1rem 0 !important;
        padding: 0 10px !important;
        line-height: 1.3 !important;
        font-weight: 700 !important;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8) !important;
        color: #fff;
        text-transform: uppercase;
        font-weight: 600;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
        white-space: normal; /* Changed from nowrap to normal */
        overflow: visible; /* Changed from hidden to visible */
        text-overflow: clip; /* Changed from ellipsis to clip */
        word-wrap: break-word; /* Ensure long words break */
    }
    
    .hero-slider-container .hero-text .lead {
        font-size: 0.9rem !important; /* Reduced from 1rem */
        margin: 0 0 1.5rem 0 !important;
        padding: 0 10px !important;
        line-height: 1.4 !important; /* Slightly reduced line height for smaller text */
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8) !important;
    }
    
    .hero-slider-container .hero-text .btn {
        padding: 0.15rem 0.5rem !important; /* Reduced vertical padding */
        font-size: 0.7rem !important;
        min-width: 90px;
        white-space: nowrap;
        height: auto;
        line-height: 1.1; /* Reduced line height */
        min-height: 28px; /* Explicit height control */
    }
    
    .hero-slider-container .btn-group {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        margin-top: -10px; /* Move buttons up by 10px */
    }
    
    /* Position the 'Our Trainings' button 5px up */
    .hero-slider-container .slider-overlay .hero-text .d-flex > .btn[href="#trainings"] {
        margin-top: -5px !important;
        position: relative !important;
        transform: translateY(-5px) !important;
    }
    
    /* Position the 'Visit Our Shop' button 9px up from its original position (-7px - 2px = -9px) */
    .hero-slider-container .slider-overlay .hero-text .d-flex > .btn[href="shop.php"] {
        margin-top: -9px !important;
        position: relative !important;
        transform: translateY(-9px) !important;
    }
    
    .hero-slider-container .btn {
        width: 90%;
        max-width: 280px;
        margin: 0.15rem 0; /* Reduced margin */
        padding: 0.4rem 1.2rem; /* Reduced padding (about 30% less) */
        font-size: 0.9rem; /* Slightly smaller font */
        border-width: 1.5px; /* Slightly thinner border */
        white-space: normal;
        line-height: 1.3; /* Tighter line height */
    }
    
    @media (max-width: 360px) {
        .hero-slider-container {
            padding-bottom: 66.67%; /* 3:2 aspect ratio */
        }
        .hero-slider-container .hero-text h1 {
            font-size: 0.95rem !important;
            margin-bottom: 0.2rem !important;
            line-height: 1.1;
        }
        .hero-slider-container .hero-text .lead {
            font-size: 0.72rem !important;
            margin: 0 0 0.4rem 0 !important;
            line-height: 1.15;
        }
        .hero-slider-container .hero-text .btn {
            padding: 0.2rem 0.5rem !important;
            font-size: 0.7rem !important;
            min-width: 90px;
        }
        .hero-slider-container .btn-group {
            gap: 4px;
            max-width: 260px;
        }
    }
    
    /* Position carousel indicators below slider */
    .hero-slider-container .carousel-indicators {
        position: absolute !important;
        bottom: -55px !important; /* Moved 15px further down from -40px */
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto !important;
        padding: 15px 0 !important;
        justify-content: center !important;
        z-index: 5 !important;
    }
    
    .hero-slider-container .carousel-indicators [data-bs-target] {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        margin: 0 8px;
        background-color: rgba(46, 125, 50, 0.5) !important; /* Semi-transparent green */
        border: 2px solid #2e7d32 !important; /* Green border */
        opacity: 1 !important;
        transition: all 0.3s ease;
        box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    }
    
    .hero-slider-container .carousel-indicators .active {
        background-color: #2e7d32 !important; /* Solid green */
        transform: scale(1.3) !important;
        border: 2px solid #1b5e20 !important; /* Darker green border */
    }
    
    .hero-slider-container .carousel-indicators [data-bs-target]:hover {
        background-color: #388e3c !important; /* Brighter green on hover */
        transform: scale(1.2) !important;
    }
    
    /* Adjust slider container to account for indicators below */
    .hero-slider-container {
        padding-bottom: 0;
        margin-bottom: 0;
    }
    
    .hero-content {
        padding: 20px 15px !important;
        width: 100%;
        max-width: 100%;
    }
    
    /* Hero Text Container - Mobile */
    .hero-slider-container .slider-overlay .hero-text {
        padding: 15px;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        position: absolute;
        bottom: 20px;
        left: 0;
        right: 0;
    }
    
    /* Hero Text - Mobile - High Specificity */
    .hero-slider-container .slider-overlay .hero-text,
    .hero-slider-container .slider-overlay .hero-text * {
        color: #ffffff !important;
        text-shadow: none !important;
    }
    
    /* Hero Heading - Mobile */
    .hero-slider-container .slider-overlay .hero-text h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
        line-height: 1.2;
    }
    
    /* Hero Lead Text - Mobile */
    .hero-slider-container .slider-overlay .hero-text .lead {
        font-size: 1.1rem;
        margin-bottom: 0.75rem; /* Reduced from 1.5rem */
        padding: 0 0.5rem;
        line-height: 1.4;
    }
    
    .hero-text .btn {
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
        margin: 5px 8px !important;
        width: auto !important;
        display: inline-block !important;
        position: relative;
        z-index: 5;
    }
    
    /* Move 'Visit Our Shop' button up by 10px */
    .hero-text .btn[href*="shop.php"] {
        transform: translateY(-10px);
    }
    
    /* Adjust text spacing */
    .hero-slider-container .hero-text h1 {
        margin-bottom: 0.5rem !important;
        font-size: 1.8rem !important;
    }
    
    .hero-slider-container .hero-text .lead {
        margin-bottom: 1rem !important;
        font-size: 1.1rem !important;
        line-height: 1.4 !important;
    }
    
    /* Slider Overlay - Mobile */
    .hero-slider-container .slider-overlay {
        background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0) 100%);
        padding: 20px 0 40px;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
    }
    
    /* Adjust carousel indicators */
    .hero-slider-container .carousel-indicators {
        bottom: 15px;
        margin: 0;
        padding: 0;
    }
    
    .hero-slider-container .carousel-indicators [data-bs-target] {
        width: 12px;
        height: 12px;
        margin: 0 4px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.5);
        border: none;
    }
    
    .hero-slider-container .carousel-indicators .active {
        background-color: #fff;
    }
    
    /* Improve form inputs on mobile */
    .form-control, .form-select {
        padding: 12px !important;
        font-size: var(--font-size-base) !important;
    }
    
    /* Adjust font sizes for better readability */
    body {
        font-size: var(--font-size-base) !important;
        line-height: 1.5 !important;
    }
    
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.75rem !important; }
    h3 { font-size: 1.5rem !important; }
    h4 { font-size: 1.25rem !important; }
    
    /* Button styles are now handled by the base mobile styles */
    
    /* Improve card layouts on mobile */
    .card {
        margin-bottom: 20px !important;
    }
    
    /* Fix for footer links */
    footer a, 
    footer a:link, 
    footer a:visited {
        color: #000 !important;
        text-decoration: none !important;
    }
    
    /* Adjust padding for mobile */
    .section-padding {
        padding: 2rem 0 !important;
    }
    
    /* Improve mobile navigation */
    .navbar-collapse {
        background: white;
        padding: 1rem;
        margin-top: 0.5rem;
        border-radius: 0.25rem;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
        text-align: center;
    }
    
    /* Center align nav links */
    .nav-link {
        justify-content: center !important;
        text-align: center;
    }
    
    /* Ensure dropdowns are mobile-friendly */
    .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin: 0.5rem auto !important;
        border: 1px solid rgba(0,0,0,0.1);
        text-align: center;
    }
    
    /* Center dropdown items */
    .dropdown-item {
        text-align: center;
        justify-content: center !important;
    }
}
