/* S60 Moodle — Course Layout */

.s60-moodle-course-layout {
    display: flex;
    gap: 2rem;
    min-height: 60vh;
}

/* Sidebar */
.s60-moodle-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
    padding-right: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
    position: sticky;
    top: 1rem;
}

.s60-moodle-sections-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.s60-moodle-section-item {
    margin-bottom: 2px;
}

.s60-moodle-section-item a {
    display: block;
    padding: 0.6rem 0.8rem;
    color: #334155;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
}

.s60-moodle-section-item a:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.s60-moodle-section-item.s60-active a {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

/* Content area */
.s60-moodle-content-area {
    flex: 1;
    min-width: 0;
}

.s60-moodle-section-content.s60-hidden {
    display: none;
}

.s60-moodle-section-title {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.s60-moodle-section-summary {
    margin-bottom: 1.5rem;
    color: #475569;
}

/* Modules */
.s60-moodle-module {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.s60-moodle-module:last-child {
    border-bottom: none;
}

.s60-moodle-module-title {
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

.s60-moodle-module-desc {
    color: #475569;
    line-height: 1.6;
}

.s60-moodle-module-desc img,
.s60-moodle-image {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
}

.s60-moodle-file-link,
.s60-moodle-url-link,
.s60-moodle-fallback-link {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #1d4ed8;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.s60-moodle-file-link:hover,
.s60-moodle-url-link:hover,
.s60-moodle-fallback-link:hover {
    background: #eff6ff;
}

.s60-moodle-label {
    line-height: 1.6;
}

/* Sidebar right variant (Bricks option) */
.s60-moodle-course-layout.s60-sidebar-right {
    flex-direction: row-reverse;
}

.s60-moodle-course-layout.s60-sidebar-right .s60-moodle-sidebar {
    border-right: none;
    border-left: 1px solid #e2e8f0;
    padding-right: 0;
    padding-left: 1.5rem;
}

/* Error page */
.s60-moodle-load-error {
    text-align: center;
    padding: 3rem 2rem;
    background: #fafafa;
    border-radius: 12px;
    max-width: 480px;
    margin: 2rem auto;
}

.s60-moodle-error-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.s60-moodle-load-error h2 {
    font-size: 1.3rem;
    margin: 0 0 0.5rem;
    color: #1e293b;
}

.s60-moodle-load-error p {
    color: #64748b;
    margin: 0 0 1.5rem;
}

.s60-moodle-error-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.s60-moodle-retry-btn,
.s60-moodle-contact-btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
}

.s60-moodle-retry-btn {
    background: #1d4ed8;
    color: #fff;
}

.s60-moodle-retry-btn:hover {
    background: #1e40af;
}

.s60-moodle-contact-btn {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.s60-moodle-contact-btn:hover {
    background: #e2e8f0;
}

/* Prev/Next navigation */
.s60-moodle-section-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    gap: 1rem;
}

.s60-moodle-nav-prev,
.s60-moodle-nav-next {
    display: inline-block;
    padding: 0.6rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #334155;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.s60-moodle-nav-prev:hover,
.s60-moodle-nav-next:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.s60-moodle-nav-next {
    margin-left: auto;
}

.s60-moodle-nav-placeholder {
    flex: 1;
}

/* Hamburger toggle */
.s60-moodle-nav-toggle {
    display: none;
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
    margin-bottom: 1rem;
}

/* Login required */
.s60-moodle-login-required {
    text-align: center;
    padding: 3rem;
    background: #f8fafc;
    border-radius: 8px;
}

.s60-moodle-login-required a {
    color: #1d4ed8;
    font-weight: 600;
}

/* Error */
.s60-moodle-error {
    color: #dc2626;
    background: #fef2f2;
    padding: 1rem;
    border-radius: 6px;
}

/* Courses grid (shortcode) */
.s60-moodle-courses {
    margin: 1.5rem 0;
}

.s60-moodle-course-card a {
    color: inherit;
    text-decoration: none;
}

.s60-moodle-course-card a:hover {
    color: #1d4ed8;
}

/* Mobile */
@media (max-width: 768px) {
    .s60-moodle-course-layout {
        flex-direction: column;
    }

    .s60-moodle-nav-toggle {
        display: block;
    }

    .s60-moodle-sidebar {
        display: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding-right: 0;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .s60-moodle-sidebar.s60-open {
        display: block;
    }

    .s60-moodle-courses {
        grid-template-columns: 1fr !important;
    }
}

/* Course list — categories */
.s60-moodle-courses-group {
    margin-bottom: 2rem;
}

.s60-moodle-courses-group-title {
    font-size: 1.3rem;
    margin: 0 0 1rem;
}

.s60-moodle-courses-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

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