/* Mobile Optimization Styles */

/* ============================================
   CRITICAL: HIDE MENU ON MOBILE - MUST BE FIRST
   ============================================ */

/* Hide main menu on mobile devices - highest priority */
@media (max-width: 991px) {
    /* Override ALL possible selectors from style.css and other files */
    .header-col-mid,
    header .header-col-mid,
    .de-flex .header-col-mid,
    .container .header-col-mid,
    .row .header-col-mid,
    header.header-mobile .header-col-mid {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 0 !important;
        min-width: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        clip: rect(0, 0, 0, 0) !important;
    }
    
    #mainmenu,
    header #mainmenu,
    .header-col-mid #mainmenu,
    header.header-mobile #mainmenu,
    .container #mainmenu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        clip: rect(0, 0, 0, 0) !important;
    }
    
    #mainmenu li,
    #mainmenu > li,
    header #mainmenu li,
    header.header-mobile #mainmenu li {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    #mainmenu li a,
    #mainmenu li a.menu-item,
    header #mainmenu li a,
    .header-col-mid #mainmenu li a {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        width: 0 !important;
    }
    
    /* Override style.css rule that positions menu */
    .header-col-mid #mainmenu {
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
        width: 0 !important;
        height: 0 !important;
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        clip: rect(0, 0, 0, 0) !important;
    }
    
    .header-buttons-col,
    header .header-buttons-col {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
}

/* ============================================
   GENERAL MOBILE FIXES
   ============================================ */

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Ensure all images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Fix container padding on mobile */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* ============================================
   HEADER & NAVIGATION MOBILE FIXES
   ============================================ */

