/* =========================================================
   CALCULADORA DE REGRA DE TRÊS
   Estilos exclusivos da ferramenta
   ========================================================= */


/* =========================================================
   FERRAMENTA
   ========================================================= */

.rule-tool {
    max-width: 900px;
    margin: 0 auto;
}


/* =========================================================
   TIPO DE RELAÇÃO
   ========================================================= */

.relation-box {
    margin-bottom: 25px;
}

.relation-box > label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #0f172a;
}

.relation-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.relation-option {
    position: relative;
}

.relation-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.relation-option label {
    display: block;
    min-height: 100%;
    box-sizing: border-box;
    padding: 16px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.relation-option label:hover {
    border-color: #94a3b8;
}

.relation-option input:focus + label {
    outline: 2px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}

.relation-option input:checked + label {
    border-color: #2563eb;
    box-shadow: inset 0 0 0 1px #2563eb;
    background: #eff6ff;
}

.relation-title {
    display: block;
    margin-bottom: 5px;
    color: #0f172a;
    font-weight: 700;
}

.relation-description {
    display: block;
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.5;
}


/* =========================================================
   DESCRIÇÃO DA RELAÇÃO
   ========================================================= */

.rule-description {
    margin-bottom: 25px;
    padding: 15px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.55;
}


/* =========================================================
   GRANDEZAS
   ========================================================= */

.quantities {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.quantity-card {
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.quantity-card h2 {
    margin: 0 0 18px;
    color: #0f172a;
    font-size: 1.15rem;
}

.quantity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 10px;
    margin-bottom: 16px;
}

.quantity-row:last-child {
    margin-bottom: 0;
}

.quantity-label {
    display: block;
    margin-bottom: 6px;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
}

.rule-input,
.rule-select {
    width: 100%;
    min-height: 43px;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #1e293b;
    font-family: inherit;
    font-size: 0.94rem;
}

.rule-input {
    padding: 8px 11px;
}

.rule-select {
    padding: 8px 9px;
}

.rule-input:focus,
.rule-select:focus {
    outline: 2px solid rgba(37, 99, 235, 0.2);
    outline-offset: 1px;
    border-color: #2563eb;
}

.unknown-field {
    background: #f1f5f9;
}

.unknown-field::placeholder {
    color: #64748b;
}


/* =========================================================
   BOTÕES
   ========================================================= */

.rule-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 25px;
}

.rule-button {
    min-height: 43px;
    padding: 9px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.rule-button:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.rule-button:active {
    background: #f1f5f9;
}

.rule-button.primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.rule-button.primary:hover {
    border-color: #1d4ed8;
    background: #1d4ed8;
}


/* =========================================================
   EXEMPLOS
   ========================================================= */

.examples {
    margin-top: 35px;
}

.examples h2 {
    margin: 0 0 15px;
    color: #0f172a;
    font-size: 1.2rem;
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.example-button {
    display: block;
    width: 100%;
    min-height: 100%;
    box-sizing: border-box;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    color: inherit;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.example-button:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.example-button:active {
    transform: translateY(1px);
}

.example-title {
    display: block;
    margin-bottom: 5px;
    color: #0f172a;
    font-weight: 700;
}

.example-text {
    display: block;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.5;
}


/* =========================================================
   RESULTADO
   ========================================================= */

.rule-result {
    display: none;
    margin-top: 35px;
    padding-top: 30px;
    border-top: 1px solid #e2e8f0;
}

.rule-result.active {
    display: block;
}

.result-main {
    margin-bottom: 25px;
    padding: 26px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #eff6ff;
    text-align: center;
}

.result-label {
    margin-bottom: 8px;
    color: #475569;
    font-size: 0.94rem;
}

.result-value {
    color: #0f172a;
    font-size: 2.8rem;
    line-height: 1.1;
    font-weight: 700;
}

.result-description {
    margin-top: 12px;
    color: #475569;
    font-size: 0.98rem;
    line-height: 1.5;
}


/* =========================================================
   RESUMO
   ========================================================= */

.result-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.summary-card {
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.summary-label {
    margin-bottom: 6px;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.4;
}

.summary-value {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
    word-break: break-word;
}


/* =========================================================
   FÓRMULA
   ========================================================= */

.formula-box {
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.formula-box h2 {
    margin: 0 0 10px;
    color: #0f172a;
    font-size: 1.15rem;
}

.formula {
    color: #334155;
    line-height: 1.7;
    word-break: break-word;
}


/* =========================================================
   AÇÕES DO RESULTADO
   ========================================================= */

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 25px;
}


/* =========================================================
   INFORMAÇÕES
   ========================================================= */

.tool-info-section {
    margin-top: 20px;
}

.tool-info h2 {
    margin-top: 30px;
    margin-bottom: 12px;
    color: #0f172a;
}

.tool-info h2:first-child {
    margin-top: 0;
}

.tool-info p {
    margin-bottom: 18px;
    color: #475569;
    line-height: 1.65;
}

.tool-notice {
    margin-top: 30px;
    padding: 16px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #475569;
    font-size: 0.88rem;
    line-height: 1.55;
}

.tool-notice strong {
    color: #1e40af;
}


/* =========================================================
   RESPONSIVIDADE
   ========================================================= */

@media (max-width: 700px) {

    .quantities {
        grid-template-columns: 1fr;
    }

    .result-summary {
        grid-template-columns: repeat(2, 1fr);
    }

}


@media (max-width: 560px) {

    .relation-options,
    .example-grid {
        grid-template-columns: 1fr;
    }

    .quantity-row {
        grid-template-columns: 1fr;
    }

    .result-summary {
        grid-template-columns: 1fr;
    }

    .rule-actions,
    .result-actions {
        flex-direction: column;
    }

    .rule-button {
        width: 100%;
    }

    .result-value {
        font-size: 2.3rem;
    }

    .quantity-card {
        padding: 16px;
    }

    .result-main {
        padding: 22px 16px;
    }

}


/* =========================================================
   IMPRESSÃO
   ========================================================= */

@media print {

    header,
    footer,
    .tool-breadcrumb,
    .tool-header,
    .relation-box,
    .rule-description,
    .quantities,
    .rule-actions,
    .examples,
    .result-actions,
    .ad-container {
        display: none !important;
    }

    .tool-page {
        padding: 0 !important;
    }

    .tool-section,
    .tool-info-section {
        margin: 0 !important;
        padding: 0 !important;
    }

    .rule-tool {
        max-width: none;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .rule-result {
        display: block !important;
        margin-top: 0;
        padding-top: 0;
        border: none;
    }

    .result-main {
        border: 1px solid #ccc;
        background: #ffffff;
    }

    .formula-box {
        background: #ffffff;
    }

    body {
        background: #ffffff;
    }

}