/* public/css/style.css */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f8;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container { max-width: 900px; margin: 0 auto; padding: 20px; }
.container-small { max-width: 400px; margin: 80px auto; } /* Centrato verticalmente */

.form-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; }
.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
    border: none;
}
.btn-success { background-color: #28a745; color: white; }
.btn-success:hover { background-color: #218838; }

.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
a { color: #007bff; text-decoration: none; }

/* --- CLASSROOM PLAYER --- */

/* Layout a due colonne */
.classroom-container {
    display: flex;
    height: 100vh; /* Occupa tutta l'altezza */
    overflow: hidden; /* Niente scroll sulla pagina principale */
}

/* Sidebar (Navigazione) */
.classroom-sidebar {
    width: 300px;
    background-color: #fff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.sidebar-content {
    flex-grow: 1;
    overflow-y: auto; /* Scroll solo qui se la lista è lunga */
    padding: 10px 0;
}

/* Elementi Sidebar */
.module-header {
    padding: 10px 20px;
    background: #f1f3f5;
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
    text-transform: uppercase;
    border-bottom: 1px solid #eee;
    margin-top: 10px;
}

.sidebar-lesson {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.95em;
    transition: background 0.2s;
}

.sidebar-lesson:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #007bff;
}

.sidebar-lesson.active {
    background-color: #e7f1ff;
    border-left: 4px solid #007bff;
    color: #007bff;
    font-weight: 600;
}

.lesson-type-icon { margin-right: 8px; }

/* Area Contenuto Principale */
.classroom-main {
    flex-grow: 1;
    overflow-y: auto; /* Scroll indipendente */
    padding: 40px;
    background-color: #fff;
}

.lesson-content-box {
    max-width: 800px;
    margin: 0 auto;
}

.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
    margin-bottom: 30px;
}

.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Responsive per mobile */
@media (max-width: 768px) {
    .classroom-container { flex-direction: column; height: auto; }
    .classroom-sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid #ddd; }
    .classroom-main { height: auto; padding: 20px; }
}

/* =========================================
   10. APP SHELL (LAYOUT DASHBOARD)
   ========================================= */
   
/* Rimuoviamo margini dal body per il full screen */
body.dashboard-mode {
    background-color: #f4f6f8;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR (Menu Laterale) */
.app-sidebar {
    width: 260px;
    background-color: #2c3e50; /* Colore scuro professionale */
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s;
}

.sidebar-brand {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 1.2em;
    font-weight: bold;
    background-color: #1a252f;
    color: white;
    border-bottom: 1px solid #34495e;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: block;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background-color: #34495e;
    color: #fff;
    border-left-color: #007bff; /* Accento Blu */
}

.sidebar-icon {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    display: inline-block;
}

.user-mini-profile {
    padding: 20px;
    background-color: #1a252f;
    border-top: 1px solid #34495e;
    font-size: 0.9em;
}
.user-mini-profile small { color: #7f8c8d; display: block; margin-top: 2px; }

/* MAIN CONTENT AREA */
.app-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.app-header {
    height: 60px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.app-content-scroll {
    flex-grow: 1;
    overflow-y: auto; /* Lo scroll avviene qui dentro */
    padding: 30px;
}

/* Responsive Mobile */
@media (max-width: 768px) {
    body.dashboard-mode { flex-direction: column; height: auto; overflow: auto; }
    .app-sidebar { width: 100%; height: auto; }
    .sidebar-menu { display: flex; overflow-x: auto; padding: 0; }
    .sidebar-menu li a { padding: 15px; white-space: nowrap; border-left: none; border-bottom: 4px solid transparent; }
    .sidebar-menu li a:hover, .sidebar-menu li a.active { border-left: none; border-bottom-color: #007bff; }
    .user-mini-profile { display: none; }
}

/* --- Input Group (per Permalink) --- */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    text-align: center;
    white-space: nowrap;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-right: 0;
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.input-group .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    margin-bottom: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    /* Se c'è un bottone dopo */
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-btn {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-left: 0;
    color: #333;
    cursor: pointer;
    padding: 0 15px;
    border-top-right-radius: 0.25rem;
    border-bottom-right-radius: 0.25rem;
    font-size: 0.9em;
    transition: background 0.2s;
}
.input-group-btn:hover {
    background-color: #dbe2e8;
}

/* --- Flash Messages / Alerts --- */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* --- DASHBOARD WIDGETS (Stile WP) --- */

/* Griglia per i KPI in alto */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    border-left: 5px solid #007bff; /* Default Blue */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stat-card.green { border-left-color: #28a745; }
.stat-card.purple { border-left-color: #6f42c1; }
.stat-card.orange { border-left-color: #fd7e14; }

.stat-number { font-size: 2rem; font-weight: 700; color: #333; line-height: 1; }
.stat-label { color: #666; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 5px; display: block; }
.stat-icon { font-size: 2rem; opacity: 0.2; }

/* Griglia per i Widget Grandi (Tabelle) */
.widgets-row {
    display: grid;
    grid-template-columns: 2fr 1fr; /* 2/3 per i corsi, 1/3 per utenti */
    gap: 20px;
}

/* Liste nei Widget */
.widget-list { list-style: none; padding: 0; margin: 0; }
.widget-list li {
    padding: 12px 0;
    border-bottom: 1px solid #f1f1f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
}
.widget-list li:last-child { border-bottom: none; }
.widget-user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; margin-right: 10px; vertical-align: middle; }

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

/* --- SEPARATORI DI SEZIONE DASHBOARD --- */
.section-title {
    font-size: 1.1rem;
    text-transform: uppercase;
    color: #6c757d;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 40px 0 15px 0;
    padding-left: 5px;
    border-left: 4px solid #007bff; /* Accento blu */
    line-height: 1;
}

/* Rendi le card leggermente più "profonde" */
.card {
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.04);
    border: 1px solid #e1e4e8;
    transition: transform 0.2s;
    padding: 20px;
}
/* .card:hover { transform: translateY(-2px); } */ /* Opzionale: effetto hover */

/* --- STILE GRID & CARDS (Frontend) --- */

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.public-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%; /* Altezze uguali */
}

.public-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.card-img {
    height: 180px;
    background-color: #eee;
    background-position: center;
    background-size: cover;
    transition: opacity 0.2s;
}
.card-img:hover { opacity: 0.9; }

.card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.course-cat-badge {
    font-size: 0.75em;
    text-transform: uppercase;
    color: #007bff;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: inline-block; /* Importante per i link */
    text-decoration: none;
    transition: color 0.2s;
}

.course-cat-badge:hover {
    color: #0056b3;
    text-decoration: underline;
}

.card-title {
    font-size: 1.2em;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #2c3e50;
    line-height: 1.3;
}

.card-desc {
    font-size: 0.95em;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    flex-grow: 1;
}

.card-footer {
    border-top: 1px solid #f0f0f0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
    margin-top: auto;
}

.author {
    font-size: 0.85em;
    color: #888;
    font-weight: 500;
}