/* 
   Responsive styles specifically targeted at narrow foldable devices 
   like the Samsung Galaxy Fold 5 (Folded width: ~344px).
   These rules apply only to viewports 380px and below.
*/

@media (max-width: 380px) {
    /* --------------------------------------
       Course Card Adjustments 
       -------------------------------------- */
    .singel-course {
        margin-bottom: 25px !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: 16px !important;
        border: 1px solid rgba(0, 0, 0, 0.04) !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06) !important;
        background: #ffffff !important;
        overflow: hidden !important;
    }
    
    /* Make the thumbnail scale perfectly with uniform 4:3 shape */
    .singel-course .thum,
    .singel-course .thum .image,
    .singel-course .thum .image a {
        height: auto !important;
        width: 100% !important;
        display: block !important;
        background: transparent !important;
    }
    
    .singel-course .thum img {
        width: 100% !important;
        height: auto !important; 
        aspect-ratio: 4 / 3 !important; /* Slightly taller to prevent vertical cropping of logos */
        object-fit: cover !important; 
        max-height: none !important;
        display: block !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }

    /* Fix for the compact version of the course card */
    .singel-course.compact .thum,
    .singel-course.compact .thum .image,
    .singel-course.compact .thum .image a {
        height: auto !important;
    }
    .singel-course.compact .thum img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 4 / 3 !important;
        object-fit: cover !important;
        max-height: none !important;
    }

    /* Adjust padding and text size inside the card content */
    .singel-course .cont {
        padding: 18px 16px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important; 
    }
    
    .singel-course .cont h4 {
        font-family: 'Montserrat', sans-serif !important;
        font-size: 17px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        line-height: 1.35 !important;
        margin-bottom: 8px !important; 
        min-height: auto !important; 
        letter-spacing: -0.3px !important;
    }
    
    .singel-course .cont .course-desc {
        font-size: 13.5px !important;
        color: #64748b !important;
        line-height: 1.5 !important;
        margin-top: 0 !important;
        margin-bottom: 16px !important;
        white-space: normal !important; 
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
    }

    /* Bottom section (Price and Button) */
    .course-bottom {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-top: 12px !important; /* Pushes the line down away from the text */
        padding-top: 14px !important;
        border-top: 1px solid #e2e8f0 !important; /* Slightly more visible line */
        gap: 4px !important;
    }
    
    .course-price-info {
        width: auto !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .price-top-row {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .current-price {
        font-size: 15.5px !important;
        font-weight: 700 !important;
        color: #4b5563 !important;
    }

    .old-price {
        font-size: 12px !important;
        color: #9ca3af !important;
        margin-top: 2px !important;
    }

    .discount-badge {
        font-size: 10px !important;
        padding: 3px 6px !important;
        border-radius: 4px !important;
        background: #eafff0 !important;
        color: #4b6a55 !important;
        font-weight: 700 !important;
        letter-spacing: 0 !important;
    }

    .course-btn {
        width: auto !important;
        margin-top: 0 !important;
        flex-shrink: 0 !important;
    }
    
    .course-btn a.curriculum-btn {
        display: inline-block !important;
        text-align: center !important;
        width: auto !important;
        padding: 6px 12px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        border-radius: 20px !important;
        background: #ffecdf !important;
        color: #ff6b00 !important;
        box-shadow: none !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        border: none !important;
    }

    /* --------------------------------------
       Avatar / Teacher Picture Adjustments 
       -------------------------------------- */
    /* Prevents avatars from blowing up or squishing on narrow screens */
    .teacher-avatar, 
    .singel-teachers .image img,
    .student-avatar,
    .avatar img {
        width: 100% !important;
        height: auto !important;
        max-width: 220px !important;
        margin: 0 auto !important;
        display: block !important;
        object-fit: cover !important;
        border-radius: 10px !important; /* Soft corners for images on small screens */
    }

    .singel-teachers .image {
        text-align: center !important;
        padding: 10px !important;
        width: 100% !important;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .singel-teachers .cont {
        padding: 15px 10px !important;
        text-align: center !important;
    }
    
    .singel-teachers .cont h6 {
        font-size: 16px !important;
    }

    /* General responsive helpers for foldables */
    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Make slider buttons smaller to fit inside glossy box */
    .slider-cont ul {
        white-space: nowrap !important;
    }
    
    .slider-cont ul li a.main-btn {
        padding: 0 12px !important;
        font-size: 13px !important;
        line-height: 40px !important;
        height: 40px !important;
    }

    /* Center and shrink 'Career with us' button */
    .teachers-cont .mt-auto {
        text-align: center !important;
        margin-top: 20px !important;
    }
    .teachers-cont .mt-auto button.main-btn {
        padding: 0 20px !important;
        font-size: 14px !important;
        line-height: 40px !important;
        height: 40px !important;
    }

    /* Fix paragraph touching the edges by adding padding, keep justify */
    .teachers-cont p {
        text-align: justify !important;
        font-size: 14px !important;
        line-height: 1.6 !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Shrink "From Store" title so bag icon fits on one line */
    .pub-title-flex {
        font-size: 32px !important;
        white-space: nowrap !important;
        justify-content: center !important;
    }
    .pub-title-flex i {
        font-size: 32px !important; /* shrink bag slightly to fit */
    }

    /* Keep payment logos 2 per row on Fold 5 */
    .payment-methods {
        gap: 10px !important;
    }
    .payment-methods .payment-card {
        width: 150px !important; /* Shrink width slightly to fit 2 per row */
        height: 60px !important;
    }
}