@media (max-width: 992px) {
    /* Topbar adjustments */
    #topbar {
        padding: 0.5rem 0;
    }
    
    .topbar-left {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
    
    .topbar-widget {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    .topbar-right {
        margin-top: 0.5rem;
    }
    
    .social-icons {
        gap: 0.5rem;
    }
    
    .social-icons a {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }
    
    /* Header logo */
    #logo img,
    #logo .logo-1,
    #logo .logo-2 {
        max-height: 60px !important;
    }
    
    /* Force hide mainmenu on mobile - override ALL styles including style.css */
    header .header-col-mid,
    header .header-col-mid #mainmenu,
    header #mainmenu,
    .de-flex .header-col-mid,
    .de-flex .header-col-mid #mainmenu,
    header.header-mobile .header-col-mid,
    header.header-mobile #mainmenu,
    .container .header-col-mid,
    .container #mainmenu,
    .row .header-col-mid,
    .row #mainmenu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 0 !important;
        min-width: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    header .header-buttons-col,
    header .header-buttons-col .menu_side_area,
    .de-flex .header-buttons-col,
    .de-flex .header-buttons-col .menu_side_area,
    header.header-mobile .header-buttons-col,
    .container .header-buttons-col {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        max-height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 0 !important;
        min-width: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* Hide menu items individually as well - override style.css */
    header #mainmenu li,
    header .header-col-mid #mainmenu li,
    header.header-mobile #mainmenu li,
    #mainmenu li,
    #mainmenu > li {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 0 !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* Hide menu links */
    header #mainmenu li a,
    header #mainmenu li a.menu-item,
    #mainmenu li a,
    #mainmenu li a.menu-item {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* Hamburger button styling */
    .hamburger-menu-btn {
        display: flex !important;
        width: 40px;
        height: 40px;
        background: transparent;
        border: 2px solid #1A1A1A;
        border-radius: 6px;
        padding: 8px;
        cursor: pointer;
        z-index: 1001;
        transition: all 0.3s ease;
    }
    
    .hamburger-menu-btn:hover {
        border-color: #FFD700;
        background: rgba(255, 215, 0, 0.1);
    }
    
    .hamburger-menu-btn.active {
        border-color: #FFD700;
        background: rgba(255, 215, 0, 0.1);
    }
    
    .hamburger-line {
        background: #1A1A1A;
    }
    
    .hamburger-menu-btn:hover .hamburger-line,
    .hamburger-menu-btn.active .hamburger-line {
        background: #FFD700;
    }
    
    /* Topbar mobile optimization */
    #topbar {
        padding: 0.75rem 0 !important;
    }
    
    #topbar .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .topbar-left {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
        width: 100%;
    }
    
    .topbar-widget {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
        width: 100%;
    }
    
    .topbar-widget a {
        font-size: 0.8rem;
    }
    
    .topbar-right {
        width: 100%;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .social-icons {
        justify-content: flex-start;
        gap: 0.75rem;
    }
    
    .social-icons a {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    /* Header mobile optimizations */
    header .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .de-flex {
        padding: 0.5rem 0;
    }
    
    #logo img,
    #logo .logo-1,
    #logo .logo-2 {
        max-height: 45px !important;
    }
    
    .hamburger-menu-btn {
        width: 40px;
        height: 40px;
        padding: 8px;
    }
    
    /* Topbar further optimization */
    #topbar {
        padding: 0.5rem 0 !important;
    }
    
    .topbar-widget {
        font-size: 0.75rem !important;
    }
    
    .topbar-widget i {
        font-size: 0.75rem;
        margin-right: 5px;
    }
    
    /* Dashboard adjustments */
    .instructor-dashboard,
    .student-dashboard {
        margin-top: 100px !important;
        padding: 20px 0 !important;
    }
    
    .dashboard-header {
        padding: 1.5rem !important;
    }
    
    .dashboard-header h2 {
        font-size: 1.5rem !important;
    }
    
    /* Card adjustments */
    .panel-card {
        margin-bottom: 1.5rem;
    }
    
    .panel-card-header {
        padding: 1rem 1.5rem !important;
    }
    
    .panel-card-body {
        padding: 1.5rem !important;
    }
    
    /* Table responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem !important;
        white-space: nowrap;
    }
    
    /* Form adjustments */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Booking cards */
    .booking-card {
        padding: 1rem !important;
    }
    
    /* Time slot buttons */
    #lesson_time_slots .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Calendar adjustments */
    .flatpickr-calendar {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Navigation menu */
    .instructor-menu {
        position: relative !important;
        height: auto !important;
        max-width: 100% !important;
        margin-bottom: 2rem;
    }
    
    /* Stats cards */
    .stats-card {
        padding: 1.5rem !important;
        margin-bottom: 1rem;
    }
    
    .stats-card h3 {
        font-size: 2rem !important;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 1rem;
    }
    
    /* Text adjustments */
    .app-title {
        font-size: 1.25rem !important;
    }
    
    /* Spacing adjustments */
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-5 {
        margin-top: 2rem !important;
    }
    
    /* Contact page fixes */
    .contact-wrapper {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    .contact-hero {
        padding: 60px 0 40px !important;
    }
    
    .contact-info-side,
    .contact-form-side {
        padding: 2rem 1.5rem !important;
    }
    
    .contact-info-side h3,
    .contact-form-side h3 {
        font-size: 1.5rem !important;
    }
    
    /* Hero section fixes */
    #section-hero {
        padding: 80px 0 60px !important;
    }
    
    #section-hero h1 {
        font-size: 2rem !important;
        line-height: 1.3 !important;
    }
    
    #section-hero h2 {
        font-size: 1.5rem !important;
    }
    
    #section-hero .hero-booking-btn {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Service cards stack */
    .service-card {
        margin-bottom: 2rem;
    }
    
    /* Footer fixes */
    footer .row {
        margin-left: -15px;
        margin-right: -15px;
    }
    
    footer .col-lg-3 {
        margin-bottom: 2rem;
    }
    
    footer .widget {
        margin-bottom: 1.5rem;
    }
    
    footer h5 {
        font-size: 1.1rem !important;
    }
    
    .subfooter .de-flex {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .subfooter .menu-simple {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }
    
    /* Grid layouts stack on mobile */
    .row [class*="col-"] {
        margin-bottom: 1.5rem;
    }
    
    /* Typography adjustments */
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.5rem !important;
    }
    
    h4 {
        font-size: 1.25rem !important;
    }
    
    /* Section padding */
    section {
        padding: 60px 0 !important;
    }
    
    /* Card padding */
    .card-body {
        padding: 1.5rem !important;
    }
    
    /* Button full width on mobile */
    .btn {
        width: 100%;
        margin-bottom: 0.75rem;
    }
    
    .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Form improvements */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    /* Table improvements */
    .table-responsive {
        border: none;
    }
    
    /* Image containers */
    .card-img-wrapper {
        height: 180px !important;
    }
}

@media (max-width: 576px) {
    /* Extra small devices */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Header extra small */
    #logo img,
    #logo .logo-1,
    #logo .logo-2 {
        max-height: 40px !important;
    }
    
    .hamburger-menu-btn {
        width: 38px;
        height: 38px;
        padding: 7px;
    }
    
    /* Topbar extra small - hide less important info */
    .topbar-widget:nth-child(3) {
        display: none;
    }
    
    .topbar-widget {
        font-size: 0.7rem !important;
    }
    
    .social-icons a {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    /* Time slots - full width on mobile */
    #lesson_time_slots .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Hide less important columns in tables */
    .table th:nth-child(n+4),
    .table td:nth-child(n+4) {
        display: none;
    }
    
    /* Stack form elements */
    .row .col-md-6 {
        margin-bottom: 1rem;
    }
    
    /* Extra small typography */
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    /* Contact page extra small */
    .contact-info-side,
    .contact-form-side {
        padding: 1.5rem 1rem !important;
    }
    
    .contact-item {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .contact-item-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    /* Hero section extra small */
    #section-hero {
        padding: 50px 0 40px !important;
    }
    
    #section-hero h1 {
        font-size: 1.75rem !important;
    }
    
    /* Topbar hide on very small screens */
    #topbar .topbar-left {
        display: none;
    }
    
    /* Logo smaller */
    #logo img {
        max-height: 50px !important;
    }
    
    /* Footer text smaller */
    footer {
        font-size: 0.9rem;
    }
    
    footer h5 {
        font-size: 1rem !important;
    }
    
    /* Section padding smaller */
    section {
        padding: 40px 0 !important;
    }
}

