/* Calculadora de Alicia - Mobile Style Calculator */

.calculadora-de-alicia-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    min-height: 100vh;
    background: #ffffff;
}

.calculadora-de-alicia {
    width: 280px;
    background: #ffffff;
    border-radius: 30px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 320px;
    margin: 0 auto;
    border: 2px solid #ddd;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
}

/* Title Bar */
.calculadora-title {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 12px;
    background: #f5f5f5;
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border: 1px solid #ddd;
    text-align: center;
}


/* Display Screen */
.calculadora-display {
    background: #000;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border: 2px solid #333;
}

.calculadora-screen {
    color: #fff;
    font-size: 28px;
    font-weight: 300;
    text-align: right;
    word-wrap: break-word;
    word-break: break-all;
}

/* Buttons Container */
.calculadora-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.button-row {
    display: flex;
    gap: 5px;
    width: 100%;
}

/* Button Base Styles */
.btn {
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    height: 45px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    user-select: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
    position: relative;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Button Colors */
.btn-red {
    background: #ff4444;
    color: white;
}

.btn-red:hover {
    background: #cc0000;
}

.btn-blue {
    background: #87ceeb;
    color: #333;
}

.btn-blue:hover {
    background: #5f9fd8;
}

.btn-yellow {
    background: #ffd700;
    color: #333;
}

.btn-yellow:hover {
    background: #ffcc00;
}

.btn-green {
    background: #4caf50;
    color: white;
}

.btn-green:hover {
    background: #45a049;
}

/* Special Button Sizes */
.btn-zero {
    flex: 2;
}

.btn-equals {
    flex: 1;
}

/* Override flex for specific button rows */
.button-row:nth-child(5) .btn:first-child {
    flex: 2;
}

.button-row:nth-child(6) .btn {
    flex: 1;
}

/* Step-by-Step Solution Popup Styles */
.step-by-step-solution {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: #ffffff;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #4caf50;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999 !important;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
}

/* Overlay background */
.step-by-step-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 9998 !important;
    display: none;
}

/* Popup Header with Close Arrow */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.close-arrow {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-arrow:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.step-by-step-solution h3 {
    text-align: center;
    color: #333;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.solution-problem {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    border: 1px solid #e0e0e0;
}

.solucion-interactiva h4 {
    color: #555;
    margin-bottom: 10px;
    font-size: 16px;
    text-align: center;
}

.solution-content {
    background: #fff;
    border: 2px solid #4caf50;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.step-display {
    font-size: 18px;
    margin: 10px 0;
    text-align: center;
    color: #333;
}

.step-display .highlight {
    background: #ffeb3b;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.step-display .result {
    color: #4caf50;
    font-weight: 700;
    font-size: 20px;
}

/* Vertical Problem Layout */
.vertical-problem {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    max-width: 100%;
    box-sizing: border-box;
}

.vertical-layout {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.number-row {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.number {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    text-align: center;
    min-width: 40px;
}

.operator-row {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    text-align: center;
    min-width: 40px;
}

.divider-line {
    width: 60px;
    height: 2px;
    background: #333;
    margin: 5px 0;
}

.result-row {
    display: flex;
    justify-content: center;
}

.result-box {
    background: #fff;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 10px 15px;
    min-width: 40px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #4caf50;
}

.side-equation {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    min-width: 60px;
}

.side-number {
    font-size: 16px;
    color: #333;
    margin: 2px 0;
}

.side-result {
    font-size: 18px;
    font-weight: 700;
    color: #4caf50;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #ddd;
}

.explanation {
    font-size: 14px;
    color: #666;
    margin: 10px 0;
    font-weight: 500;
}

.full-equation {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    background: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

/* Partial Products Styles */
.partial-products-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.partial-product-line {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin: 2px 0;
    min-width: 60px;
}

.sum-divider-line {
    width: 80px;
    height: 2px;
    background: #333;
    margin: 5px 0;
}

.solution-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.solution-controls label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.solution-controls select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: #fff;
}

.solution-controls .btn {
    height: 35px;
    font-size: 14px;
    padding: 0 15px;
}

.solution-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.solution-actions .btn {
    height: 40px;
    font-size: 14px;
    padding: 0 20px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .calculadora-de-alicia-container {
        padding: 10px;
        min-height: auto;
        margin: 20px 0;
    }
    
    .calculadora-de-alicia {
        width: 280px;
        max-width: 280px;
        padding: 12px;
        margin: 0 auto;
    }
    
    .btn {
        height: 45px;
        font-size: 16px;
    }
    
    .calculadora-screen {
        font-size: 28px;
    }
    
    .calculadora-display {
        min-height: 60px;
        padding: 15px;
    }
    
    .button-row {
        gap: 5px;
    }
}

@media (max-width: 360px) {
    .calculadora-de-alicia {
        width: 260px;
        padding: 10px;
    }
    
    .btn {
        height: 40px;
        font-size: 14px;
    }
    
    .calculadora-screen {
        font-size: 24px;
    }
    
    .calculadora-display {
        min-height: 50px;
        padding: 12px;
    }
    
    .button-row {
        gap: 4px;
    }
}

@media (max-width: 320px) {
    .calculadora-de-alicia {
        width: 240px;
        padding: 8px;
    }
    
    .btn {
        height: 38px;
        font-size: 13px;
    }
    
    .calculadora-screen {
        font-size: 22px;
    }
    
    .calculadora-display {
        min-height: 45px;
        padding: 10px;
    }
    
    .button-row {
        gap: 3px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid #000;
    }
    
    .calculadora-de-alicia {
        border: 3px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }
    
    .btn:hover {
        transform: none;
    }
}
