/**
 * Dashboard Corsi v2.2 - Box Compatti con Ribbon Diagonale a Sinistra
 */

:root {
    --dept-classico: #1d4ed8;
    --dept-moderno: #9333ea;
    --dept-bandistico: #0284c7;
    --dept-infanzia: #ea580c;

    --smc-soldout-bg: #dc2626;
    --smc-ultimo-bg: #f97316;
    --smc-bassa-bg: #eab308;
    --smc-alta-bg: #16a34a;
}

.smc-panel-wrapper {
    width: 100%;
    margin: 1.5rem 0;
    font-family: inherit;
    box-sizing: border-box;
}

/* 1. Barra Filtri */
.smc-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.smc-filter-btn {
    border: 2px solid transparent;
    background: rgba(0, 0, 0, 0.05);
    color: inherit;
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.smc-filter-btn.active {
    background: #1e293b;
    color: #fff;
}

.smc-filter-btn.filter-classico { border-color: var(--dept-classico); }
.smc-filter-btn.filter-moderno { border-color: var(--dept-moderno); }
.smc-filter-btn.filter-bandistico { border-color: var(--dept-bandistico); }
.smc-filter-btn.filter-infanzia { border-color: var(--dept-infanzia); }

/* 2. Griglia Box più Piccoli */
.smc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.2rem;
}

/* 3. Card Compatta con Immagine di Sfondo */
.smc-card {
    position: relative;
    border-radius: 12px;
    border: 3px solid rgba(0, 0, 0, 0.08);
    background-size: cover;
    background-position: center;
    background-color: #f8fafc;
    min-height: 180px;
    overflow: hidden; /* Fondamentale per ritagliare il nastro diagonale */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.smc-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

/* Colori bordo dipartimento */
.smc-card.dept-classico { border-color: var(--dept-classico); }
.smc-card.dept-moderno { border-color: var(--dept-moderno); }
.smc-card.dept-bandistico { border-color: var(--dept-bandistico); }
.smc-card.dept-infanzia { border-color: var(--dept-infanzia); }

/* Overlay sfumato per garantire leggibilità perfetta */
.smc-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0.96) 65%);
    z-index: 1;
}

/* 4. Nastro Diagonale a Sinistra (Ribbon a 45°) */
.smc-ribbon-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 95px;
    height: 95px;
    overflow: hidden;
    z-index: 3;
    pointer-events: none;
}

.smc-ribbon {
    position: absolute;
    display: block;
    width: 140px;
    padding: 4px 0;
    top: 20px;
    left: -38px;
    transform: rotate(-45deg);
    text-align: center;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.smc-ribbon.ribbon-soldout { background-color: var(--smc-soldout-bg); }
.smc-ribbon.ribbon-ultimo { background-color: var(--smc-ultimo-bg); }
.smc-ribbon.ribbon-bassa { background-color: var(--smc-bassa-bg); color: #1e293b !important; }
.smc-ribbon.ribbon-alta { background-color: var(--smc-alta-bg); }

/* 5. Contenuto Interno Card */
.smc-card-content {
    position: relative;
    z-index: 2;
    padding: 1.1rem 1rem 0.9rem 1rem;
    display: flex;
    flex-direction: column;
}

.smc-dept-label {
    align-self: flex-end; /* Allineato a destra per non toccare il nastro */
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.dept-classico .smc-dept-label { color: var(--dept-classico); }
.dept-moderno .smc-dept-label { color: var(--dept-moderno); }
.dept-bandistico .smc-dept-label { color: var(--dept-bandistico); }
.dept-infanzia .smc-dept-label { color: var(--dept-infanzia); }

.smc-course-title {
    margin: 0.2rem 0 0.8rem 0;
    font-size: 1.15rem;
    line-height: 1.25;
    font-weight: 700;
    color: inherit;
}

/* 6. Pulsanti e Azioni */
.smc-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.smc-link-btn {
    border: none;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.55rem;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.07);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.2s ease;
}

.smc-link-btn:hover {
    background: rgba(0, 0, 0, 0.14);
    text-decoration: none;
}

/* Pulsante Iscrizione */
.smc-link-btn.btn-iscrizione {
    background: #0f172a;
    color: #fff !important;
}

.smc-link-btn.btn-iscrizione:hover {
    background: #334155;
}

.smc-link-btn.btn-iscrizione.disabled {
    background: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 7. Popup Modale Docenti */
.smc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.smc-modal-box {
    background: #fff;
    width: 100%;
    max-width: 720px;
    height: 80vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.smc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.smc-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #1e293b;
}

.smc-modal-close {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    color: #64748b;
}

.smc-modal-body {
    flex: 1;
    width: 100%;
}

.smc-modal-body iframe {
    width: 100%;
    height: 100%;
    display: block;
}