/* ============================================
   QUICK WINS - Componentes Reutilizables
   Estilos para mejoras de curso
   ============================================ */

/* ===== 1. Botones de Acción de Código ===== */
.code-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.code-actions button,
.code-actions a {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: inherit;
}

.btn-copy {
    background: var(--module-color);
    color: white;
    border: none;
}

.btn-copy:hover {
    background: var(--module-color-dark);
    transform: translateY(-1px);
}

.btn-dartpad {
    background: #0175C2;
    color: white;
    border: none;
}

.btn-dartpad:hover {
    background: #015a99;
    transform: translateY(-1px);
}

.btn-explain {
    background: transparent;
    border: 1px solid var(--module-color);
    color: var(--module-color);
}

.btn-explain:hover {
    background: rgba(var(--module-color-rgb), 0.1);
}

/* ===== 2. Widget de Feedback ===== */
.feedback-widget {
    margin-top: 3rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.feedback-widget p {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.feedback-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.feedback-buttons button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s;
    font-family: inherit;
}

.feedback-buttons button:hover {
    transform: scale(1.05);
}

.btn-helpful {
    background: var(--module-color);
    color: white;
}

.btn-not-helpful {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.feedback-thanks {
    font-size: 1.125rem;
    color: var(--module-color);
    font-weight: 500;
}

/* ===== 3. Metadata de Lección ===== */
.lesson-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
}

.lesson-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.lesson-meta span strong {
    color: var(--text-primary);
}

/* ===== 4. Tabla de Contenidos Flotante ===== */
.table-of-contents {
    position: fixed;
    right: 2rem;
    top: 8rem;
    width: 220px;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    z-index: 100;
}

.table-of-contents h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-of-contents nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.table-of-contents a {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    border-radius: 0.25rem;
}

.table-of-contents a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--module-color);
}

.table-of-contents a.active {
    color: var(--module-color);
    border-left-color: var(--module-color);
    font-weight: 500;
    background: rgba(var(--module-color-rgb, 16, 185, 129), 0.1);
}

/* Scrollbar personalizado para TOC */
.table-of-contents::-webkit-scrollbar {
    width: 4px;
}

.table-of-contents::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.table-of-contents::-webkit-scrollbar-thumb {
    background: var(--module-color);
    border-radius: 2px;
}

/* ===== 5. Breadcrumb Mejorado ===== */
.breadcrumb {
    margin-bottom: 2rem;
}

.progress-indicator {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--module-color);
}

.breadcrumb .current {
    position: relative;
}

.breadcrumb .current.completed::after {
    content: ' ✓';
    color: var(--module-color);
    margin-left: 0.25rem;
}

/* ===== 6. Sección de Errores Comunes ===== */
.common-errors {
    margin-top: 3rem;
    padding: 2rem;
    background: rgba(239, 68, 68, 0.05);
    border-left: 4px solid #EF4444;
    border-radius: 0.5rem;
}

.common-errors h2 {
    color: #EF4444;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.5rem;
}

.error-item:last-child {
    margin-bottom: 0;
}

.error-item h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-item .error-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== 7. Recursos Adicionales ===== */
.additional-resources {
    margin-top: 3rem;
    padding: 2rem;
    background: rgba(59, 130, 246, 0.05);
    border-left: 4px solid #3B82F6;
    border-radius: 0.5rem;
}

.additional-resources h2 {
    color: #3B82F6;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resource-category {
    margin-bottom: 1.5rem;
}

.resource-category:last-child {
    margin-bottom: 0;
}

.resource-category h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.resource-category ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.resource-category li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.resource-category li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--module-color);
}

.resource-category a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.resource-category a:hover {
    color: var(--module-color);
}

/* ===== 8. Botón de Impresión ===== */
.btn-print {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    background: var(--module-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-print:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* ===== Utilidades ===== */
.hidden {
    display: none !important;
}

/* ===== Responsive Design ===== */
@media (max-width: 1400px) {
    .table-of-contents {
        display: none;
    }
}

@media (max-width: 768px) {
    .lesson-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .code-actions {
        flex-direction: column;
    }

    .code-actions button,
    .code-actions a {
        width: 100%;
        justify-content: center;
    }

    .feedback-buttons {
        flex-direction: column;
    }

    .feedback-buttons button {
        width: 100%;
    }

    .btn-print {
        bottom: 1rem;
        right: 1rem;
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
    }
}

/* ===== Estilos de Impresión ===== */
@media print {

    .breadcrumb,
    .table-of-contents,
    .btn-print,
    .feedback-widget,
    .code-actions,
    footer,
    .background-animation {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .content-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .common-errors,
    .additional-resources {
        border-color: #ccc;
        background: #f9f9f9;
    }

    pre {
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }

    h1,
    h2,
    h3 {
        page-break-after: avoid;
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .lesson-meta {
        border: 1px solid #ccc;
        background: #f9f9f9;
    }
}