/* CL Dashboard Layout */
#cl-dashboard-wrapper {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 80vh;
    gap: 0;
}

/* Sidebar */
.cl-dashboard-sidebar {
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    padding: 30px 20px;
}

.cl-dashboard-menu-item {
    display: block;
    padding: 12px 15px;
    margin-bottom: 8px;
    color: #000;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.cl-dashboard-menu-item:hover {
    background-color: #f0f4f8;
    color: #333;
}

.cl-dashboard-menu-item.active {
    background-color: #e3f2fd;
    color: #0a2838;
    font-weight: 600;
}

/* Content Area */
.cl-dashboard-content {
    padding: 40px;
}

.cl-dashboard-view {
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cl-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

/* --- Course Grid Redesign (Main View) --- */
.cl-dashboard-courses-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 25px;
    margin-top: 20px;
}

/* Resetta eventuali vecchi stili flex */
.cl-dashboard-mini-list {
    display: block;
    white-space: normal;
}

.cl-dashboard-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cl-dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.cl-dashboard-card-header {
    height: 180px;
    position: relative;
    overflow: hidden;
}

.cl-dashboard-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.cl-dashboard-card:hover .cl-dashboard-card-img {
    transform: scale(1.05);
}

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

.cl-dashboard-course-title {
    font-size: 16px;
    font-weight: bold;
    color: #000;
    margin: 0 0 10px 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cl-dashboard-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.cl-dashboard-badge.is-enrolled {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.cl-dashboard-badge.not-enrolled {
    background-color: #f5f5f5;
    color: #757575;
}

.cl-dashboard-card-actions {
    margin-top: auto;
    padding-top: 15px;
    display: flex;
    gap: 10px;
}

.cl-dashboard-btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: background 0.2s;
    cursor: pointer;
    flex: 1;
}

.cl-dashboard-btn-primary {
    background-color: #0a2838;
    color: #fff;
    border: 1px solid #0a2838;
}

.cl-dashboard-btn-primary:hover {
    background-color: #f5c140;
    border-color: #f5c140;
    color: #000;
}

.cl-dashboard-btn-outline {
    background-color: #0a2838;
    color: white;
    border: 1px solid #0a2838;
}

.cl-dashboard-btn-outline:hover {
    border-color: #f5c140;
    color: #000;
    background-color: #f5c140;
}

.cl-dashboard-btn-buy {
    background-color: #f5c140;
    color: black;
    border: 1px solid #f5c140;
}

.cl-dashboard-btn-buy:hover {
    background-color: #0a2838;
    color: white;
}

/* --- Mini Vertical Grid (Overview Blocks) --- */
.cl-dashboard-vertical-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    padding-right: 5px;
    box-sizing: border-box;
}

/* Stilizzazione Scrollbar (Chrome/Safari) */
.cl-dashboard-vertical-grid::-webkit-scrollbar {
    width: 6px;
}

.cl-dashboard-vertical-grid::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.cl-dashboard-mini-item {
    text-align: center;
    position: relative;
    transition: transform 0.2s;
}

.cl-dashboard-mini-item:hover {
    transform: translateY(-2px);
}

/* Mobile Toggle (Hidden on Desktop) */
#cl-dashboard-mobile-toggle {
    display: none;
    background: #333;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 20px;
    /* Space for content below if relative */
    font-size: 16px;
    align-items: center;
    gap: 8px;
}

