/* Estilos gerais da calculadora */
h2 {
    text-align: center;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin-bottom: 20px;
    font-weight: 400;
}

#scientific-calculator {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 25px;
    max-width: 600px;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    color: #333;
}

.calculator-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.mode-toggle {
    display: flex;
    gap: 5px;
}

.mode-btn {
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 8px 15px;
    color: #495057;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.calculator-display {
    background: #2c3e50;
    border: 1px solid #34495e;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

.expression-display {
    font-size: 1em;
    color: #95a5a6;
    min-height: 20px;
    text-align: right;
    margin-bottom: 10px;
}

#calculator-input {
    width: 100%;
    padding: 0;
    font-size: 2.5em;
    text-align: right;
    border: none;
    background: transparent;
    color: #ffffff;
    box-sizing: border-box;
    font-weight: 300;
}

#calculator-input:focus {
    outline: none;
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 8px;
}

.btn {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    font-weight: 500;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: #f8f9fa;
    border-color: #ced4da;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
    background: #e9ecef;
}

.btn.number {
    background: #ffffff;
    font-weight: 800;
    color: #333;
    font-size: 1.1em;
}

.btn.number:hover {
    background: #f8f9fa;
}

.btn.operator {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: 600;
}

.btn.operator:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn.operator.clear {
    background: #dc3545;
    border-color: #dc3545;
}

.btn.operator.clear:hover {
    background: #c82333;
    border-color: #c82333;
}

.btn.operator.equals {
    background: #28a745;
    border-color: #28a745;
    grid-column: span 1;
}

.btn.operator.equals:hover {
    background: #218838;
    border-color: #218838;
}

.btn.function {
    background: #f8f9fa;
    border-color: #e9ecef;
    font-size: 1.0em;
    color: #495057;
}

.btn.function:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.btn.function.special {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.btn.function.special:hover {
    background: #e0a800;
    border-color: #e0a800;
}

.btn.zero {
    grid-column: span 1;
}

/* Layout responsivo */
#scientific-calculator {
    width: 100%;
    max-width: 600px; /* Largura máxima para desktop */
    margin: 0 auto;
    box-sizing: border-box;
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 8px;
}

/* Ajustes para telas menores */
@media (max-width: 992px) {
    #scientific-calculator {
        max-width: 100%;
        padding: 10px;
    }
    
    .calculator-buttons {
        gap: 6px;
    }
    
    .btn {
        min-height: 30px;
        font-size: 0.85em;
        padding: 6px 2px;
    }
    
    #calculator-input {
        font-size: 1.8em;
    }
}

/* Ajustes para tablets */
@media (max-width: 768px) {
    .btn {
        min-height: 28px;
        font-size: 0.8em;
    }
    
    #calculator-input {
        font-size: 1.6em;
    }
}

/* Ajustes para celulares */
@media (max-width: 576px) {
    .calculator-buttons {
        gap: 4px;
    }
    
    .btn {
        min-height: 24px;
        font-size: 0.7em;
        padding: 4px 1px;
    }
    
    #calculator-input {
        font-size: 1.5em;
    }
    
    .expression-display {
        font-size: 0.8em;
    }
}

/* Ajustes para celulares pequenos */
@media (max-width: 360px) {
    .btn {
        min-height: 22px;
        font-size: 0.65em;
    }
    
    #calculator-input {
        font-size: 1.4em;
    }
}

/* Visor */
#scientific-calculator .calculator-display #calculator-input { color:#fff !important; }
#scientific-calculator .calculator-display .expression-display { color:#95a5a6 !important; }

/* Botões (texto) */
#scientific-calculator .btn { color:#333 !important; line-height:1.2; }
#scientific-calculator .btn.function { color:#495057 !important; }

/* Operadores (coluna azul, C e =) */
#scientific-calculator .btn.operator,
#scientific-calculator .btn.operator.clear,
#scientific-calculator .btn.operator.equals { color:#fff !important; }

/* Ícones/SVG herdam a cor do texto */
#scientific-calculator button svg { fill:currentColor !important; stroke:currentColor !important; }