.calc-conversor-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding: 20px;
}

.calc-box, .conversores-box {
    background-color: #ffffff; /* cards brancos como no template */
    color: #03396c; /* tom de texto coerente com cabeçalho/rodapé */
    padding: 20px;
    border-radius: 12px;
    flex: 1 1 300px;
    max-width: 520px;
    box-shadow: 0 8px 24px rgba(3,57,108,0.06);
    border: 1px solid rgba(3,57,108,0.04);
}

h2, h3 {
    text-align: center;
    margin: 5px auto;
    color: #03396c; /* visível em cards brancos */
    font-weight: 700;
}

#calc-display {
    width: 100%;
    padding: 12px 14px;
    font-size: 1.4rem;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid rgba(3,57,108,0.08);
    background: #f8fbff;
    color: #03396c;
    text-align: right;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

button.btn {
    padding: 10px 14px;
    font-size: calc(1.05rem - 2px);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, #0077b6, #00a8e8);
    color: #fff;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 6px 18px rgba(3,57,108,0.08);
    font-weight: 600;
}

button.btn:hover {
    transform: translateY(-2px);
}

button.eq {
    grid-column: span 4;
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 8px 20px rgba(16,185,129,0.12);
}

button.eq:hover {
    transform: translateY(-2px);
}

.conversor {
    margin-bottom: 20px;
}

/* Calculadora: linha superior de botões (Limpar, parênteses) */
.top-btn {
    background: #f3f6fb;
    color: #03396c;
    border: 1px solid rgba(3,57,108,0.06);
    box-shadow: none;
}

.top-btn.limpar {
    grid-column: span 2;
}

.calc-history {
    margin-top: 16px;
    background: transparent;
    border-top: 1px dashed rgba(3,57,108,0.06);
    padding-top: 12px;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 360px;
    overflow: auto;
}

.history-item {
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
    background: rgba(3,57,108,0.03);
    color: #03396c;
    cursor: pointer;
    font-size: 0.95rem;
}

.history-item:hover { background: rgba(3,57,108,0.06); }

.conversor input, .conversor select {
    width: calc(50% - 10px);
    padding: 10px 12px;
    margin: 6px 6px 12px 0;
    border-radius: 8px;
    border: 1px solid rgba(3,57,108,0.08);
    background: #f8fbff;
    color: #03396c;
}

.conversor input:focus, .conversor select:focus, #calc-display:focus {
    outline: 3px solid rgba(0,120,182,0.12);
    outline-offset: 2px;
}

.conversor button {
    padding: 10px 12px;
    background: linear-gradient(135deg, #0077b6, #00a8e8);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 6px;
    font-weight: 600;
}

.conversor button:hover {
    transform: translateY(-1px);
}

#medida-resultado, #moeda-resultado {
    margin-top: 10px;
    font-weight: bold;
}

/* Estado desabilitado e acessibilidade */
button[disabled], .conversor button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Visually hidden (for screen readers) */
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap; /* added line */
}

/* Small inline loader for buttons (using ::after) */
.loading::after {
    content: '';
    display: inline-block;
    margin-left: 8px;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.6);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsivo */
@media (max-width: 900px) {
    .calc-conversor-container {
        flex-direction: column;
        align-items: center;
    }
}
