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);
    }
}

/* Modern Course Card Styles */
.course-card-wrapper {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-course-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modern-course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.course-image-container {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.course-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-course-card:hover .course-main-image {
    transform: scale(1.1);
}

.course-overlay-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.2) 50%,
            rgba(0, 0, 0, 0.6) 100%);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.modern-course-card:hover .course-overlay-gradient {
    opacity: 0.9;
}

.course-badge-price {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #d4af37 0%, #f4e5a1 100%);
    color: #1a1a1a;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    z-index: 2;
    font-family: var(--font-family-Urbanist, 'Arial', sans-serif);
}

.course-preview-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.modern-course-card:hover .course-preview-btn {
    transform: translate(-50%, -50%) scale(1);
}

.course-preview-btn:hover {
    background: #d4af37;
    color: #fff;
    transform: translate(-50%, -50%) scale(1.05);
}

.course-preview-btn i {
    font-size: 18px;
}

.course-content-section {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-main-title {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.4;
    font-family: var(--font-family-Philosopher, 'Georgia', serif);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.course-description-text {
    color: #666;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 20px;
    flex: 1;
    font-family: var(--font-family-Urbanist, 'Arial', sans-serif);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.course-action-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.course-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #d4af37;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: var(--font-family-Urbanist, 'Arial', sans-serif);
}

.course-action-btn:hover {
    color: #b8941f;
    gap: 15px;
    text-decoration: none;
}

.course-action-btn i {
    transition: transform 0.3s ease;
}

.course-action-btn:hover i {
    transform: translateX(5px);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .course-image-container {
        height: 220px;
    }

    .course-main-title {
        font-size: 20px;
    }

    .course-badge-price {
        padding: 6px 16px;
        font-size: 14px;
        top: 15px;
        right: 15px;
    }

    .course-content-section {
        padding: 20px;
    }

    .course-preview-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .modern-course-card {
        margin-bottom: 20px;
    }

    .course-image-container {
        height: 200px;
    }
}