<?php
// app/view/admin/pedagogie/semestre/view/index.php
// Modal de visualisation des détails d'un semestre
?>

<!-- Detail Modal - Semestre -->
<div id="detailModal" class="modal-overlay">
    <div class="modal-content" style="max-width: 750px;">
        <div class="modal-header">
            <h2><i class="fas fa-calendar-alt" style="color: #27ae60;"></i> Détails du Semestre</h2>
            <button type="button" class="modal-close" onclick="closeDetailModal()">&times;</button>
        </div>
        <div class="modal-body">
            <div id="detailContent">
                <div class="loading active">
                    <div class="spinner"></div>
                    <p style="margin-top: 10px;">Chargement des détails...</p>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-secondary" onclick="closeDetailModal()">
                <i class="fas fa-times"></i> Fermer
            </button>
            <button type="button" class="btn btn-warning" id="editFromDetailBtn" onclick="editFromDetail()" style="display:none;">
                <i class="fas fa-edit"></i> Modifier
            </button>
        </div>
    </div>
</div>

<style>
    /* Styles pour le modal de détail */
    .detail-section {
        padding: 5px 0;
    }

    .detail-header {
        display: flex;
        align-items: center;
        gap: 20px;
        padding: 15px 20px;
        background: linear-gradient(135deg, #f8f9fa, #e9ecef);
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .detail-avatar {
        width: 70px;
        height: 70px;
        border-radius: 50%;
        background: linear-gradient(135deg, #27ae60, #2ecc71);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 30px;
        color: white;
        flex-shrink: 0;
        box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    }

    .detail-title {
        flex: 1;
    }

    .detail-title h2 {
        margin: 0 0 8px 0;
        font-size: 22px;
        color: #2c3e50;
    }

    .detail-meta {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    .detail-meta .badge {
        padding: 5px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
    }

    .badge-info {
        background: #d1ecf1;
        color: #0c5460;
    }

    .badge-success {
        background: #d4edda;
        color: #155724;
    }

    .badge-warning {
        background: #fff3cd;
        color: #856404;
    }

    .badge-danger {
        background: #f8d7da;
        color: #721c24;
    }

    .badge-primary {
        background: #cce5ff;
        color: #004085;
    }

    .detail-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .detail-item {
        display: flex;
        flex-direction: column;
        padding: 10px 15px;
        background: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #e9ecef;
        transition: all 0.2s ease;
    }

    .detail-item:hover {
        background: #f0f2f5;
        border-color: #27ae60;
    }

    .detail-item .label {
        font-size: 11px;
        font-weight: 600;
        color: #7f8c8d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 4px;
    }

    .detail-item .value {
        font-size: 15px;
        font-weight: 500;
        color: #2c3e50;
        word-break: break-word;
    }

    .detail-item.full-width {
        grid-column: 1 / -1;
    }

    .detail-item .badge {
        font-size: 13px;
        padding: 4px 12px;
        border-radius: 20px;
    }

    /* Stats miniatures */
    .detail-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 2px dashed #e9ecef;
    }

    .detail-stat-item {
        text-align: center;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 8px;
        border: 1px solid #e9ecef;
    }

    .detail-stat-item .stat-number {
        font-size: 24px;
        font-weight: 700;
        color: #27ae60;
        display: block;
    }

    .detail-stat-item .stat-label {
        font-size: 12px;
        color: #7f8c8d;
        margin-top: 4px;
    }

    /* Responsive */
    @media (max-width: 768px) {
        .detail-grid {
            grid-template-columns: 1fr;
        }

        .detail-header {
            flex-direction: column;
            text-align: center;
        }

        .detail-meta {
            justify-content: center;
        }

        .detail-stats {
            grid-template-columns: 1fr 1fr;
        }
    }

    @media (max-width: 480px) {
        .detail-stats {
            grid-template-columns: 1fr;
        }

        .modal-content {
            max-width: 95% !important;
            margin: 10px;
        }
    }
</style>