/* ===== SUMA DE PUNTAJE - ESTILOS ===== */

/* Variables CSS para temas */
:root {
    /* Theme Dark */
    --suma-bg-primary: #1a1a2e;
    --suma-bg-secondary: #16213e;
    --suma-bg-secondary-rgb: 22, 33, 62;
    --suma-bg-tertiary: #0f3460;
    --suma-text-primary: #ffffff;
    --suma-text-secondary: #b8c5d6;
    --suma-accent: #00d4ff;
    --suma-accent-hover: #00b8e6;
    --suma-border: #2d3748;
    --suma-shadow: rgba(0, 212, 255, 0.3);
    --suma-button-bg: #2d3748;
    --suma-button-hover: #4a5568;
    --suma-number-bg: #3182ce;
    --suma-number-hover: #2c5aa0;
    --suma-clear-bg: #e53e3e;
    --suma-clear-hover: #c53030;
    --suma-history-bg: #38a169;
    --suma-history-hover: #2f855a;
}

/* Theme Light */
.theme-light {
    --suma-bg-primary: #f7fafc00;
    --suma-bg-secondary: #edf2f7;
    --suma-bg-secondary-rgb: 237, 242, 247;
    --suma-bg-tertiary: #e2e8f0;
    --suma-text-primary: #2d3748;
    --suma-text-secondary: #4a5568;
    --suma-accent: #3182ce;
    --suma-accent-hover: #2c5aa0;
    --suma-border: #cbd5e0;
    --suma-shadow: rgba(49, 130, 206, 0.3);
    --suma-button-bg: #edf2f7;
    --suma-button-hover: #e2e8f0;
    --suma-number-bg: #3182ce;
    --suma-number-hover: #2c5aa0;
    --suma-clear-bg: #e53e3e;
    --suma-clear-hover: #c53030;
    --suma-history-bg: #38a169;
    --suma-history-hover: #2f855a;
}

/* Theme Rosa */
.theme-rosa {
    --suma-bg-primary: #fff5f7;
    --suma-bg-secondary: #fed7e2;
    --suma-bg-secondary-rgb: 254, 215, 226;
    --suma-bg-tertiary: #fbb6ce;
    --suma-text-primary: #2d3748;
    --suma-text-secondary: #4a5568;
    --suma-accent: #e53e3e;
    --suma-accent-hover: #c53030;
    --suma-border: #fbb6ce;
    --suma-shadow: rgba(229, 62, 62, 0.3);
    --suma-button-bg: #fed7e2;
    --suma-button-hover: #fbb6ce;
    --suma-number-bg: #e53e3e;
    --suma-number-hover: #c53030;
    --suma-clear-bg: #718096;
    --suma-clear-hover: #4a5568;
    --suma-history-bg: #38a169;
    --suma-history-hover: #2f855a;
}

/* Theme Neon */
.theme-neon {
    --suma-bg-primary: #0a0a0a;
    --suma-bg-secondary: #1a1a1a;
    --suma-bg-secondary-rgb: 26, 26, 26;
    --suma-bg-tertiary: #2a2a2a;
    --suma-text-primary: #00ff00;
    --suma-text-secondary: #00cc00;
    --suma-accent: #ff00ff;
    --suma-accent-hover: #cc00cc;
    --suma-border: #00ff00;
    --suma-shadow: rgba(0, 255, 0, 0.5);
    --suma-button-bg: #1a1a1a;
    --suma-button-hover: #2a2a2a;
    --suma-number-bg: #00ff00;
    --suma-number-hover: #00cc00;
    --suma-clear-bg: #ff0066;
    --suma-clear-hover: #cc0052;
    --suma-history-bg: #0066ff;
    --suma-history-hover: #0052cc;
}

/* Estilos base */
.app-container {
    min-height: 100vh;
    background: var(--suma-bg-primary);
    color: var(--suma-text-primary);
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 1rem;
    align-items: center;
    justify-content: flex-start;
}

