/**
 * BuddyBoss Groups Courses Card Widget Styles
 * Version: 6.0 - Swiper Implementation
 */

/* Widget Container */
.bb-courses-card-widget {
    width: 100%;
}

/* Tab Navigation */
.course-tabs-nav {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    border-bottom: 2px solid #e5e7eb;
    position: relative;
    flex-wrap: wrap;
}

.course-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: none;
    border: none;
    color: #6b7280;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
    font-family: inherit;
}

.course-tab:hover {
    color: #374151;
}

.course-tab.active {
    color: #2563eb;
}

.course-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #2563eb;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.course-tab.active::after {
    transform: scaleX(1);
}

.course-tab-icon {
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.course-tab-icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/* Tab Content */
.course-tabs-content {
    position: relative;
}

.course-tab-pane {
    display: none;
    opacity: 0;
}

.course-tab-pane.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Swiper Container */
.courses-card-wrapper.swiper-container {
    position: relative;
    overflow: hidden;
    padding: 0;
}

/* Course Card */
.course-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 500px;
    position: relative;
}

.course-card:hover {
    border-color: #2563eb;
}

.course-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Course Image */
.course-card-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
}

.course-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* Fix for Elementor object-fit issue */
.elementor-widget-bb_groups_courses_card .course-card-image img[style*="object-fit"] {
    object-fit: inherit !important;
}

/* Course Content */
.course-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.course-card-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px 0;
    line-height: 1.3;
    word-wrap: break-word;
}

.course-card-description {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 16px 0;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.course-card-meta {
    font-size: 13px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    flex-shrink: 0;
}

.course-card-meta i {
    font-size: 14px;
}

/* Course Footer */
.course-card-footer {
    padding: 0 20px 20px;
    margin-top: auto;
    flex-shrink: 0;
}

.course-card-button {
    display: inline-block;
    width: 100%;
    padding: 12px 24px;
    background-color: #2563eb;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.course-card-button.full-width {
    width: 100%;
}

.course-card-button:hover {
    background-color: #1d4ed8;
    color: #ffffff;
}

/* Swiper Navigation */
.swiper-navigation {
    position: relative;
}

.swiper-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background-color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #374151;
    z-index: 10;
    transition: all 0.3s ease;
}

.swiper-arrow:hover:not(:disabled) {
    background-color: #f3f4f6;
}

.swiper-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.swiper-arrow.swiper-prev {
    left: 10px;
}

.swiper-arrow.swiper-next {
    right: 10px;
}

/* Swiper Pagination */
.swiper-pagination {
    position: relative;
    text-align: center;
    margin-top: 30px;
}

.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #d1d5db;
    border-radius: 50%;
    margin: 0 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 1;
}

.swiper-pagination-bullet:hover {
    background: #9ca3af;
}

.swiper-pagination-bullet-active {
    background: #2563eb;
    width: 24px;
    border-radius: 4px;
}

/* Swiper Scrollbar */
.swiper-scrollbar {
    position: relative;
    background: #e5e7eb;
    height: 4px;
    margin-top: 20px;
    border-radius: 2px;
}

.swiper-scrollbar-drag {
    background: #2563eb;
    height: 100%;
    border-radius: 2px;
    cursor: grab;
}

.swiper-scrollbar-drag:active {
    cursor: grabbing;
}

/* Grid Layout */
.courses-card-wrapper.row {
    margin-left: -15px;
    margin-right: -15px;
}

.courses-card-wrapper.row > [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
    margin-bottom: 30px;
}

/* Grid Spacing */
.courses-card-wrapper.g-1 {
    margin-left: -5px;
    margin-right: -5px;
}

.courses-card-wrapper.g-1 > [class*="col-"] {
    padding-left: 5px;
    padding-right: 5px;
    margin-bottom: 10px;
}

.courses-card-wrapper.g-2 {
    margin-left: -10px;
    margin-right: -10px;
}

.courses-card-wrapper.g-2 > [class*="col-"] {
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 20px;
}

.courses-card-wrapper.g-3 {
    margin-left: -15px;
    margin-right: -15px;
}

.courses-card-wrapper.g-3 > [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
    margin-bottom: 30px;
}

.courses-card-wrapper.g-4 {
    margin-left: -20px;
    margin-right: -20px;
}

.courses-card-wrapper.g-4 > [class*="col-"] {
    padding-left: 20px;
    padding-right: 20px;
    margin-bottom: 40px;
}

.courses-card-wrapper.g-5 {
    margin-left: -25px;
    margin-right: -25px;
}

.courses-card-wrapper.g-5 > [class*="col-"] {
    padding-left: 25px;
    padding-right: 25px;
    margin-bottom: 50px;
}

