/* --- ESTRUCTURA DEL DASHBOARD --- */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-light);
}

/* --- BARRA LATERAL (SIDEBAR) --- */
.sidebar {
    width: 260px;
    background-color: var(--white);
    box-shadow: 2px 0 12px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.close-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-nav {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav a {
    padding: 11px 24px;
    text-decoration: none;
    color: var(--light-text);
    font-weight: 500;
    font-size: 0.92rem;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-right: 12px;
}

.sidebar-nav a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-nav a.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    border-right: 3px solid var(--primary-color);
}

.sidebar-nav .logout-link {
    margin-top: auto;
    color: #ef4444;
}

.sidebar-nav .logout-link:hover {
    background-color: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

/* --- CONTENIDO PRINCIPAL --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

/* --- TOPBAR --- */
.topbar {
    height: 64px;
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background-color: rgba(255,255,255,0.85);
    border-bottom: 1px solid var(--border-color);
}
body.dark .topbar {
    background-color: rgba(30,41,59,0.85);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--dark-text);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.user-info span {
    font-size: 0.9rem;
    color: var(--light-text);
}

.avatar {
    width: 38px;
    height: 38px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 0.85rem;
}

/* --- ÁREA DE TRABAJO --- */
.content-wrapper {
    padding: 30px;
}

.content-wrapper h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.subtitle {
    color: var(--light-text);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* --- TARJETAS DE ESTADÍSTICAS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--white);
    padding: 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

/* --- TABLAS --- */
.recent-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.table-responsive {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table th, 
.dashboard-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-table th {
    color: var(--light-text);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dashboard-table tr {
    transition: var(--transition-fast);
}

.dashboard-table tbody tr:hover {
    background-color: var(--primary-light);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-warning {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-success {
    background-color: #d1fae5;
    color: #059669;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

/* --- CARDS (Glassmorphism) --- */
.analysis-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
}

/* --- SCORE CIRCLE --- */
.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--white);
    margin: 0 auto 15px;
}

/* --- ISSUE ITEMS --- */
.issue-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.issue-item:last-child { border-bottom: none; }

.issue-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.issue-success { background: #d1fae5; color: #059669; }
.issue-warning { background: #fef3c7; color: #d97706; }
.issue-error { background: #fee2e2; color: #dc2626; }

/* --- RESPONSIVE DASHBOARD --- */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .close-btn {
        display: flex;
    }
}

@media (max-width: 768px) {
    .content-wrapper { padding: 20px 16px; }
    .content-wrapper h1 { font-size: 1.3rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-number { font-size: 1.6rem; }
    .sidebar { width: 240px; }
    .topbar { padding: 0 16px; }
    .dashboard-table th, .dashboard-table td { padding: 10px 12px; font-size: 0.82rem; }
    .section-header h2 { font-size: 1rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 14px; }
    .stat-number { font-size: 1.4rem; }
    .content-wrapper { padding: 16px 12px; }
    .sidebar { width: 100%; }
    .gallery-grid { grid-template-columns: 1fr; }
    .card-image-wrapper { height: 220px; }
    .filter-tabs { flex-wrap: wrap; }
    .filter-btn { padding: 6px 12px; font-size: 0.8rem; }
}

/* ========================================
   TEMPLATE GALLERY — Thumbnail Preview
   ======================================== */

.template-gallery-section {
    padding: 30px;
}

.gallery-subtitle {
    color: var(--light-text);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

/* --- Filter Tabs --- */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--white);
    color: var(--light-text);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

body.dark .filter-btn {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

body.dark .filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

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

/* --- Template Card --- */
.template-card-gal {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--white);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
    cursor: pointer;
}

.template-card-gal:hover {
    transform: translateY(-8px);
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.18);
    border-color: var(--primary-color);
}

.template-card-gal.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* --- Card Image Wrapper (Zoom Container) --- */
.card-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    height: 400px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark .card-image-wrapper {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* --- Thumbnail Image / CV Mock --- */
.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    display: block;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.card-image-wrapper .cv-thumbnail {
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Zoom effect on hover */
.template-card-gal:hover .card-image-wrapper img,
.template-card-gal:hover .card-image-wrapper .cv-thumbnail {
    transform: scale(1.05);
}

/* --- CV Thumbnail (Mini CV Real) --- */
.cv-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
}

.cv-thumbnail > div {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    overflow: hidden;
}

.cv-mock {
    width: 170px;
    height: 240px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    display: flex;
    font-size: 0;
    transition: transform 0.4s ease;
    position: relative;
    overflow: hidden;
}

.template-card-gal:hover .cv-mock {
    transform: scale(1.03);
}

.cv-mock-sidebar {
    flex-direction: row;
}

.cv-mock-accent,
.cv-mock-bold-style {
    flex-direction: column;
    padding: 14px;
    gap: 6px;
}

.cv-sidebar-inner {
    width: 38%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.cv-content-inner {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cv-mock-line {
    height: 5px;
    border-radius: 2px;
    background: #e2e8f0;
}

.cv-mock-line.short { width: 35%; }
.cv-mock-line.med { width: 60%; }
.cv-mock-line.full { width: 85%; }

.cv-mock-divider {
    height: 1px;
    width: 100%;
    margin: 3px 0;
    opacity: 0.5;
}

.cv-mock-accent-top {
    width: calc(100% + 28px);
    margin-left: -14px;
    margin-right: -14px;
    margin-top: -14px;
    border-radius: 5px 5px 0 0;
}

.cv-mock-accent-bar {
    height: 4px;
    width: 100%;
    margin-bottom: 6px;
}

.cv-mock-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin: 6px auto 6px;
}

/* --- Enhanced CV Mock Elements (Enhancv-style) --- */
.cv-sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 12px auto 8px;
}

.cv-sidebar-line {
    height: 4px;
    border-radius: 2px;
    margin: 3px 12px;
}

.cv-sidebar-divider {
    height: 1px;
    margin: 6px 12px;
}

.cv-mock-section-title {
    height: 5px;
    width: 45%;
    border-radius: 2px;
    margin-bottom: 4px;
    opacity: 0.85;
}

.cv-mock-name-text {
    height: 9px;
    border-radius: 2px;
    margin-bottom: 4px;
}

.cv-mock-subtitle-text {
    height: 4px;
    border-radius: 2px;
    margin-bottom: 4px;
}

.cv-mock-bold-style .cv-mock-accent-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 12px 14px;
    gap: 4px;
}

/* --- Hover Overlay --- */
.hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(37, 99, 235, 0.15);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 5;
    backdrop-filter: blur(2px);
}

.template-card-gal:hover .hover-overlay {
    opacity: 1;
}

/* --- Overlay Buttons --- */
.btn-preview {
    background: white;
    color: var(--primary-color);
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transform: translateY(20px);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    border: none;
    cursor: pointer;
}

.template-card-gal:hover .btn-preview {
    transform: translateY(0);
}

.btn-preview:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    transform: translateY(-2px) !important;
}

.btn-preview.canva-btn {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
}

.btn-select-secondary {
    background: transparent;
    color: white;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.4);
    transition: all 0.25s ease;
    font-family: inherit;
    transform: translateY(20px);
}

.template-card-gal:hover .btn-select-secondary {
    transform: translateY(0);
    transition-delay: 0.05s;
}

.btn-select-secondary:hover {
    background: rgba(255,255,255,0.15);
    border-color: white;
}

/* --- Badges --- */
.template-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    z-index: 6;
    backdrop-filter: blur(4px);
}

.badge-free {
    background: rgba(16, 185, 129, 0.9);
    color: white;
}

.badge-premium {
    background: rgba(245, 158, 11, 0.9);
    color: white;
}

.badge-ats {
    background: rgba(37, 99, 235, 0.9);
    color: white;
    right: auto;
    left: 12px;
}

/* --- Card Info --- */
.card-info {
    padding: 16px 18px 14px;
}

.card-info h3 {
    font-size: 1rem;
    color: var(--dark-text);
    font-weight: 700;
    margin: 0 0 4px;
}

.card-info .card-desc {
    font-size: 0.82rem;
    color: var(--light-text);
    margin: 0;
}

/* --- Gallery Responsive --- */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }

    .card-image-wrapper {
        height: 280px;
    }

    .cv-mock {
        width: 120px;
        height: 170px;
    }

    .hover-overlay {
        opacity: 1;
        backdrop-filter: none;
        background: rgba(0,0,0,0.25);
    }

    .btn-preview,
    .btn-select-secondary {
        transform: translateY(0);
        font-size: 0.82rem;
        padding: 10px 18px;
    }

    .filter-tabs {
        gap: 6px;
    }

    .filter-btn {
        padding: 6px 14px;
        font-size: 0.82rem;
    }
}

/* --- LOCKED PREMIUM TEMPLATE --- */
.template-card-gal.locked {
    opacity: 0.6;
    pointer-events: auto;
}
.template-card-gal.locked::after {
    content: '🔒 Premium';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10;
    pointer-events: none;
}
.template-card-gal.locked .hover-overlay {
    display: none;
}

/* --- PREMIUM MODAL --- */
.premium-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.premium-modal-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: fadeInUp 0.3s ease;
}
.premium-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--light-text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.premium-modal-close:hover {
    background: var(--bg-light);
    color: var(--dark-text);
}
.premium-modal-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}
.premium-modal-box h3 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark-text);
    margin-bottom: 10px;
}
.premium-modal-box p {
    font-size: 0.92rem;
    color: var(--light-text);
    line-height: 1.6;
    margin-bottom: 8px;
}
.premium-modal-price {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-top: 12px;
}