/* Modal de configuración */
.config-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.config-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.config-modal-content {
    max-width: 450px;
    width: 90%;
    max-height: 85vh;
}

.config-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.config-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--suma-text-secondary);
}

.config-group input {
    background: var(--suma-bg-tertiary);
    border: 1px solid var(--suma-border);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--suma-text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.config-group input:focus {
    outline: none;
    border-color: var(--suma-accent);
    box-shadow: 0 0 0 2px var(--suma-shadow);
}

/* Display de puntaje actual */
.current-score-display {
    background: var(--suma-bg-tertiary);
    border-radius: 15px;
    padding: 1.5rem;
    border: 2px solid var(--suma-accent);
    box-shadow: 0 0 15px var(--suma-shadow);
}

.score-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--suma-border);
}

.score-header h4 {
    margin: 0;
    color: var(--suma-accent);
    font-size: 1.1rem;
}

.score-info {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-label {
    font-size: 0.9rem;
    color: var(--suma-text-secondary);
    font-weight: 500;
}

.score-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--suma-accent);
    background: var(--suma-bg-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--suma-accent);
}

.score-grade {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--suma-accent);
    background: var(--suma-bg-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 2px solid var(--suma-accent);
    min-width: 60px;
    text-align: center;
}

.score-status {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    text-align: center;
    min-width: 80px;
}

.score-status.aprobado {
    background: var(--suma-history-bg);
    color: white;
}

.score-status.reprobado {
    background: var(--suma-clear-bg);
    color: white;
}

.score-status.neutral {
    background: var(--suma-button-bg);
    color: var(--suma-text-secondary);
}

/* Contenedor para resultado con botón borrar */
.result-row {
    display: flex;
    align-items: stretch;
    gap: 1rem;
}

/* Botón de borrar */
.delete-btn {
    background: var(--suma-clear-bg);
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.8;
    position: relative;
    overflow: hidden;
}

.delete-btn:hover {
    background: var(--suma-clear-hover);
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
}

.delete-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(229, 62, 62, 0.4);
}

/* Efecto de click en el botón */
.delete-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.delete-btn:active::before {
    width: 40px;
    height: 40px;
}

/* Icono SVG del botón */
.delete-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* Estados específicos del botón para diferentes temas */
.theme-light .delete-btn {
    background: #dc3545;
}

.theme-light .delete-btn:hover {
    background: #c82333;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.theme-rosa .delete-btn {
    background: #718096;
}

.theme-rosa .delete-btn:hover {
    background: #4a5568;
    box-shadow: 0 4px 12px rgba(113, 128, 150, 0.4);
}

.theme-neon .delete-btn {
    background: #ff0066;
    box-shadow: 0 0 10px rgba(255, 0, 102, 0.5);
}

.theme-neon .delete-btn:hover {
    background: #cc0052;
    box-shadow: 0 0 15px rgba(255, 0, 102, 0.8);
}

/* Animación de deshabilitado cuando no hay items */
.delete-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.delete-btn:disabled:hover {
    background: var(--suma-clear-bg);
    transform: none;
    box-shadow: none;
}

/* Botón de borrar principal (al lado del resultado) */
.main-delete-btn {
    width: 60px;
    height: auto;
    min-height: 80px;
    border-radius: 15px;
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.main-delete-btn svg {
    width: 24px;
    height: 24px;
}

.main-delete-btn:hover {
    transform: translateX(-2px);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.5);
}

.main-delete-btn:active {
    transform: translateX(0);
}

.calculator-container {
    background: rgba(var(--suma-bg-secondary-rgb), 0.85);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px var(--suma-shadow);
    border: 2px solid var(--suma-border);
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Display de operación */
.operation-display {
    background: var(--suma-bg-tertiary);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--suma-border);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#operation-text {
    font-size: 1.1rem;
    color: var(--suma-text-secondary);
    word-break: break-all;
    line-height: 1.4;
}

