/* Fuentes y Estilos Base */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600&display=swap');

body {
    font-family: 'Fredoka', sans-serif;
    background-color: #fdfbf7; /* Crema suave */
    color: #5d5d5d;
    overflow-x: hidden;
}

/* Paleta Pastel */
.bg-pastel-blue { background-color: #aecbfa; }
.bg-pastel-pink { background-color: #f6cec5; }
.bg-pastel-green { background-color: #c5e1a5; }
.bg-pastel-yellow { background-color: #fff59d; }
.bg-pastel-purple { background-color: #e1bee7; }
.bg-pastel-orange { background-color: #ffcc80; }
.bg-pastel-teal { background-color: #80cbc4; }

.text-pastel-blue { color: #5c8bd6; }

/* Animaciones */
.fade-in { animation: fadeIn 0.5s ease-in; }
.slide-up { animation: slideUp 0.5s ease-out; }
.pop-in { animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes popIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Estilos de Pestañas */
.tab-btn {
    transition: all 0.3s;
    border-bottom: 4px solid transparent;
    white-space: nowrap;
}
.tab-btn.active {
    border-bottom: 4px solid #8eacbb;
    color: #455a64;
    background-color: rgba(255,255,255,0.6);
    font-weight: 600;
}

/* Input Styles */
input[type="number"] {
    -moz-appearance: textfield;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 8px;
    text-align: center;
    font-size: 1.2rem;
    width: 100px;
    transition: border-color 0.3s;
}
input[type="number"]:focus {
    outline: none;
    border-color: #aecbfa;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #cfd8dc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b0bec5; }

.highlight-cell {
    background-color: #fff9c4;
    border: 2px dashed #fbc02d;
    border-radius: 8px;
    transition: all 0.3s;
}

/* Botones Discretos de Cantidad */
.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #f3f4f6;
    color: #6b7280;
}
.qty-btn:hover {
    background-color: #aecbfa;
    color: white;
    transform: scale(1.1);
}
.qty-btn.minus:hover {
    background-color: #f6cec5;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    text-align: center;
    transform: translateY(-50px);
    animation: slideDown 0.3s forwards;
    width: 90%;
    margin: 0 20px;
}
@keyframes slideDown {
    to { transform: translateY(0); }
}

/* Estilos para los cuadritos del valor posicional */
.block-unit {
    width: 40px;
    height: 40px;
    background-color: #ffcc80;
    border: 2px solid #ff9800;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #e65100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

@media (max-width: 640px) {
    .block-unit {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}

.block-unit:hover {
    transform: scale(1.05);
}

.block-ten {
    width: 80px;
    height: 40px;
    background-color: #81d4fa;
    border: 2px solid #0288d1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #01579b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

@media (max-width: 640px) {
    .block-ten {
        width: 60px;
        height: 30px;
        font-size: 0.8rem;
    }
}

.block-ten::before {
    content: "";
    position: absolute;
    width: 36px;
    height: 36px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 6px;
    left: 2px;
    top: 2px;
}

@media (max-width: 640px) {
    .block-ten::before {
        width: 26px;
        height: 26px;
    }
}

.block-hundred {
    width: 120px;
    height: 40px;
    background-color: #c8e6c9;
    border: 2px solid #388e3c;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #1b5e20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

@media (max-width: 640px) {
    .block-hundred {
        width: 90px;
        height: 30px;
        font-size: 0.8rem;
    }
}

.block-hundred::before {
    content: "";
    position: absolute;
    width: 36px;
    height: 36px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 6px;
    left: 2px;
    top: 2px;
}

@media (max-width: 640px) {
    .block-hundred::before {
        width: 26px;
        height: 26px;
    }
}

.block-hundred::after {
    content: "";
    position: absolute;
    width: 36px;
    height: 36px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 6px;
    right: 2px;
    top: 2px;
}

@media (max-width: 640px) {
    .block-hundred::after {
        width: 26px;
        height: 26px;
    }
}

.block-label {
    font-size: 10px;
    position: absolute;
    bottom: -16px;
    color: #666;
    width: 100%;
    text-align: center;
}

/* Estilos para fracciones */
.fraction-bar {
    border-top: 3px solid #333;
    margin: 2px 0;
}

.fraction-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0 5px;
    vertical-align: middle;
}

/* Estilos responsivos */
@media (max-width: 768px) {
    .mobile-flex-col {
        flex-direction: column !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
    
    .mobile-w-full {
        width: 100% !important;
    }
    
    .mobile-mb-2 {
        margin-bottom: 0.5rem !important;
    }
    
    .mobile-p-2 {
        padding: 0.5rem !important;
    }
    
    .mobile-gap-1 {
        gap: 0.25rem !important;
    }
    
    input[type="number"] {
        width: 80px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-block {
        display: block !important;
    }
    
    .tab-btn span:not(.fa) {
        display: none;
    }
    
    .tab-btn .fa {
        margin-right: 0 !important;
    }
}

/* Estilos para gráficos de fracciones */
.fraction-visual {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .fraction-visual {
        width: 150px;
        height: 150px;
    }
}

/* Estilos para operaciones con fracciones */
.fraction-operation {
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

@media (max-width: 640px) {
    .fraction-operation {
        font-size: 1.5rem;
        flex-wrap: wrap;
    }
}

.fraction-result {
    background-color: #e8f5e8;
    border: 2px solid #4caf50;
    border-radius: 10px;
    padding: 10px;
    margin-top: 10px;
}

/* Estilos para comparación de fracciones */
.comparison-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .comparison-visual {
        flex-direction: column;
        gap: 10px;
    }
}

.fraction-card {
    border: 2px solid #ddd;
    border-radius: 15px;
    padding: 15px;
    background: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s;
    cursor: pointer;
}

.fraction-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.fraction-card.selected {
    border-color: #4caf50;
    background-color: #f1f8e9;
}

.fraction-part {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin: 1px;
    display: inline-block;
}

/* Gráficos para operaciones de fracciones */
.operation-visual-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.operation-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.step-label {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin-bottom: 5px;
}

/* Mejoras para el reto */
.party-item {
    min-width: 120px;
}

@media (max-width: 640px) {
    .party-item {
        min-width: 100px;
    }
}

/* Estilos para multiplicación de fracciones */
.multiplication-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.area-model {
    position: relative;
    width: 200px;
    height: 200px;
    border: 2px solid #333;
    margin: 0 auto;
}

.area-cell {
    position: absolute;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* División de fracciones visual */
.division-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.division-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}