/**
 * Cube 3D Viewer - Estilos para WordPress
 */

.cube-instance {
    max-width: 400px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cube-instance canvas {
    width: 100%;
    aspect-ratio: 1;
    cursor: grab;
    border-radius: 8px;
    outline: none;
    display: block;
    background: #ffffff;
}

.cube-instance canvas:active {
    cursor: grabbing;
}

.cube-instance canvas:focus {
    outline: none;
}

/* Contenedor con controles opcionales */
.cube-instance.with-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.cube-instance.with-controls canvas {
    border-radius: 8px 8px 0 0;
}

.cube-instance .cube-controls {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 0 0 8px 8px;
    border: 1px solid #e9ecef;
    border-top: none;
    font-size: 12px;
    color: #495057;
    text-align: center;
}

.cube-instance .cube-controls strong {
    color: #212529;
}

/* Axis lock controls */
.cube-axis-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.cube-axis-label {
    font-size: 11px;
    color: #6c757d;
    margin-right: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cube-axis-btn {
    padding: 5px 12px;
    border: 1px solid #01917c;
    border-radius: 8px;
    background: #fff;
    color: #01917c;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1;
}

.cube-axis-btn:hover {
    background: #01917c;
    border-color: #01917c;
    color: #fff;
}

.cube-axis-btn.active {
    background: #01917c;
    border-color: #01917c;
    color: #fff;
}

.cube-axis-btn.cube-axis-reset {
    background: #fff;
    border-color: #01917c;
    color: #01917c;
}

.cube-axis-btn.cube-axis-reset:hover {
    background: #01917c;
    border-color: #01917c;
    color: #fff;
}

.cube-hints {
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 6px;
    letter-spacing: 0.3px;
}

@media (max-width: 768px) {
    .cube-hints {
        display: none;
    }
}

/* ==================== Transform 2D Simulator ==================== */

.transform-instance {
    max-width: 400px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.transform-simulator {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.transform-canvas-wrapper {
    background: #f8f9fa;
    padding: 20px;
}

.transform-canvas {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    background: white;
    display: block;
}

.transform-controls {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #e9ecef;
}

.transform-btn {
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid #01917c;
    border-radius: 8px;
    background: #fff;
    color: #01917c;
    transition: background 0.2s, opacity 0.2s;
    font-weight: 500;
}

.transform-btn:hover:not(:disabled) {
    background: #01917c;
    color: #fff;
}

.transform-btn:disabled {
    cursor: not-allowed;
}

.transform-step-info {
    text-align: center;
    flex: 1;
}

.transform-step-number {
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

.transform-step-symbol {
    font-size: 28px;
    margin: 5px 0;
    line-height: 1;
}

.transform-step-name {
    color: #6c757d;
    font-size: 12px;
}

.transform-progress {
    padding: 15px;
    display: flex;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid #e9ecef;
}

.transform-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dee2e6;
    cursor: pointer;
    transition: all 0.2s;
}

.transform-dot:hover {
    transform: scale(1.2);
}

.transform-dot.current {
    background: #01917c;
    transform: scale(1.3);
}

.transform-dot.completed {
    background: #01917c;
    opacity: 0.5;
}

/* ==================== Steps Viewer - Simulador (Rejilla 2D) ==================== */

.steps-instance {
    max-width: 450px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.steps-simulator {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.steps-canvas-wrapper {
    background: #f8f9fa;
    padding: 20px;
}

.steps-main-canvas {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    background: white;
    display: block;
}

.steps-controls {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #e9ecef;
}

.steps-btn {
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid #01917c;
    border-radius: 8px;
    transition: background 0.2s, opacity 0.2s;
    font-weight: 500;
    background: #fff;
    color: #01917c;
}

.steps-btn:hover:not(:disabled) {
    background: #01917c;
    color: #fff;
}

.steps-btn:disabled {
    cursor: not-allowed;
}

.steps-step-info {
    text-align: center;
    flex: 1;
}

.steps-step-number {
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

.steps-step-desc {
    color: #6c757d;
    font-size: 12px;
    margin-top: 4px;
}

.steps-progress {
    padding: 15px;
    display: flex;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid #e9ecef;
}

.steps-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dee2e6;
    cursor: pointer;
    transition: all 0.2s;
}

.steps-dot:hover {
    transform: scale(1.2);
}

.steps-dot.current {
    background: #01917c;
    transform: scale(1.3);
}

.steps-dot.completed {
    background: #01917c;
    opacity: 0.5;
}

.steps-legend {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.steps-legend-title {
    font-weight: bold;
    color: #495057;
    font-size: 13px;
    margin-bottom: 10px;
}

.steps-legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.steps-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6c757d;
}

.steps-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.steps-legend-text {
    line-height: 1.3;
}

/* Responsive */
@media (max-width: 768px) {
    .steps-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .steps-step-number {
        font-size: 12px;
    }
    
    .steps-step-desc {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .cube-instance,
    .transform-instance,
    .steps-instance {
        max-width: 100%;
        margin: 10px;
    }
    
    .cube-instance canvas {
        border-radius: 4px;
    }
    
    .transform-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .transform-step-symbol {
        font-size: 22px;
    }
    
    .steps-canvas {
        width: 80px;
        height: 80px;
    }
    
    .steps-question-mark {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }
    
    .steps-option .steps-canvas {
        width: 70px;
        height: 70px;
    }
    
    .steps-viewer-container {
        padding: 10px;
    }
}

/* ==================== Interactive Feedback ==================== */

.feedback-instance {
    max-width: 600px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.feedback-instance img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.feedback-controls {
    text-align: center;
    padding: 16px 0;
}

.feedback-label {
    color: #6c757d;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.feedback-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.feedback-btn {
    width: 64px;
    height: 64px;
    border: 1px solid #01917c;
    border-radius: 8px;
    background: #fff;
    color: #01917c;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.feedback-btn:hover {
    background: #01917c;
    border-color: #01917c;
    color: #fff;
}

.feedback-btn.is-correct {
    background: #d1fae5 !important;
    border-color: #22c55e !important;
    color: #166534 !important;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.2) !important;
    transform: scale(1.05);
}

.feedback-btn.is-wrong {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #991b1b !important;
    animation: feedback-shake 0.4s ease;
}

.feedback-msg {
    margin-top: 14px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

.feedback-msg.show {
    display: inline-block;
}

.feedback-msg.ok {
    background: #d1fae5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.feedback-msg.fail {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.feedback-explanation {
    display: none;
    margin-top: 14px;
    padding: 14px 18px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.6;
    text-align: left;
}

.feedback-explanation.show {
    display: block;
}

@keyframes feedback-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

@media (max-width: 480px) {
    .feedback-instance {
        max-width: 100%;
        margin: 10px;
    }

    .feedback-btn {
        width: 54px;
        height: 54px;
        font-size: 1.2rem;
    }
}

/* =============================================
   VIZ RENDERER STYLES
   ============================================= */

.viz-instance {
    max-width: 900px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.viz-container {
    background: #fff;
    border: none;
    border-radius: 12px;
    padding: 20px;
    margin-top: 12px;
}

.viz-title {
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
    text-align: center;
}

/* FIGDIF: Flip figures */
.viz-figures {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.viz-fig {
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.viz-fig canvas {
    border: none;
    border-radius: 8px;
    transition: all 0.3s;
    background: #fff;
}

.viz-fig:hover canvas {
    outline: 2px solid #01917c;
}

.viz-fig.flipped canvas {
    outline: 2px solid #01917c;
}

.viz-label {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: 1px;
}

.viz-hint {
    color: #94a3b8;
    font-size: 0.7rem;
    margin-top: 2px;
}

.viz-btn-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

.viz-btn {
    padding: 8px 20px;
    border: 1px solid #01917c;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    background: #fff;
    color: #01917c;
}

.viz-btn-flip {
    background: #fff;
    color: #01917c;
}

.viz-btn-flip:hover {
    background: #01917c;
    border-color: #01917c;
    color: #fff;
}

.viz-btn-reset {
    background: #fff;
    color: #01917c;
    border-color: #01917c;
}

.viz-btn-reset:hover {
    background: #01917c;
    border-color: #01917c;
    color: #fff;
}

/* ROTATION: figig + pletina */
.viz-compare {
    display: flex;
    justify-content: center;
    gap: 24px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.viz-compare canvas {
    border: none;
    border-radius: 8px;
    background: #fff;
}

.viz-compare-label {
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    margin-top: 4px;
}

.viz-slider-wrap {
    text-align: center;
    margin-bottom: 16px;
}

.viz-slider-wrap input[type=range] {
    width: 300px;
    max-width: 100%;
    accent-color: #01917c;
}

.viz-slider-label {
    color: #64748b;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.viz-step-btns {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.viz-step-btn {
    padding: 6px 14px;
    border: 1px solid #01917c;
    border-radius: 8px;
    background: #fff;
    color: #01917c;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s;
}

.viz-step-btn:hover {
    background: #01917c;
    color: #fff;
    border-color: #01917c;
}

.viz-step-btn.active {
    background: #01917c;
    color: #fff;
    border-color: #01917c;
}

.viz-flip-btns {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

/* Options row (shared) */
.viz-options {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.viz-opt {
    border: 3px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    padding: 6px;
    text-align: center;
}

.viz-opt:hover {
    border-color: #01917c;
    transform: translateY(-2px);
}

.viz-opt.active {
    border-color: #01917c;
    box-shadow: 0 0 15px rgba(1, 145, 124, 0.3);
}

.viz-opt.viz-correct {
    border-color: #22c55e;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

.viz-opt.viz-wrong {
    border-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.viz-opt canvas {
    display: block;
    border-radius: 4px;
}

/* COMPLETAR: Main canvas */
.viz-main {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.viz-main canvas {
    border-radius: 8px;
    border: none;
    background: #fff;
}

/* Result text */
.viz-result {
    text-align: center;
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    min-height: 1.2em;
}

.viz-result.ok {
    color: #16a34a;
}

.viz-result.fail {
    color: #dc2626;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .viz-instance {
        margin: 12px 8px;
    }

    .viz-container {
        padding: 16px;
        border-radius: 10px;
    }

    .viz-title {
        font-size: 0.7rem;
        margin-bottom: 12px;
    }

    /* Compare area: keep model + option in same row */
    .viz-compare {
        gap: 16px;
        flex-wrap: nowrap;
    }

    .viz-compare > div {
        flex: 1;
        min-width: 0;
        max-width: 50%;
    }

    .viz-compare canvas {
        width: 100% !important;
        max-width: 160px !important;
        height: auto !important;
        aspect-ratio: 1;
        margin: 0 auto;
        display: block;
    }

    .viz-compare-label {
        font-size: 0.65rem;
    }

    /* Options: 2x2 grid */
    .viz-options {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-width: 320px;
        margin: 0 auto;
    }

    .viz-opt {
        padding: 8px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .viz-opt canvas {
        width: 100% !important;
        max-width: 100px !important;
        height: auto !important;
        aspect-ratio: 1;
    }

    .viz-slider-wrap input[type=range] {
        width: 100%;
        max-width: 280px;
    }

    .viz-step-btns {
        flex-wrap: wrap;
        gap: 6px;
    }

    .viz-step-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .viz-figures {
        gap: 10px;
    }

    .viz-fig canvas {
        width: 90px !important;
        height: 90px !important;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .viz-container {
        padding: 12px;
        border-radius: 8px;
    }

    .viz-title {
        font-size: 0.65rem;
        letter-spacing: 1px;
    }

    /* Compare area: smaller but still side by side */
    .viz-compare {
        gap: 10px;
    }

    .viz-compare canvas {
        max-width: 130px !important;
    }

    .viz-compare-label {
        font-size: 0.6rem;
        letter-spacing: 0.5px;
    }

    /* Options: 2x2 grid, smaller */
    .viz-options {
        gap: 8px;
        max-width: 280px;
    }

    .viz-opt {
        padding: 6px;
        border-width: 2px;
    }

    .viz-opt canvas {
        max-width: 80px !important;
    }

    .viz-label {
        font-size: 0.7rem;
    }

    .viz-slider-wrap {
        margin-bottom: 12px;
    }

    .viz-slider-label {
        font-size: 0.7rem;
    }

    .viz-step-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .viz-fig canvas {
        width: 70px !important;
        height: 70px !important;
    }

    .viz-main canvas {
        width: 100% !important;
        height: auto !important;
        max-width: 300px;
    }

    .viz-result {
        font-size: 0.75rem;
    }

    .viz-btn, .viz-btn-reset {
        padding: 8px 14px;
        font-size: 0.75rem;
    }

    .viz-btn-row {
        flex-wrap: wrap;
        gap: 8px;
    }
}