/* Display de resultado */
.result-display {
    background: var(--suma-bg-primary);
    border-radius: 15px;
    padding: 2rem 1rem;
    text-align: center;
    border: 2px solid var(--suma-accent);
    box-shadow: 0 0 20px var(--suma-shadow);
    flex: 1;
}

#result-text {
    font-size: 3rem;
    font-weight: bold;
    color: var(--suma-accent);
    text-shadow: 0 0 10px var(--suma-shadow);
}

/* Contador de items */
.items-counter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--suma-bg-tertiary);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--suma-border);
}

/* Botón de configuración */
.config-toggle-btn {
    background: var(--suma-accent);
    color: white;
    border: none;
    border-radius: 10px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.config-toggle-btn:hover {
    background: var(--suma-accent-hover);
    transform: translateY(-2px) rotate(90deg);
    box-shadow: 0 6px 20px var(--suma-shadow);
}

.config-toggle-btn:active {
    transform: translateY(0) rotate(90deg);
}

/* Display de nota inline */
.grade-display-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--suma-bg-primary);
    border: 2px solid var(--suma-accent);
    border-radius: 10px;
    padding: 0.5rem 0.8rem;
    flex-shrink: 0;
}

.grade-label {
    font-size: 0.9rem;
    color: var(--suma-text-secondary);
    font-weight: 500;
}

.grade-value-inline {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--suma-accent);
    min-width: 40px;
    text-align: center;
    transition: all 0.3s ease;
}

.grade-value-inline.aprobado {
    color: var(--suma-history-bg);
}

.grade-value-inline.reprobado {
    color: var(--suma-clear-bg);
}

/* Display de items */
.items-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.counter-label {
    font-size: 1rem;
    color: var(--suma-text-secondary);
    font-weight: 500;
}

#items-count {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--suma-accent);
    background: var(--suma-bg-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--suma-accent);
    min-width: 50px;
    text-align: center;
}

/* Teclado numérico */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.number-btn {
    background: var(--suma-number-bg);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.number-btn:hover {
    background: var(--suma-number-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.number-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Efecto de click */
.number-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.number-btn:active::before {
    width: 100px;
    height: 100px;
}

/* Botones decimales */
.decimal-btn {
    background: var(--suma-accent);
    font-size: 1.2rem;
    font-weight: 600;
}

.decimal-btn:hover {
    background: var(--suma-accent-hover);
}

/* Ajustes para temas específicos */
.theme-neon .decimal-btn {
    color: #0a0a0a;
    text-shadow: none;
}

.theme-rosa .decimal-btn {
    color: white;
}

/* Botones de acción */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.clear-btn {
    background: var(--suma-clear-bg);
    color: white;
}

.clear-btn:hover {
    background: var(--suma-clear-hover);
    transform: translateY(-2px);
}

.history-btn {
    background: var(--suma-history-bg);
    color: white;
}

.history-btn:hover {
    background: var(--suma-history-hover);
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-text {
    font-weight: 600;
}

/* Modal de historial */
.history-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.history-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: rgba(var(--suma-bg-secondary-rgb), 0.95);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid var(--suma-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--suma-border);
}

.modal-header h3 {
    color: var(--suma-text-primary);
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--suma-text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--suma-bg-tertiary);
    color: var(--suma-text-primary);
}

.history-container {
    min-height: 200px;
    margin-bottom: 1.5rem;
}

.no-history {
    text-align: center;
    color: var(--suma-text-secondary);
    font-style: italic;
    padding: 2rem;
}

.history-item {
    background: var(--suma-bg-tertiary);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--suma-border);
}

.history-operation {
    font-size: 1.1rem;
    color: var(--suma-text-primary);
    margin-bottom: 0.5rem;
}

.history-result {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--suma-accent);
}

.history-meta {
    font-size: 0.9rem;
    color: var(--suma-text-secondary);
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 2px solid var(--suma-border);
}