/* No Courses Message */
.no-courses-message,
.no-tabs-message {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

/* Responsive Design */

/* Tablet */
@media (max-width: 992px) {
    .course-tabs-nav {
        gap: 15px;
        margin-bottom: 30px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .course-tabs-nav::-webkit-scrollbar {
        display: none;
    }
    
    .course-tab {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .course-tab-icon {
        font-size: 18px;
    }
    
    .course-card-title {
        font-size: 18px;
    }
    
    .course-card-description {
        font-size: 13px;
    }
    
    .course-card-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .course-tabs-nav {
        gap: 10px;
    }
    
    .course-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .course-tab-icon {
        font-size: 16px;
    }
    
    .course-card {
        height: 450px;
    }
    
    .course-card-image {
        height: 180px;
    }
    
    .course-card-content {
        padding: 16px;
    }
    
    .course-card-footer {
        padding: 0 16px 16px;
    }
    
    .swiper-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .swiper-arrow {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .swiper-arrow.swiper-prev {
        left: 5px;
    }
    
    .swiper-arrow.swiper-next {
        right: 5px;
    }
}

/* RTL Support */
.rtl .course-tabs-nav {
    direction: rtl;
}

.rtl .course-tab {
    direction: rtl;
}

.rtl .course-tab-icon {
    margin-right: 0;
    margin-left: 8px;
}

.rtl .swiper-arrow.swiper-prev {
    left: auto;
    right: 10px;
}

.rtl .swiper-arrow.swiper-next {
    right: auto;
    left: 10px;
}

.rtl .course-card-meta {
    direction: rtl;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .bb-courses-card-widget {
        color: #f9fafb;
    }
    
    .course-tab {
        color: #d1d5db;
    }
    
    .course-tab:hover {
        color: #f3f4f6;
    }
    
    .course-tab.active {
        color: #60a5fa;
    }
    
    .course-tab.active::after {
        background-color: #60a5fa;
    }
    
    .course-card {
        background: #1f2937;
        border-color: #374151;
    }
    
    .course-card:hover {
        border-color: #60a5fa;
    }
    
    .course-card-title {
        color: #f9fafb;
    }
    
    .course-card-description {
        color: #d1d5db;
    }
    
    .course-card-meta {
        color: #9ca3af;
    }
    
    .course-card-button {
        background-color: #2563eb;
    }
    
    .course-card-button:hover {
        background-color: #1d4ed8;
    }
    
    .swiper-arrow {
        background-color: #374151;
        color: #f9fafb;
    }
    
    .swiper-arrow:hover:not(:disabled) {
        background-color: #4b5563;
    }
    
    .swiper-pagination-bullet {
        background: #4b5563;
    }
    
    .swiper-pagination-bullet:hover {
        background: #6b7280;
    }
    
    .swiper-pagination-bullet-active {
        background: #60a5fa;
    }
    
    .swiper-scrollbar {
        background: #374151;
    }
    
    .swiper-scrollbar-drag {
        background: #60a5fa;
    }
    
    .no-courses-message,
    .no-tabs-message {
        background: #111827;
        color: #d1d5db;
    }
}

/* Accessibility - Focus Styles */
.course-tab:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.course-card-button:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.course-card-link:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.swiper-arrow:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Custom scrollbar for description */
.course-card-description::-webkit-scrollbar {
    width: 4px;
}

.course-card-description::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 2px;
}

.course-card-description::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.course-card-description::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Dark mode scrollbar */
@media (prefers-color-scheme: dark) {
    .course-card-description::-webkit-scrollbar-track {
        background: #374151;
    }
    
    .course-card-description::-webkit-scrollbar-thumb {
        background: #4b5563;
    }
    
    .course-card-description::-webkit-scrollbar-thumb:hover {
        background: #6b7280;
    }
}

/* Swiper Effects */


/* Flip Effect */
.swiper-container-flip .swiper-slide {
    backface-visibility: hidden;
}

/* Coverflow Effect */
.swiper-container-coverflow .swiper-slide {
    backface-visibility: hidden;
}

/* Vertical Mode */
.swiper-container-vertical > .swiper-wrapper {
    flex-direction: column;
}

.swiper-container-vertical .swiper-slide {
    height: auto;
}

/* Loading State */
.swiper-container.loading {
    opacity: 0.5;
    pointer-events: none;
}

.swiper-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 20;
}

.course-card:hover {
	box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0) !important;
}


@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Print Styles */
@media print {
    .course-tabs-nav {
        display: none;
    }
    
    .course-tab-pane {
        display: block !important;
        opacity: 1 !important;
        page-break-inside: avoid;
    }
    
    .swiper-container .swiper-wrapper {
        display: flex !important;
        flex-wrap: wrap !important;
        transform: none !important;
    }
    
    .swiper-slide {
        width: 33.333% !important;
        page-break-inside: avoid;
    }
    
    .course-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        height: auto;
    }
    
    .swiper-arrow,
    .swiper-pagination,
    .swiper-scrollbar {
        display: none !important;
    }
}