/* Touch-friendly elements */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .form-control,
    .form-select,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px; /* Apple's recommended touch target size */
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 1rem;
    }
}

/* Center calendar and notes section on mobile */
@media (max-width: 600px) {
    .container .booking-progress,
    .container .calendar-wrapper {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .calendar-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }
    /* Force parent columns to center content */
    .row > .col-md-6,
    .row > .col-lg-8,
    .row > .col-sm-12 {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    /* Remove left margin from calendar-wrapper if present */
    .calendar-wrapper {
        margin-left: 0 !important;
    }
    /* Remove any row/grid spacing that could offset centering */
    .row.g-3,
    .row.mb-4 {
        margin-left: 0 !important;
        margin-right: 0 !important;
        gap: 0 !important;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .dashboard-header {
        padding: 1rem !important;
    }
    
    .dashboard-header h2 {
        font-size: 1.25rem !important;
    }
    
    #section-hero {
        padding: 40px 0 !important;
    }
    
    .contact-hero {
        padding: 40px 0 30px !important;
    }
}

/* ============================================
   TABLET SPECIFIC FIXES (768px - 991px)
   ============================================ */

@media (min-width: 768px) and (max-width: 991px) {
    .contact-wrapper {
        grid-template-columns: 1fr !important;
    }
    
    .menu_side_area {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .menu_side_area .btn {
        flex: 0 0 calc(50% - 0.5rem);
    }
}

/* ============================================
   FIXES FOR COMMON LAYOUT ISSUES
   ============================================ */

/* Prevent text overflow */
p, span, a, li, td, th {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix flexbox issues on mobile */
@media (max-width: 768px) {
    .de-flex {
        flex-wrap: wrap;
    }
    
    .d-flex {
        flex-wrap: wrap;
    }
    
    /* Ensure columns stack */
    [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    /* Exception for specific grid layouts that should remain */
    .row.g-custom-x [class*="col-"] {
        margin-bottom: 1.5rem;
    }
}

/* Fix overflow issues */
@media (max-width: 768px) {
    * {
        max-width: 100%;
    }
    
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* ============================================
   ADDITIONAL MOBILE FIXES
   ============================================ */

/* Fix carousel on mobile */
@media (max-width: 768px) {
    .owl-carousel .owl-item {
        padding: 0 10px;
    }
    
    .owl-carousel .owl-stage {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* Fix video containers */
@media (max-width: 768px) {
    iframe,
    video,
    embed {
        max-width: 100%;
        height: auto;
    }
}

/* Fix modal on mobile */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* Fix tabs on mobile */
@media (max-width: 768px) {
    .nav-tabs,
    .nav-pills {
        flex-wrap: wrap;
    }
    
    .nav-tabs .nav-link,
    .nav-pills .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Fix accordion on mobile */
@media (max-width: 768px) {
    .accordion-button {
        font-size: 0.95rem;
        padding: 0.75rem 1rem;
    }
    
    .accordion-body {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

/* Fix spacing utilities on mobile */
@media (max-width: 768px) {
    .spacer-single,
    .spacer-double,
    .spacer-triple {
        height: 30px !important;
    }
    
    .spacer-10 {
        height: 10px !important;
    }
    
    .spacer-20 {
        height: 20px !important;
    }
    
    .spacer-30 {
        height: 30px !important;
    }
}

/* Fix text alignment on mobile */
@media (max-width: 768px) {
    .text-center-sm {
        text-align: center !important;
    }
    
    .text-left-sm {
        text-align: left !important;
    }
}

/* Fix display utilities */
@media (max-width: 768px) {
    .sm-hide {
        display: none !important;
    }
    
    .sm-show {
        display: block !important;
    }
}

/* Fix padding and margins */
@media (max-width: 768px) {
    .p-4 {
        padding: 1rem !important;
    }
    
    .p-5 {
        padding: 1.5rem !important;
    }
    
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    .mt-5 {
        margin-top: 2rem !important;
    }
}

/* Fix rounded corners on very small screens */
@media (max-width: 576px) {
    .rounded-3,
    .rounded-4,
    .rounded-5 {
        border-radius: 0.5rem !important;
    }
}

