/* ============================================================
   Neura Learn — Mobile Responsive Enhancements
   Covers: 480px · 414px · 390px · 375px · 360px · 320px
   Touch-friendly sizing, readable typography, usable layouts
   ============================================================ */

/* ── Global touch targets & box model ───────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Ensure images never overflow on any screen */
img {
    max-width: 100%;
    height: auto;
}

/* ── Viewport meta helpers ───────────────────────────────────── */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ── 480px and below ─────────────────────────────────────────── */
@media all and (max-width: 480px) {

    /* Typography scale */
    h1, .h1 { font-size: 28px !important; line-height: 1.3 !important; }
    h2, .h2 { font-size: 24px !important; line-height: 1.35 !important; }
    h3, .h3 { font-size: 20px !important; line-height: 1.4 !important; }
    h4, .h4 { font-size: 18px !important; }
    h5, .h5 { font-size: 16px !important; }
    p, li, a { font-size: 15px; }

    /* Header — compact for small screens */
    .header-area,
    .header-section {
        padding: 10px 0;
    }

    .logo img,
    .site-logo img {
        max-height: 40px;
        width: auto;
    }

    /* Mobile nav menu width */
    .nav-menu {
        width: 100% !important;
        max-width: 320px;
    }

    /* Search bar */
    .gSearch-show {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0;
    }

    /* Hero / Banner section */
    .banner-content h1,
    .home1-banner-content .title,
    .hero-title {
        font-size: 26px !important;
        line-height: 36px !important;
    }

    .banner-content p,
    .home1-banner-content .description {
        font-size: 14px !important;
    }

    .banner-image {
        margin-top: 30px;
        text-align: center;
    }

    /* Section padding */
    .section-padding {
        padding-top: 50px !important;
        padding-bottom: 50px !important;
    }

    .container,
    .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Course grid — single column */
    .course-grid,
    [class*="course-card-wrap"],
    .courses-grid-wrap {
        grid-template-columns: 1fr !important;
    }

    /* Course card */
    .single-course,
    .course-card,
    .course-single {
        margin-bottom: 20px;
    }

    .course-thumb img,
    .course-thumbnail img {
        width: 100%;
        height: 200px;
        object-fit: cover;
    }

    /* Category grid */
    .category-grid,
    [class*="category-wrap"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .single-category {
        padding: 15px 10px;
    }

    /* Pricing sidebar — full width */
    .course-sideBar,
    .ps-sidebar,
    .sidebar {
        max-width: 100% !important;
        width: 100% !important;
        margin: 20px 0 !important;
    }

    .ps-sidebar .g-title {
        font-size: 26px !important;
    }

    /* Buttons — full width on mobile */
    .eBtn,
    .btn-primary,
    .btn-secondary,
    .buy-btn,
    .enroll-btn {
        width: 100%;
        text-align: center;
        padding: 14px 20px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
    }

    /* Auth Pages */
    .login-area, .register-area {
        padding: 40px 0 !important;
    }
    
    .login-img, .register-img {
        display: none !important;
    }
    
    .login-form, .register-form {
        margin-top: 0 !important;
        padding: 20px !important;
        box-shadow: none !important;
    }

    /* Cart */
    .cart-item {
        flex-direction: column;
        gap: 12px;
    }

    .cart-item-image {
        width: 100%;
        height: 160px;
        object-fit: cover;
        border-radius: 8px;
    }

    .cart-right-actions {
        justify-content: space-between;
        width: 100%;
    }

    /* Profile page */
    .left-profile {
        text-align: center;
    }

    .left-profile img {
        width: 120px !important;
        height: 120px !important;
        border-radius: 50%;
        margin: 0 auto 16px;
    }

    .my-panel {
        padding: 16px !important;
    }

    /* Wishlist grid */
    .wishlist-grid {
        grid-template-columns: 1fr !important;
    }

    /* Reviews */
    .review-item,
    .single-review {
        flex-direction: column;
        gap: 12px;
    }

    /* Instructor / tutor cards */
    .instructor-card,
    .tutor-card {
        flex-direction: column;
        gap: 16px;
    }

    .instructor-img img,
    .tutor-img img {
        width: 80px;
        height: 80px;
        border-radius: 50%;
    }

    /* FAQ / Accordion */
    .accordion-button {
        font-size: 14px !important;
        padding: 14px 16px !important;
    }

    /* Forum */
    .forum-item,
    .question-item {
        padding: 16px;
    }

    .forum-user-img,
    .question-user-img {
        width: 40px;
        height: 40px;
    }

    /* Blog cards */
    .blog-card,
    .single-blog {
        flex-direction: column;
    }

    .blog-f-image img {
        height: 220px !important;
        border-radius: 8px 8px 0 0;
    }

    /* Footer */
    .footer-area {
        padding-top: 50px !important;
    }

    .footer-widget {
        margin-bottom: 24px;
    }

    .footer-logo-area {
        max-width: 100% !important;
    }

    .copyright-text {
        font-size: 13px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .footer-policy {
        gap: 12px;
        justify-content: center !important;
    }

    /* Cookie banner */
    .cookie-wrap,
    .cookie-banner {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        text-align: center;
    }

    /* Modal */
    .modal-dialog {
        margin: 10px;
    }

    .modal-content {
        border-radius: 16px;
    }

    /* Tabs */
    .nav-tabs .nav-link {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Badges / pills */
    .badge,
    .pill,
    .tag {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Star rating display */
    .star-rating i {
        font-size: 14px;
    }

    /* Progress bars */
    .progress {
        height: 8px;
    }

    /* Notification dropdown */
    .notification-dropdown,
    .user-dropdown {
        width: 280px !important;
        right: -10px !important;
    }

    /* Breadcrumb */
    .breadcrumb {
        flex-wrap: wrap;
        gap: 4px;
    }

    .breadcrumb-item {
        font-size: 13px;
    }

    /* Contact form */
    .contact-form .form-control,
    .comment-form .form-control {
        font-size: 15px;
        padding: 12px 14px;
    }

    /* Course player */
    .course-player-area,
    .player-wrap {
        flex-direction: column;
    }

    .lesson-sidebar,
    .player-sidebar {
        width: 100% !important;
        max-height: 50vh;
        overflow-y: auto;
    }

    /* Live class / Zoom */
    .zoom-area iframe,
    .live-class-video {
        height: 220px;
    }

    /* Certificate */
    .certificate-wrap {
        transform: scale(0.7);
        transform-origin: top center;
    }

    /* Pagination */
    .pagination {
        gap: 4px;
    }

    .page-link {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 36px;
        min-height: 36px;
    }
}

/* ── 414px and below (iPhone Plus / Max standard) ─────────────── */
@media all and (max-width: 414px) {

    .home1-banner-content .title {
        font-size: 24px !important;
        line-height: 34px !important;
    }

    /* Grid adjustments */
    .why-choose-wrap1 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .why-choose1-single:nth-of-type(2)::after {
        display: none;
    }

    /* Stats / counter row */
    .counter-area,
    .stats-area,
    [class*="counter-wrap"] {
        flex-wrap: wrap;
        gap: 16px;
    }

    [class*="counter-single"],
    [class*="stat-single"] {
        width: calc(50% - 8px);
        text-align: center;
    }

    /* Testimonials */
    .testimonial-border {
        display: none;
    }

    .testimonial-des {
        padding: 20px !important;
    }

    /* Feature blocks */
    .single-feature {
        padding: 20px;
    }
}

/* ── 390px and below (iPhone 14/15 standard) ──────────────────── */
@media all and (max-width: 390px) {

    .nav-menu {
        width: 290px !important;
    }

    .toggle-bar {
        width: 36px;
        height: 36px;
        font-size: 20px;
        line-height: 36px;
    }

    .header-menu .eBtn {
        padding: 8px 18px !important;
        font-size: 13px !important;
    }

    /* Course card compact */
    .course-thumb img {
        height: 185px;
    }

    /* Category — 2 columns remain but smaller */
    .category-grid {
        gap: 10px !important;
    }

    .single-category img,
    .cat-icon {
        width: 42px;
        height: 42px;
    }

    .single-category h3,
    .cat-title {
        font-size: 13px !important;
    }
}

/* ── 375px and below (iPhone SE 3rd gen, iPhone 6/7/8) ─────────── */
@media all and (max-width: 375px) {

    h1, .h1 { font-size: 24px !important; }
    h2, .h2 { font-size: 21px !important; }
    h3, .h3 { font-size: 18px !important; }

    .banner-content h1,
    .home1-banner-content .title {
        font-size: 22px !important;
        line-height: 32px !important;
    }

    .section-title,
    .g-title {
        font-size: 22px !important;
    }

    /* Buttons — slightly smaller font */
    .eBtn,
    .btn-primary {
        font-size: 14px !important;
        padding: 12px 16px !important;
    }

    /* Nav menu full width */
    .nav-menu {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    /* Cart total area */
    .cart-total-area {
        padding: 16px !important;
    }

    /* Price display */
    .price-tag,
    .course-price {
        font-size: 22px !important;
    }

    del.old-price {
        font-size: 15px;
    }

    /* Lesson list items */
    .lesson-list li a {
        font-size: 13px;
        padding: 10px 12px;
    }

    /* Quiz */
    .quiz-option {
        padding: 12px;
        font-size: 14px;
    }

    /* Comment box */
    .comment-form textarea {
        min-height: 120px;
    }
}

/* ── 360px and below (most common Android devices) ─────────────── */
@media all and (max-width: 360px) {

    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Logo */
    .logo img {
        max-height: 36px;
    }

    /* Search icon */
    .gSearch-icon {
        margin-right: 3px;
    }

    /* Hero */
    .banner-content h1,
    .home1-banner-content .title {
        font-size: 20px !important;
        line-height: 30px !important;
    }

    /* Category — still 2 columns but more compact */
    .single-category {
        padding: 10px 6px;
    }

    /* Course card */
    .course-thumb img {
        height: 170px;
    }

    .card_preview_text_course {
        height: auto !important;
        -webkit-line-clamp: 2 !important;
    }

    /* Instructor info */
    .istructor-info {
        gap: 12px;
    }

    /* Rating stars compact */
    .star-rating {
        gap: 2px;
    }

    /* Footer links */
    .footer-links li {
        margin-bottom: 8px;
    }

    .footer-links li a {
        font-size: 13px;
    }

    /* Social icons */
    .social-links a {
        width: 36px;
        height: 36px;
        line-height: 36px;
        font-size: 14px;
    }
}

/* ── 320px and below (very small / older devices) ──────────────── */
@media all and (max-width: 320px) {

    html {
        font-size: 14px;
    }

    .container,
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    h1, .h1 { font-size: 20px !important; }
    h2, .h2 { font-size: 18px !important; }
    h3, .h3 { font-size: 16px !important; }

    .banner-content h1,
    .home1-banner-content .title {
        font-size: 18px !important;
        line-height: 28px !important;
    }

    /* Category — still 2 cols but minimal padding */
    .single-category {
        padding: 8px 4px;
    }

    .single-category h3 {
        font-size: 11px !important;
    }

    /* Course card */
    .course-thumb img {
        height: 155px;
    }

    /* Button */
    .eBtn {
        font-size: 13px !important;
        padding: 10px 12px !important;
    }

    /* Form */
    .form-control {
        font-size: 14px;
        padding: 10px 12px;
    }

    /* Table: allow horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Notification */
    .notification-dropdown {
        width: 260px !important;
        right: 0 !important;
        left: auto !important;
    }
}

/* ── Touch-friendly global improvements ─────────────────────────── */
@media (hover: none) and (pointer: coarse) {

    /* Minimum 44px touch targets */
    a,
    button,
    .btn,
    .eBtn,
    .nav-link,
    .page-link,
    .dropdown-item,
    input[type="checkbox"],
    input[type="radio"],
    .accordion-button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Remove hover-only effects on touch */
    .course-card:hover .course-overlay,
    .single-course:hover .course-hover {
        opacity: 0;
    }

    /* Faster taps — remove 300ms delay */
    a,
    button,
    input,
    select,
    textarea {
        touch-action: manipulation;
    }

    /* Swiper / carousel arrows — bigger on touch */
    .swiper-button-next,
    .swiper-button-prev {
        width: 50px !important;
        height: 50px !important;
    }

    .owl-nav button {
        width: 48px !important;
        height: 48px !important;
    }

    /* Scrollable containers — smooth inertia */
    .lesson-sidebar,
    .player-sidebar,
    .notification-dropdown,
    .menu-dropdown {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }

    /* Form inputs — prevent zoom on iOS */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important; /* prevents iOS zoom on focus */
    }
}

/* ── Safe area insets for notched phones ─────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    .header-area,
    .fixed-header,
    header {
        padding-top: env(safe-area-inset-top, 0);
    }

    .mobile-bottom-nav,
    footer {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}

/* ── Mobile sticky header improvement ───────────────────────────── */
@media all and (max-width: 767px) {
    .header-area.sticky,
    .sticky-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--bg-white, #fff);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }

    /* Prevent content jump under sticky header */
    body.has-sticky-header {
        padding-top: 70px;
    }
}

/* ── WebView specific adjustments ──────────────────────────── */
.is-webview {
    background-color: #fff;
}

.is-webview section {
    padding-top: 0 !important;
    padding-bottom: 20px !important;
}

/* Hide any floating back-to-top or chat widgets in webview if they exist */
.is-webview .back-to-top,
.is-webview .floating-chat,
.is-webview .whatsapp-chat {
    display: none !important;
}

/* Ensure the main container has no top margin since header is removed */
.is-webview main,
.is-webview .main-content {
    margin-top: 0 !important;
    padding-top: 15px !important;
}

/* Mobile specific spacing for WebView */
.is-webview .container,
.is-webview .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
}

    /* Offcanvas menu close button — easier to tap */
    .btn-close,
    .close-btn,
    [data-bs-dismiss="offcanvas"] {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Payment gateways grid on mobile */
    .payment-methods-grid,
    .gateway-list {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px;
    }

    .payment-method-item img,
    .gateway-logo {
        max-height: 40px;
        width: auto;
    }

    /* My courses tabs */
    .my-courses-tab .nav-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .my-courses-tab .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .my-courses-tab .nav-tabs .nav-link {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Course player full width on mobile */
    .course-player-wrap {
        flex-direction: column;
    }

    .video-player-area {
        width: 100% !important;
    }

    /* Interactive lesson on mobile */
    .interactive-question-area {
        padding: 16px;
    }

    .quiz-options-list {
        gap: 10px;
    }

    /* Dashboard cards */
    .dashboard-card-wrap {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    /* Instructor stats */
    .instructor-stat-wrap {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
}

/* ── Landscape mode on phones ────────────────────────────────────── */
@media all and (max-height: 500px) and (orientation: landscape) {

    .banner-section,
    .hero-section {
        min-height: auto;
        padding: 40px 0;
    }

    .banner-content h1 {
        font-size: 22px !important;
        line-height: 30px !important;
    }

    .nav-menu {
        max-height: 100vh;
        overflow-y: auto;
    }

    /* Video player — use full height in landscape */
    .video-player-area,
    .plyr,
    video {
        height: calc(100vh - 60px) !important;
    }
}

/* ── Print / accessibility ───────────────────────────────────────── */
@media print {
    .header-area,
    .footer-area,
    .sidebar,
    .nav-menu,
    .cookie-wrap {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }
}