.btn-modal {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-error {
    background: var(--suma-clear-bg);
    color: white;
}

.btn-error:hover {
    background: var(--suma-clear-hover);
}

.btn-secondary {
    background: var(--suma-button-bg);
    color: var(--suma-text-primary);
    border: 1px solid var(--suma-border);
}

.btn-secondary:hover {
    background: var(--suma-button-hover);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        padding: 1.5rem 1rem;
    }
    
    .calculator-container {
        max-width: 600px;
        width: 100%;
    }
    
    .config-modal-content {
        width: 85%;
        max-width: 500px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0.5rem;
    }
    
    .calculator-container {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    #result-text {
        font-size: 2.5rem;
    }
    
    .main-delete-btn {
        width: 50px;
        min-height: 70px;
    }
    
    .main-delete-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .number-btn {
        font-size: 1.3rem;
        padding: 0.8rem;
    }
    
    .decimal-btn {
        font-size: 1.1rem;
    }
    
    .items-counter {
        padding: 0.75rem;
        gap: 0.6rem;
    }
    
    .config-toggle-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .grade-display-inline {
        padding: 0.4rem 0.7rem;
        gap: 0.4rem;
    }
    
    .grade-label {
        font-size: 0.85rem;
    }
    
    .grade-value-inline {
        font-size: 1.2rem;
        min-width: 38px;
    }
    
    .counter-label {
        font-size: 0.9rem;
    }
    
    #items-count {
        font-size: 1.2rem;
        padding: 0.35rem 0.7rem;
        min-width: 45px;
    }
    
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .config-modal-content {
        width: 90%;
        margin: 0.5rem;
    }
}

@media (max-width: 480px) {
    .calculator-container {
        padding: 1rem;
        gap: 1rem;
        border-radius: 15px;
    }
    
    #result-text {
        font-size: 2rem;
    }
    
    .result-row {
        gap: 0.5rem;
    }
    
    .main-delete-btn {
        width: 40px;
        min-height: 60px;
        border-radius: 10px;
    }
    
    .main-delete-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .items-counter {
        padding: 0.6rem;
        gap: 0.4rem;
        border-radius: 10px;
        flex-wrap: nowrap;
    }
    
    .config-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        border-radius: 8px;
        flex-shrink: 0;
    }
    
    .grade-display-inline {
        padding: 0.35rem 0.6rem;
        gap: 0.3rem;
        border-radius: 8px;
    }
    
    .grade-label {
        font-size: 0.75rem;
    }
    
    .grade-value-inline {
        font-size: 1.1rem;
        min-width: 35px;
    }
    
    .items-display {
        gap: 0.4rem;
    }
    
    .counter-label {
        font-size: 0.8rem;
    }
    
    #items-count {
        font-size: 1.1rem;
        padding: 0.3rem 0.5rem;
        min-width: 40px;
        border-radius: 6px;
    }
    
    .number-btn {
        font-size: 1.2rem;
        padding: 0.7rem;
        border-radius: 10px;
    }
    
    .decimal-btn {
        font-size: 1rem;
        padding: 0.6rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .action-btn {
        padding: 0.9rem;
        font-size: 0.95rem;
    }
    
    .modal-content {
        padding: 1.25rem;
        width: 95%;
        margin: 0.5rem;
    }
    
    .config-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .config-group {
        gap: 0.4rem;
    }
    
    .config-group label {
        font-size: 0.85rem;
    }
    
    .config-group input {
        padding: 0.7rem;
        font-size: 0.95rem;
    }
    
    .current-score-display {
        padding: 1.2rem;
    }
    
    .score-item {
        gap: 0.5rem;
    }
    
    .score-label {
        font-size: 0.85rem;
    }
    
    .score-value {
        font-size: 1rem;
        padding: 0.25rem 0.6rem;
    }
    
    .score-grade {
        font-size: 1.2rem;
        padding: 0.35rem 0.7rem;
        min-width: 55px;
    }
    
    .score-status {
        font-size: 0.85rem;
        padding: 0.25rem 0.6rem;
        min-width: 75px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-modal {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1.25rem;
    }
}

/* Animaciones */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.result-display.updated {
    animation: pulse 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-item {
    animation: slideIn 0.3s ease;
}
