/**
 * Styles pour l'interface des cours étudiants
 * Design moderne et professionnel
 * 
 * @package Soft_Academia_SM
 * @since 1.0.0
 */

/* ========================================
   Variables CSS
   ======================================== */
:root {
    --saspm-primary: #4f46e5;
    --saspm-primary-dark: #4338ca;
    --saspm-success: #10b981;
    --saspm-warning: #f59e0b;
    --saspm-danger: #ef4444;
    --saspm-info: #3b82f6;
    --saspm-gray-50: #f9fafb;
    --saspm-gray-100: #f3f4f6;
    --saspm-gray-200: #e5e7eb;
    --saspm-gray-500: #6b7280;
    --saspm-gray-700: #374151;
    --saspm-gray-900: #111827;
    --saspm-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --saspm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --saspm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ========================================
   Container principal
   ======================================== */
.saspm-courses-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* ========================================
   En-tête
   ======================================== */
.saspm-courses-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, var(--saspm-primary) 0%, var(--saspm-primary-dark) 100%);
    border-radius: 16px;
    box-shadow: var(--saspm-shadow-lg);
    color: #ffffff;
}

.saspm-courses-header-info h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.saspm-courses-header-info .dashicons {
    width: 36px;
    height: 36px;
    font-size: 36px;
}

.saspm-courses-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
}

.saspm-courses-stats {
    display: flex;
    gap: 20px;
}

.saspm-stat-box {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.saspm-stat-number {
    display: block;
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 8px;
}

.saspm-stat-label {
    display: block;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* ========================================
   Filtres
   ======================================== */
.saspm-courses-filters {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--saspm-shadow);
    margin-bottom: 30px;
}

.saspm-filter-form {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.saspm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.saspm-search-group {
    flex: 1;
    min-width: 250px;
}

.saspm-filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--saspm-gray-700);
}

.saspm-filter-group select,
.saspm-filter-group input[type="text"] {
    height: 42px;
    padding: 0 16px;
    border: 2px solid var(--saspm-gray-200);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.saspm-filter-group select:focus,
.saspm-filter-group input[type="text"]:focus {
    outline: none;
    border-color: var(--saspm-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.saspm-filter-actions {
    display: flex;
    gap: 10px;
}

.saspm-filter-actions .button {
    height: 42px;
    padding: 0 24px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.saspm-filter-actions .button-primary {
    background: var(--saspm-primary);
    border-color: var(--saspm-primary);
    box-shadow: var(--saspm-shadow);
}

.saspm-filter-actions .button-primary:hover {
    background: var(--saspm-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--saspm-shadow-md);
}

/* ========================================
   Grille de cours
   ======================================== */
.saspm-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* ========================================
   Carte de cours
   ======================================== */
.saspm-course-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--saspm-shadow);
    border: 2px solid var(--saspm-gray-100);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.saspm-course-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--saspm-primary), var(--saspm-info));
}

.saspm-course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--saspm-shadow-lg);
    border-color: var(--saspm-primary);
}

.saspm-course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.saspm-course-code {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(79, 70, 229, 0.05));
    color: var(--saspm-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.saspm-course-credits {
    background: linear-gradient(135deg, var(--saspm-success), #059669);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 12px;
}

.saspm-course-title {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--saspm-gray-900);
    line-height: 1.3;
    min-height: 52px;
}

.saspm-course-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--saspm-gray-500);
    font-size: 14px;
}

.saspm-course-teacher,
.saspm-course-hours {
    display: flex;
    align-items: center;
    gap: 6px;
}

.saspm-course-meta .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
    color: var(--saspm-primary);
}

.saspm-course-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    margin-top: auto;
}

.saspm-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.saspm-tag-promotion {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.saspm-tag-semestre {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.saspm-course-actions {
    margin-top: 20px;
}

.saspm-view-course-btn {
    width: 100%;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--saspm-primary);
    border: none;
    color: #ffffff;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.saspm-view-course-btn:hover {
    background: var(--saspm-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--saspm-shadow-md);
}

/* ========================================
   État vide
   ======================================== */
.saspm-courses-empty {
    text-align: center;
    padding: 80px 20px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: var(--saspm-shadow);
}

.saspm-empty-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--saspm-gray-100), var(--saspm-gray-50));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--saspm-gray-200);
}

