/* Calculadora estilo Windows - Tema Claro */
.calculator-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: #f3f3f3;
}

.calculator-wrapper {
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    /* Enhanced shadow */
    padding: 0;
    width: 100%;
    max-width: 380px;
    /* Slightly reduced width */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 1px solid #e0e0e0;
    margin-top: 20px;
    /* Added top margin */
}

/* Header con botón Home */
.calculator-header {
    margin: 0;
    padding: 12px 16px;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-start;
}

.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #0078d4;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-home:hover {
    background: #106ebe;
}

.btn-home:active {
    background: #005a9e;
}

.btn-home i {
    font-size: 14px;
}

/* Display */
.calculator-display {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 0;
    padding: 24px 20px;
    margin: 0;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    border-left: none;
    border-right: none;
}

.calculator-display-history {
    color: #666666;
    font-size: 16px;
    min-height: 20px;
    margin-bottom: 8px;
    text-align: right;
    width: 100%;
    word-wrap: break-word;
    font-weight: 400;
}

.calculator-display-current {
    color: #000000;
    font-size: 56px;
    font-weight: 300;
    text-align: right;
    width: 100%;
    word-wrap: break-word;
    line-height: 1.2;
}

/* Botones */
.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    margin: 0;
    background: #e0e0e0;
    padding: 1px;
}

.btn-calc {
    border: none;
    border-radius: 0;
    font-size: 20px;
    font-weight: 400;
    padding: 24px 20px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    outline: none;
    background: #ffffff;
    color: #000000;
    border: none;
}

.btn-calc:hover {
    background: #f0f0f0;
}

.btn-calc:active {
    background: #e5e5e5;
}

/* Botones de números */
.btn-number {
    background: #ffffff;
    color: #000000;
}

.btn-number:hover {
    background: #f5f5f5;
}

.btn-number:active {
    background: #ebebeb;
}

/* Botones de operadores */
.btn-operator {
    background: #ffffff;
    color: #000000;
}

.btn-operator:hover {
    background: #f5f5f5;
}

.btn-operator:active {
    background: #ebebeb;
}

.btn-operator.active {
    background: #e5e5e5;
    color: #000000;
}

/* Botón igual - Azul destacado como Windows */
.btn-equals {
    background: #0078d4;
    color: #ffffff;
    grid-column: span 1;
}

.btn-equals:hover {
    background: #106ebe;
}

.btn-equals:active {
    background: #005a9e;
}

/* Botones de función */
.btn-function {
    background: #f8f8f8;
    color: #000000;
}

.btn-function:hover {
    background: #f0f0f0;
}

.btn-function:active {
    background: #e8e8e8;
}

/* Botón cero (ocupa 2 columnas) */
.btn-zero {
    grid-column: span 1;
}

/* Información */
.calculator-info {
    text-align: center;
    color: #999999;
    margin-top: 0;
    padding: 12px;
    background: #f8f8f8;
    border-top: 1px solid #e0e0e0;
}

.calculator-info small {
    font-size: 11px;
}

/* Animación para el display */
.calculator-display-current {
    transition: all 0.2s ease;
}

.calculator-display-current.updated {
    animation: pulse 0.2s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .calculator-wrapper {
        max-width: 100%;
    }

    .calculator-display {
        padding: 20px 16px;
        min-height: 120px;
    }

    .calculator-display-current {
        font-size: 42px;
    }

    .btn-calc {
        font-size: 18px;
        padding: 20px 16px;
    }
}

/* Soporte para teclado */
.btn-calc:focus {
    outline: 2px solid #0078d4;
    outline-offset: -2px;
}


/* ============================================
   DARK MODE
   ============================================ */
.calculator-container.dark-theme {
    background: transparent;
    /* Show the animated gradient from body */
    color: #e0e0e0;
}

.calculator-container.dark-theme .calculator-wrapper {
    background: rgba(30, 30, 46, 0.85);
    /* Glassmorphism background */
    backdrop-filter: blur(16px);
    border-color: rgba(138, 43, 226, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.calculator-container.dark-theme .calculator-header {
    background: transparent;
    border-bottom-color: rgba(138, 43, 226, 0.2);
    color: #ffffff;
}

.calculator-container.dark-theme .calculator-display {
    background: rgba(20, 20, 30, 0.4);
    border-color: rgba(138, 43, 226, 0.2);
}

.calculator-container.dark-theme .calculator-display-history {
    color: #aaaaaa;
}

.calculator-container.dark-theme .calculator-display-current {
    color: #ffffff;
}

.calculator-container.dark-theme .calculator-buttons {
    background: #2a2a2a;
    gap: 1px;
    border-color: #2a2a2a;
}

/* Botones modo oscuro */
.calculator-container.dark-theme .btn-calc {
    background: #3b3b3b;
    color: #ffffff;
    transition: background-color 0.1s ease;
}

.calculator-container.dark-theme .btn-calc:hover {
    background: #323232;
}

.calculator-container.dark-theme .btn-calc:active {
    background: #282828;
}

/* Números */
.calculator-container.dark-theme .btn-number {
    background: #131313;
    /* Darker black for numbers like Windows Calc */
    font-weight: 500;
}

.calculator-container.dark-theme .btn-number:hover {
    background: #2b2b2b;
}

/* Operadores y funciones */
.calculator-container.dark-theme .btn-operator,
.calculator-container.dark-theme .btn-function {
    background: #202020;
    color: #e0e0e0;
}

.calculator-container.dark-theme .btn-operator:hover,
.calculator-container.dark-theme .btn-function:hover {
    background: #323232;
}

.calculator-container.dark-theme .btn-operator:active,
.calculator-container.dark-theme .btn-function:active {
    background: #3b3b3b;
}

/* Igual */
.calculator-container.dark-theme .btn-equals {
    background: #0078d4;
    /* Keep blue */
    color: #ffffff;
}

.calculator-container.dark-theme .btn-equals:hover {
    background: #106ebe;
}

.calculator-container.dark-theme .btn-equals:active {
    background: #005a9e;
}

/* Info footer */
.calculator-container.dark-theme .calculator-info {
    background: transparent;
    border-top-color: rgba(138, 43, 226, 0.2);
    color: #888;
}

/* Scrollbar adjustment for dark mode if needed */
.calculator-container.dark-theme ::-webkit-scrollbar-track {
    background: #1f1f1f;
}

.calculator-container.dark-theme ::-webkit-scrollbar-thumb {
    background: #444;
}