/* ========================================
   CURSOS LMS - DASHBOARD V2
   Layout moderno com sidebar
   ======================================== */

.cursos-lms-dashboard-v2 {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body:has(.cursos-lms-dashboard-v2:not(.cursos-lms-dashboard-admin)) .elementor-widget-shortcode,
body:has(.cursos-lms-dashboard-v2:not(.cursos-lms-dashboard-admin)) .elementor-widget-shortcode > .elementor-widget-container,
body:has(.cursos-lms-dashboard-v2:not(.cursos-lms-dashboard-admin)) .entry-content,
body:has(.cursos-lms-dashboard-v2:not(.cursos-lms-dashboard-admin)) .site-content,
body:has(.cursos-lms-dashboard-v2:not(.cursos-lms-dashboard-admin)) #main {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ========================================
   SIDEBAR
   ======================================== */
.dashboard-sidebar {
    width: 280px;
    background: #fff;
    border-right: none;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow: hidden;
}

.sidebar-user {
    padding: 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

.user-info h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.user-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Neutraliza wrappers automáticos (wpautop/Elementor) que criam espaços extras */
.cursos-lms-dashboard-v2 .sidebar-nav p,
.cursos-lms-dashboard-v2 .sidebar-footer p {
    margin: 0;
    padding: 0;
}

.cursos-lms-dashboard-v2 .sidebar-nav br,
.cursos-lms-dashboard-v2 .sidebar-footer br,
.cursos-lms-dashboard-v2 .btn-logout br {
    display: none !important;
}

.cursos-lms-dashboard-v2 p:empty {
    display: none !important;
}

.sidebar-nav .nav-item,
.cursos-lms-dashboard-v2 .sidebar-nav .nav-item {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    gap: 12px !important;
    padding: 14px 24px;
    min-height: 52px;
    margin: 0 !important;
    color: #666;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.nav-item svg,
.sidebar-nav .nav-item svg,
.cursos-lms-dashboard-v2 .sidebar-nav .nav-item svg {
    flex-shrink: 0 !important;
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
}

.sidebar-nav .nav-item:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.sidebar-nav .nav-item.active {
    background: #f0f7ff;
    color: #2196F3;
    border-left: 3px solid #2196F3;
}

.nav-item .badge {
    margin-left: auto;
    background: #e0e0e0;
    color: #666;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.nav-item.active .badge {
    background: #2196F3;
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    flex-shrink: 0;
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

body.admin-bar .cursos-lms-dashboard-v2 .dashboard-sidebar {
    top: 32px;
    height: calc(100dvh - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar .cursos-lms-dashboard-v2 .dashboard-sidebar {
        top: 46px;
        height: calc(100dvh - 46px);
    }
}

.btn-logout {
    width: 100% !important;
    max-width: 100%;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 12px 14px !important;
    min-height: 44px;
    margin: 0 !important;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-logout > span {
    display: inline;
    line-height: 1;
}

.btn-logout:hover {
    background: #fff5f5;
    border-color: #f44336;
    color: #f44336;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.dashboard-content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    border-left: none;
}

/* Hero */
.dashboard-hero {
    background: linear-gradient(135deg, #5f6eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 18px;
    padding: 24px 26px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: 0 12px 28px rgba(95, 110, 234, 0.28);
}

.dashboard-hero-main h1 {
    margin: 0;
    font-size: 38px;
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-weight: 800;
    color: #fff;
}

.dashboard-hero-main p {
    margin: 8px 0 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.92);
}

.dashboard-hero-user {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.14);
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.hero-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #5d5ae2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
}

.hero-user-meta {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hero-user-meta strong {
    font-size: 15px;
    line-height: 1.2;
}

.hero-user-meta span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.88);
}

.content-header {
    margin-bottom: 32px;
}

.content-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}

.content-header h2 {
    font-size: 30px;
    font-weight: 800;
    margin: 0 0 8px 0;
    color: #111827;
    letter-spacing: -0.02em;
}

.content-header p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stats-grid-hero {
    margin-bottom: 34px;
}

.stats-grid-hero .stat-card {
    border: 2px solid transparent;
}

.stat-card-purple {
    border-color: #6a6cf1 !important;
}

.stat-card-green {
    border-color: #10b981 !important;
}

.stat-card-blue {
    border-color: #3b82f6 !important;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card-purple .stat-icon {
    background: linear-gradient(135deg, #6a6cf1, #5b60ea);
    color: #fff;
}

.stat-card-green .stat-icon {
    background: linear-gradient(135deg, #14b87a, #0da56f);
    color: #fff;
}

.stat-card-blue .stat-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #666;
}

/* Section Title */
.section-title {
    margin: 32px 0 20px 0;
}

.section-title h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

/* Courses Grid */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.course-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
    transition: all 0.3s;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

.course-thumbnail {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f5f5f5;
}

.course-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.course-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.course-card:hover .course-overlay {
    opacity: 1;
}

.btn-play {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #fff;
    color: #1a1a1a;
    text-decoration: none;
    border-radius: 24px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-play:hover {
    transform: scale(1.05);
}

.completed-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #4CAF50;
    color: #fff;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.course-info {
    padding: 20px;
}

.course-info h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1a1a1a;
    line-height: 1.4;
    height: calc(1.4em * 2);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.course-excerpt {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
    font-size: 13px;
    color: #666;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0 8px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    transition: width 0.3s;
}

.progress-text {
    font-size: 12px;
    color: #4CAF50;
    font-weight: 600;
}

/* Buttons */
.btn-primary,
.btn-outline {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #2196F3;
    color: #fff;
}

.btn-primary:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid #e0e0e0;
    color: #666;
}

.btn-outline:hover {
    border-color: #2196F3;
    color: #2196F3;
}

.course-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.course-actions .btn-primary,
.course-actions .btn-outline {
    flex: 1;
    min-width: 130px;
    padding: 10px 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
}

.empty-state svg {
    margin-bottom: 20px;
    color: #ccc;
}

.empty-state h3 {
    font-size: 20px;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}

.empty-state p {
    font-size: 14px;
    color: #666;
    margin: 0 0 20px 0;
}

/* Progress List */
.progress-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-item {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-course-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #1a1a1a;
}

.progress-course-info p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.circular-progress {
    position: relative;
    width: 80px;
    height: 80px;
}

.progress-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 700;
    color: #4CAF50;
}

/* Certificates Grid */
.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.certificate-card {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e8e8e8;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.certificate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.certificate-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.certificate-card.cert-assinado::before {
    background: linear-gradient(90deg, #4caf50, #45a049);
}

.certificate-card.cert-gerado::before {
    background: linear-gradient(90deg, #2196f3, #1976d2);
}

.certificate-card.cert-pendente::before {
    background: linear-gradient(90deg, #ff9800, #f57c00);
}

.certificate-card.cert-revogado::before {
    background: linear-gradient(90deg, #f44336, #da190b);
}

.certificate-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.certificate-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.certificate-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.certificate-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #1a1a1a;
    text-align: left;
    line-height: 1.4;
}

.certificate-card p {
    font-size: 13px;
    color: #666;
    margin: 0 0 8px 0;
    text-align: left;
}

.cert-date {
    font-weight: 500;
    color: #333;
}

.cert-info {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    font-size: 12px;
    text-align: left;
}

.cert-info p {
    margin: 4px 0;
    color: #555;
}

.cert-generated {
    color: #2196f3;
    font-weight: 500;
}

.cert-signed {
    color: #4caf50;
    font-weight: 500;
}

.cert-pending-sign {
    color: #ff9800;
    font-weight: 500;
}

.cert-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    flex-wrap: wrap;
}

.cert-actions a,
.cert-actions button {
    flex: 1;
    min-width: 100px;
    font-size: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
}

.btn-download,
.btn-view {
    text-decoration: none;
    display: inline-flex;
}

.btn-download {
    background: #4caf50;
    color: #fff;
}

.btn-download:hover {
    background: #45a049;
    text-decoration: none;
}

.btn-view {
    background: #2196f3;
    color: #fff;
}

.btn-view:hover {
    background: #1976d2;
    text-decoration: none;
}

.btn-disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-disabled:hover {
    background: #e0e0e0;
}

/* ========================================
   ADMIN EDITOR - ISOLATE FROM COURSES-GRID
   ======================================== */
/* Prevent courses-grid from affecting admin editor */
.cursos-admin-editor,
.cursos-admin-editor .form-grid,
.cursos-admin-editor .form-column-main,
.cursos-admin-editor .form-column-sidebar {
    display: block !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
}

/* Ensure admin editor has proper two-column layout */
#cursos-course-form .form-grid {
    display: block;
    width: 100%;
}

#cursos-course-form .form-column-main {
    display: inline-block;
    width: calc(100% - 374px);
    vertical-align: top;
    margin-right: 24px;
}

#cursos-course-form .form-column-sidebar {
    display: inline-block;
    width: 350px;
    vertical-align: top;
}

@media (max-width: 1024px) {
    #cursos-course-form .form-column-main,
    #cursos-course-form .form-column-sidebar {
        display: block;
        width: 100%;
        margin-right: 0;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .courses-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .cursos-lms-dashboard-v2 {
        flex-direction: column;
    }
    
    .dashboard-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 8px 0;
    }
    
    .nav-item {
        white-space: nowrap;
        padding: 12px 16px;
    }
    
    .dashboard-content {
        padding: 20px;
    }

    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px;
        border-radius: 14px;
    }

    .dashboard-hero-main h1 {
        font-size: 28px;
    }

    .dashboard-hero-main p {
        font-size: 14px;
    }

    .dashboard-hero-user {
        width: 100%;
    }
    
    .content-header h1 {
        font-size: 24px;
    }

    .content-header h2 {
        font-size: 24px;
    }
    
    .courses-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