/* Sidebar Overlay (Hidden by default) */
.cl-dashboard-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Mobile Responsive */
@media (max-width: 992px) {
    #cl-dashboard-wrapper {
        grid-template-columns: 1fr;
        position: relative;
    }

    #cl-dashboard-mobile-toggle {
        display: inline-flex;
        /* Show toggle */
    }

    /* 1. Blocchi uno sotto l'altro (Singola Colonna) */
    .cl-dashboard-grid {
        grid-template-columns: 1fr !important;
        /* Forza 1 colonna */
    }

    /* 2. Rimuovi lo span delle colonne per sicurezza */
    .cl-dashboard-block {
        grid-column: span 1 !important;
    }

    /* Off-Canvas Sidebar */
    .cl-dashboard-sidebar {
        position: fixed !important;
        left: -100% !important;
        /* Nascosta a sinistra */
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 99999 !important;
        /* Sopra a tutto (Header Astra compreso) */
        background: #fff;
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        display: block !important;
    }

    /* Classe attiva aggiunta dal JS */
    .cl-dashboard-sidebar.cl-dashboard-sidebar-active {
        left: 0 !important;
        /* Mostra sidebar */
    }

    /* 2. Layout Dashboard a 1 colonna */
    #cl-dashboard-wrapper {
        display: block !important;
        /* Rimuove grid laterale */
    }

    /* Mostra il bottone Menu */
    #cl-dashboard-mobile-toggle {
        display: inline-flex !important;
        margin: 20px;
    }

    /* Overlay scuro */
    .cl-dashboard-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99998;
        /* Subito sotto la sidebar */
    }

    .cl-dashboard-sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 768px) {

    /* Switch Mini Grid to 2 columns on small screens */
    .cl-dashboard-vertical-grid {
        /* MOBILE: Esattamente 2 colonne per leggibilità */
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .cl-dashboard-courses-grid {
        grid-template-columns: 1fr;
    }
}
/* Profile Tabs */
.cl-profile-tab-btn.active {
    background-color: #e3f2fd !important;
    color: #0a2838 !important;
    border-bottom: 3px solid #0a2838 !important;
}
.cl-profile-tab-btn:hover {
    background-color: #f1f1f1 !important;
}

/* Address Forms */
.cl-address-edit-form { border: 1px solid #eee; padding: 20px; border-radius: 8px; margin-top: 20px; }

/* Modal */
.cl-modal-content { box-shadow: 0 5px 20px rgba(0,0,0,0.2); }

/* Dashboard Address Layout Fix */
#cl-addresses-view .u-columns { display: flex; gap: 30px; justify-content: space-between; flex-wrap: wrap; }
#cl-addresses-view .woocommerce-Address { width: 48%; min-width: 300px; flex: 1; }
.cl-address-read-only-container { width: 100%; }
/* Ensure inputs are visible */
.cl-wc-form-wrapper input[type='text'], .cl-wc-form-wrapper input[type='email'] { color: #333 !important; background: #fff !important; }

/* --- UNIVERSAL LOCKED COURSE STYLES (Cards & Mini Blocks) --- */

/* 1. Wrapper Grayscale Logic */
.cl-locked-course img {
    filter: grayscale(100%);
    opacity: 0.8;
    transition: all 0.4s ease;
}

/* 2. Color on Hover (Unlock Effect) */
/* Supporta sia la card grande che il mini item */
.cl-dashboard-card:hover .cl-locked-course img,
.cl-dashboard-mini-item:hover .cl-locked-course img {
    filter: none;
    opacity: 1;
}

/* 3. Lock Overlay (Il velo scuro) */
.cl-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    /* Sfondo scuro coerente */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    pointer-events: none;
    z-index: 10;
}

/* 4. Remove dark overlay on hover */
.cl-dashboard-card:hover .cl-lock-overlay,
.cl-dashboard-mini-item:hover .cl-lock-overlay {
    background: rgba(0, 0, 0, 0.1);
    /* Diventa quasi trasparente */
}

/* 5. Lock Icon Style */
.cl-lock-overlay i {
    font-size: 24px;
    /* Un po' più piccola per i mini box */
    color: #f5c140;
    /* Giallo Brand */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Adatta dimensione icona per le card grandi */
.cl-dashboard-card .cl-lock-overlay i {
    font-size: 32px;
}

/* 6. Lock Icon Hover Animation */
.cl-dashboard-card:hover .cl-lock-overlay i,
.cl-dashboard-mini-item:hover .cl-lock-overlay i {
    transform: scale(1.2);
}

/* Change icon to open lock on hover */
.cl-dashboard-card:hover .cl-lock-overlay i:before,
.cl-dashboard-mini-item:hover .cl-lock-overlay i:before {
    content: "\f3c1";
    /* FontAwesome lock-open */
}