html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

.page-wrapper {
    overflow-x: hidden;
}

/* Responsive Typography and Truncation Styles */
.course-title-truncate {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(1.1rem, 2vw + 0.5rem, 1.25rem);
    /* Scales smoothly based on viewport */
    line-height: 1.4;
}

.course-desc-truncate {
    line-clamp: 3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: clamp(0.8rem, 1.5vw + 0.5rem, 0.875rem);
    /* Scales smoothly based on viewport */
    line-height: 1.5;
    min-height: 4.5em;
    /* Forces exactly 3 lines of height (1.5 * 3) to keep titles aligned */
}

.course-price-responsive {
    font-size: clamp(0.9rem, 1.8vw + 0.5rem, 1rem);
}

.course-btn-responsive {
    font-size: clamp(0.8rem, 1.5vw + 0.5rem, 0.85rem);
}

.course-eye-float {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #f5c36b;
    border: 1px solid rgba(245, 195, 107, 0.55);
    z-index: 2;
}

.course-eye-float:hover {
    color: #fff;
    background: rgba(196, 154, 108, 0.85);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Modal shell uses Bootstrap defaults on mobile */
.modal-dialog-mobile {
    margin: 0.5rem;
    max-width: none;
    height: auto;
    display: block;
}

.modal-content-mobile {
    border: none;
    border-radius: 0.5rem;
    max-height: 90vh;
    overflow: hidden;
    background: #fff;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.course-modal-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    position: relative;
}

.course-modal-content {
    padding: 24px;
    max-height: calc(90vh - 280px);
    overflow-y: auto;
}

.course-modal-header {
    margin-bottom: 20px;
}

.course-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.3;
}

.course-modal-category {
    display: inline-block;
    background: #f5c36b;
    color: #1a1a1a;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.course-modal-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #f5c36b;
    margin: 16px 0;
}

.course-modal-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.course-modal-stars {
    color: #f5c36b;
    font-size: 0.9rem;
}

.course-modal-reviews {
    color: #666;
    font-size: 0.875rem;
}

.course-modal-section {
    margin-bottom: 20px;
}

.course-modal-label {
    font-weight: 600;
    color: #333;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.course-modal-text {
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
}

.course-modal-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.course-modal-info-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #f5c36b;
}

.course-modal-info-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.course-modal-info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.course-modal-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
}

.course-modal-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.course-modal-btn-primary {
    background: #1a1a1a;
    color: #f5c36b;
    border: 2px solid #f5c36b;
}

.course-modal-btn-primary:hover {
    background: #f5c36b;
    color: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 195, 107, 0.3);
}

.course-modal-btn-secondary {
    background: transparent;
    color: #1a1a1a;
    border: 2px solid #ddd;
}

.course-modal-btn-secondary:hover {
    background: #f8f9fa;
    border-color: #f5c36b;
}

/* Scrollbar styling */
.course-modal-content::-webkit-scrollbar {
    width: 6px;
}

.course-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.course-modal-content::-webkit-scrollbar-thumb {
    background: #f5c36b;
    border-radius: 3px;
}

.course-modal-content::-webkit-scrollbar-thumb:hover {
    background: #d4a959;
}

/* Desktop adjustments */
@media (min-width: 768px) {
    .modal-dialog-mobile {
        max-width: 540px;
        margin: 1.75rem auto;
        height: auto;
        align-items: center;
    }

    .modal-content-mobile {
        border-radius: 16px;
        max-height: 85vh;
    }

    .course-modal-image {
        height: 320px;
        border-radius: 16px 16px 0 0;
    }

    .course-modal-content {
        max-height: calc(85vh - 320px - 80px);
    }
}

/* Loading state */
.course-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.course-modal-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

.course-modal-left,
.course-modal-right {
    padding: 20px;
    width: 100%;
}

.course-modal-left {
    background: #f7f7f2;
}

.course-modal-right {
    background: #fff;
    min-width: 0;
}

.course-modal-title-block {
    margin-top: 16px;
}

.course-modal-title-block .course-modal-title {
    margin: 0 0 8px;
}

.course-modal-info-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.course-modal-footer-alt {
    margin-top: 18px;
}

#coursePreviewModal,
#coursePreviewModal .modal-dialog,
#coursePreviewModal .modal-content,
#coursePreviewModal .modal-body {
    overflow-x: hidden;
}

@media (min-width: 768px) {
    .course-modal-shell {
        display: grid;
        grid-template-columns: 360px minmax(0, 1fr);
        min-height: 580px;
    }

    .course-modal-left {
        border-right: 1px solid #ece8df;
    }

    .course-modal-image {
        height: 320px;
        border-radius: 16px;
    }

    .course-modal-right {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    #coursePreviewModal .modal-dialog-mobile {
        width: min(1180px, calc(100vw - 48px));
        max-width: min(1180px, calc(100vw - 48px));
        margin: 24px auto;
        height: auto;
        align-items: center;
    }

    #coursePreviewModal .modal-content-mobile {
        width: 100%;
        max-height: 88vh;
        border-radius: 18px;
    }

    #coursePreviewModal .course-modal-right {
        padding-left: 24px;
        padding-right: 28px;
    }
}

.spinner-gold {
    width: 40px;
    height: 40px;
    border: 4px solid #f5c36b;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}