.saspm-empty-icon .dashicons {
    width: 64px;
    height: 64px;
    font-size: 64px;
    color: var(--saspm-gray-500);
}

.saspm-courses-empty h3 {
    font-size: 24px;
    color: var(--saspm-gray-900);
    margin-bottom: 12px;
}

.saspm-courses-empty p {
    font-size: 16px;
    color: var(--saspm-gray-500);
}

/* ========================================
   Modal
   ======================================== */
.saspm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
}

.saspm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.saspm-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.saspm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    background: linear-gradient(135deg, var(--saspm-primary) 0%, var(--saspm-primary-dark) 100%);
    color: #ffffff;
}

.saspm-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.saspm-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.saspm-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.saspm-modal-close .dashicons {
    width: 24px;
    height: 24px;
    font-size: 24px;
    color: #ffffff;
}

.saspm-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.saspm-loading {
    text-align: center;
    padding: 40px;
    color: var(--saspm-gray-500);
}

.saspm-loading .dashicons {
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Détails du cours dans le modal
   ======================================== */
.saspm-course-detail-section {
    margin-bottom: 30px;
}

.saspm-course-detail-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--saspm-gray-900);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.saspm-course-detail-section h3 .dashicons {
    color: var(--saspm-primary);
}

.saspm-course-description {
    line-height: 1.8;
    color: var(--saspm-gray-700);
}

.saspm-objectives-list {
    list-style: none;
    padding: 0;
}

.saspm-objectives-list li {
    padding: 12px 16px;
    margin-bottom: 10px;
    background: var(--saspm-gray-50);
    border-left: 4px solid var(--saspm-primary);
    border-radius: 6px;
}

.saspm-bibliography-text {
    background: var(--saspm-gray-50);
    padding: 20px;
    border-radius: 8px;
    white-space: pre-line;
    line-height: 1.8;
}

.saspm-resources-list {
    display: grid;
    gap: 12px;
}

.saspm-resource-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--saspm-gray-50);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.saspm-resource-item:hover {
    background: var(--saspm-gray-100);
    box-shadow: var(--saspm-shadow);
}

.saspm-resource-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(79, 70, 229, 0.05));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.saspm-resource-icon .dashicons {
    width: 24px;
    height: 24px;
    font-size: 24px;
    color: var(--saspm-primary);
}

.saspm-resource-info {
    flex: 1;
}

.saspm-resource-name {
    font-weight: 600;
    color: var(--saspm-gray-900);
    margin-bottom: 4px;
}

.saspm-resource-size {
    font-size: 13px;
    color: var(--saspm-gray-500);
}

.saspm-resource-download {
    padding: 8px 20px;
    background: var(--saspm-primary);
    color: #ffffff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.saspm-resource-download:hover {
    background: var(--saspm-primary-dark);
    color: #ffffff;
}

.saspm-links-list {
    display: grid;
    gap: 10px;
}

.saspm-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--saspm-gray-50);
    border-radius: 6px;
}

.saspm-link-item .dashicons {
    color: var(--saspm-primary);
}

.saspm-link-item a {
    color: var(--saspm-primary);
    text-decoration: none;
    font-weight: 500;
}

.saspm-link-item a:hover {
    text-decoration: underline;
}

/* ========================================
   Responsive Design
   ======================================== */
@media screen and (max-width: 768px) {
    .saspm-courses-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .saspm-courses-stats {
        width: 100%;
        justify-content: center;
    }

    .saspm-filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .saspm-filter-group,
    .saspm-search-group {
        width: 100%;
        min-width: auto;
    }

    .saspm-filter-actions {
        width: 100%;
    }

    .saspm-filter-actions .button {
        flex: 1;
    }

    .saspm-courses-grid {
        grid-template-columns: 1fr;
    }

    .saspm-modal-content {
        width: 95%;
        max-height: 95vh;
    }
}
