/* ============================================
   CATEGORY PAGE — CARD GRID REDESIGN
   ============================================ */

   .course-card-grid {
    margin-top: 1.5rem;

    .courses {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;

        @media (max-width: 768px) {
            grid-template-columns: 1fr;
        }
    }

    // Remove default Moodle list spacing
    .coursebox {
        margin: 0;
        padding: 0;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        transition: box-shadow 0.2s ease;
        overflow: hidden;

        &:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }

        // Hide anything Moodle still injects by default
        .info,
        .content,
        .moreinfo,
        .teachers {
            display: none;
        }
    }
}

/* Individual horizontal card */
.course-card-item {
    display: flex;
    flex-direction: row;
    height: 100%;
    min-height: 180px;

    @media (max-width: 576px) {
        flex-direction: column;
    }
}

/* Left: Image */
.course-card-image {
    flex: 0 0 40%;
    max-width: 250px;
    overflow: hidden;
    background: #f5f5f5;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    @media (max-width: 576px) {
        flex: none;
        max-width: 100%;
        height: 160px;
    }
}

/* Right: Content */
.course-card-body {
    flex: 1;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.course-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;

    a {
        color: #1a1a1a;
        text-decoration: none;

        &:hover {
            color: #0056b3;
        }
    }
}

.course-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: #666;

    .course-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;

        .icon {
            color: #888;
        }
    }
}

.course-card-summary {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-card-action {
    margin-top: auto;

    .btn {
        padding: 0.5rem 1.25rem;
        font-size: 0.875rem;
        font-weight: 500;
        border-radius: 4px;
    }

    .btn-primary {
        background-color: #1e3a5f;
        border-color: #1e3a5f;
    }
}
/* ============================================
   CATEGORY HERO BANNER (Background Image)
   ============================================ */
.path-course-index #page-header {
    position: relative;
    background: url([[pix:theme|hero-bg]]) center/cover no-repeat;
    padding: 80px 20px 60px;
    margin: -20px -15px 30px -15px;
    text-align: center;
    border-bottom: none;
}
.path-course-index #page-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 58, 95, 0.70); /* Dark blue overlay */
}
.path-course-index #page-header .page-context-header,
.path-course-index #page-header h1,
.path-course-index #page-header .text-muted {
    position: relative;
    z-index: 1;
    color: #fff !important;
}
.path-course-index #page-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
/* Breadcrumb on hero */
.path-course-index #page-header .breadcrumb {
    position: relative;
    z-index: 1;
    background: transparent;
    padding: 0;
    margin-bottom: 10px;
    justify-content: center;
}
.path-course-index #page-header .breadcrumb-item a,
.path-course-index #page-header .breadcrumb-item.active {
    color: rgba(255,255,255,0.9) !important;
}
.path-course-index #page-header .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255,255,255,0.6);
}

/* ============================================
   CARD GRID
   ============================================ */
.course-card-grid {
    margin-top: 1.5rem;

    .courses {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;

        @media (max-width: 768px) {
            grid-template-columns: 1fr;
        }
    }

    /* Force IDENTICAL background on ALL cards (fixes left/right mismatch) */
    .coursebox {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        transition: box-shadow 0.2s ease, transform 0.2s ease;
        overflow: hidden;

        &:hover {
            box-shadow: 0 6px 16px rgba(0,0,0,0.12) !important;
            transform: translateY(-2px);
        }

        /* Kill default Moodle inner elements */
        .info,
        .content,
        .moreinfo,
        .teachers {
            display: none !important;
        }
    }
}

/* ============================================
   INDIVIDUAL CARD
   ============================================ */
.course-card-item {
    display: flex;
    flex-direction: row;
    height: 100%;
    min-height: 180px;
    background: #fff; /* Ensure inner wrapper is also white */

    @media (max-width: 576px) {
        flex-direction: column;
    }
}

/* Left: Image */
.course-card-image {
    flex: 0 0 40%;
    max-width: 250px;
    overflow: hidden;
    background: #f5f5f5;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    @media (max-width: 576px) {
        flex: none;
        max-width: 100%;
        height: 160px;
    }
}

/* Right: Content */
.course-card-body {
    flex: 1;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative; /* For lock icon */
    background: #fff; /* Explicit white */
}

/* ============================================
   LOCK ICON (Non-enrolled courses)
   ============================================ */
.course-lock-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;

    .course-lock-icon {
        font-size: 1rem;
        color: #666;
        background: rgba(255,255,255,0.95);
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    }
}

.course-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    padding-right: 35px; /* Prevent overlap with lock */

    a {
        color: #1a1a1a;
        text-decoration: none;

        &:hover {
            color: #0056b3;
        }
    }
}

.course-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: #666;

    .course-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;

        .icon {
            color: #888;
        }
    }
}

.course-card-summary {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   BUTTON (Consistent solid style)
   ============================================ */
.course-card-action {
    margin-top: auto;

    .btn {
        padding: 0.5rem 1.25rem;
        font-size: 0.875rem;
        font-weight: 500;
        border-radius: 4px;
        border: none;
    }

    .btn-primary {
        background-color: #1e3a5f;
        border-color: #1e3a5f;
        color: #fff;

        &:hover {
            background-color: #152a45;
            border-color: #152a45;
        }
    }
}