/* ============================================================================
   ADF — TOOLS.CSS
   Design system unificado para as 9 calculadoras + Mercados Crypto
   Aplica-se a páginas com slug: simulador-irs, juros-compostos, orcamento-50-30-20,
   calculadora-euribor-spread, simulador-dca, calculadora-mais-valias,
   simulador-reforma, calculadora-inflacao, quiz-perfil-investidor, crypto

   Paleta: navy #0d1f3c · gold #c9a84c · cream #faf7f0 · success #2a7a5e · alert #c75c5c
   Fontes: Playfair Display (h2/h3 serif) + Source Sans 3 (body)
   ============================================================================ */

/* ===== WRAPPER GERAL ===== */
.tool-wrap {
    max-width: 920px;
    margin: 2rem auto 4rem;
    padding: 0 1rem;
    font-family: 'Source Sans 3', system-ui, sans-serif;
    color: #0d1f3c;
}

.tool-intro {
    font-size: 1.1rem;
    line-height: 1.65;
    color: rgba(13, 31, 60, 0.78);
    margin: 0 0 2rem;
    padding-left: 1rem;
    border-left: 3px solid #c9a84c;
    font-style: italic;
    font-family: 'Playfair Display', Georgia, serif;
}

/* ===== CARTÕES DE INPUT ===== */
.tool-card {
    background: #ffffff;
    border: 1px solid rgba(13, 31, 60, 0.08);
    border-radius: 14px;
    padding: 1.75rem;
    margin: 0 0 1.25rem;
    box-shadow: 0 2px 8px rgba(13, 31, 60, 0.03);
}

.tool-card h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0d1f3c;
    margin: 0 0 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid rgba(201, 168, 76, 0.25);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== GRELHAS DE CAMPOS ===== */
.tool-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.tool-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tool-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 720px) {
    .tool-grid-2, .tool-grid-3, .tool-grid-4 { grid-template-columns: 1fr; }
}

/* ===== CAMPOS (input/select/textarea) ===== */
.tool-field {
    display: flex;
    flex-direction: column;
}

.tool-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(13, 31, 60, 0.75);
    margin-bottom: 0.4rem;
    letter-spacing: 0.2px;
}

.tool-field input,
.tool-field select,
.tool-field textarea {
    width: 100%;
    padding: 0.7rem 0.95rem;
    font-family: inherit;
    font-size: 1rem;
    color: #0d1f3c;
    background: #ffffff;
    border: 1.5px solid rgba(13, 31, 60, 0.15);
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    line-height: 1.4;
}

.tool-field input:focus,
.tool-field select:focus,
.tool-field textarea:focus {
    outline: none;
    border-color: #c9a84c;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18);
}

.tool-field input[type="number"]::-webkit-inner-spin-button,
.tool-field input[type="number"]::-webkit-outer-spin-button {
    opacity: 0.6;
}

.tool-field-hint {
    font-size: 0.78rem;
    color: rgba(13, 31, 60, 0.55);
    margin-top: 0.35rem;
}

/* ===== BOTÃO PRINCIPAL ===== */
.tool-btn {
    display: block;
    width: 100%;
    padding: 1rem 2rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: #faf7f0;
    background: #0d1f3c;
    border: 2px solid #0d1f3c;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.1s ease, box-shadow 0.18s ease;
    margin: 1.5rem 0;
    text-transform: uppercase;
}

.tool-btn:hover {
    background: #c9a84c;
    border-color: #c9a84c;
    color: #0d1f3c;
    box-shadow: 0 6px 16px rgba(201, 168, 76, 0.3);
}

.tool-btn:active {
    transform: translateY(1px);
}

.tool-btn-secondary {
    background: transparent;
    color: #0d1f3c;
}

.tool-btn-secondary:hover {
    background: #0d1f3c;
    color: #faf7f0;
}

/* ===== RESULTADO ===== */
.tool-result {
    background: linear-gradient(135deg, #faf7f0 0%, #f5f0e0 100%);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 14px;
    padding: 2rem;
    margin: 1.5rem 0;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.5s ease, padding 0.3s ease;
    padding-top: 0;
    padding-bottom: 0;
}

.tool-result.show {
    opacity: 1;
    max-height: 2000px;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.tool-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tool-result-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.1rem 1.25rem;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid rgba(201, 168, 76, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tool-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(13, 31, 60, 0.08);
}

.tool-result-item .val {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.85rem;
    font-weight: 600;
    color: #0d1f3c;
    line-height: 1.1;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
    word-break: break-word;
}

.tool-result-item .lbl {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(13, 31, 60, 0.6);
}

/* Variantes de cor por contexto */
.tool-result-item.positive .val { color: #2a7a5e; }
.tool-result-item.negative .val { color: #c75c5c; }
.tool-result-item.gold .val { color: #c9a84c; }

/* ===== BARRA DE PROGRESSO ===== */
.tool-bar-wrap {
    margin: 1rem 0 1.25rem;
}

.tool-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(13, 31, 60, 0.75);
    margin-bottom: 0.5rem;
}

.tool-bar-label span:last-child {
    color: #c9a84c;
    font-size: 1rem;
}

.tool-bar-bg {
    height: 10px;
    background: rgba(13, 31, 60, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.tool-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #c9a84c 0%, #d4b65e 50%, #c9a84c 100%);
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== NOTA / TEXTO INFO ===== */
.tool-note {
    margin-top: 1.25rem;
    padding: 0.85rem 1.1rem;
    background: rgba(201, 168, 76, 0.1);
    border-left: 3px solid #c9a84c;
    border-radius: 6px;
    font-size: 0.92rem;
    color: rgba(13, 31, 60, 0.85);
    line-height: 1.5;
}

/* ===== TABELAS DE BREAKDOWN ===== */
.tool-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.93rem;
}

.tool-table th {
    background: #0d1f3c;
    color: #faf7f0;
    font-weight: 600;
    text-align: left;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.tool-table th:first-child { border-top-left-radius: 8px; }
.tool-table th:last-child { border-top-right-radius: 8px; }

.tool-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgba(13, 31, 60, 0.08);
}

.tool-table tr:nth-child(even) td {
    background: rgba(250, 247, 240, 0.5);
}

.tool-table tr:last-child td {
    border-bottom: none;
    font-weight: 600;
    background: rgba(201, 168, 76, 0.1);
}

/* ===== DISCLAIMER ===== */
.tool-disclaimer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(13, 31, 60, 0.15);
    font-size: 0.82rem;
    color: rgba(13, 31, 60, 0.55);
    font-style: italic;
    line-height: 1.5;
    text-align: center;
}

/* ============================================================================
   QUIZ ESPECÍFICO (perfil-investidor)
   ============================================================================ */
.quiz-progress {
    height: 6px;
    background: rgba(13, 31, 60, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin: 1rem 0 2rem;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c9a84c, #d4b65e);
    transition: width 0.4s ease;
    border-radius: 999px;
}

.quiz-question {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #0d1f3c;
    margin: 0 0 1.5rem;
    line-height: 1.35;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.05rem 1.25rem;
    background: #ffffff;
    border: 2px solid rgba(13, 31, 60, 0.1);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    color: #0d1f3c;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    text-align: left;
    line-height: 1.5;
    width: 100%;
    font-family: inherit;
}

.quiz-option:hover {
    border-color: #c9a84c;
    background: rgba(201, 168, 76, 0.05);
    transform: translateX(2px);
}

.quiz-option.selected {
    border-color: #c9a84c;
    background: rgba(201, 168, 76, 0.1);
}

.quiz-option-letter {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(201, 168, 76, 0.15);
    color: #8a7330;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.quiz-option.selected .quiz-option-letter {
    background: #c9a84c;
    color: #ffffff;
}

.quiz-result-profile {
    text-align: center;
    padding: 2rem 1rem;
}

.quiz-result-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: #c9a84c;
    color: #0d1f3c;
    font-weight: 700;
    border-radius: 999px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 1rem;
}

.quiz-result-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 600;
    color: #0d1f3c;
    margin: 0 0 1rem;
    line-height: 1.1;
}

/* ============================================================================
   CRYPTO DASHBOARD ESPECÍFICO (slug: crypto)
   ============================================================================ */
.crypto-wrap {
    max-width: 1100px;
    margin: 2rem auto 4rem;
    padding: 0 1rem;
}

.crypto-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.crypto-header h1,
.crypto-header h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 600;
    color: #0d1f3c;
    margin: 0;
}

.crypto-update {
    font-size: 0.85rem;
    color: rgba(13, 31, 60, 0.6);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.crypto-update::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #2a7a5e;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* Fear & Greed gauge */
.crypto-fear-greed {
    background: #ffffff;
    border: 1px solid rgba(13, 31, 60, 0.08);
    border-radius: 14px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.crypto-fg-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    margin: 0.5rem 0;
    background: linear-gradient(90deg, #c75c5c, #c9a84c, #2a7a5e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.crypto-fg-label {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #c9a84c;
}

.crypto-fg-scale {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin-top: 1.5rem;
    border-radius: 999px;
    overflow: hidden;
    height: 10px;
    background: linear-gradient(90deg, #c75c5c 0%, #d68a5e 25%, #c9a84c 50%, #8aa854 75%, #2a7a5e 100%);
    position: relative;
}

.crypto-fg-marker {
    position: absolute;
    top: -4px;
    width: 18px;
    height: 18px;
    background: #0d1f3c;
    border: 3px solid #faf7f0;
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 0.5s ease;
}

.crypto-fg-scale-labels {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin-top: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(13, 31, 60, 0.5);
    letter-spacing: 1px;
}

.crypto-fg-scale-labels span:nth-child(1) { text-align: left; }
.crypto-fg-scale-labels span:nth-child(2) { text-align: left; }
.crypto-fg-scale-labels span:nth-child(3) { text-align: center; }
.crypto-fg-scale-labels span:nth-child(4) { text-align: right; }
.crypto-fg-scale-labels span:nth-child(5) { text-align: right; }

/* Grid de moedas */
.crypto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.crypto-card {
    background: #ffffff;
    border: 1px solid rgba(13, 31, 60, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.crypto-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(13, 31, 60, 0.08);
}

.crypto-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.crypto-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(201, 168, 76, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #8a7330;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.crypto-card img.crypto-card-icon {
    background: transparent;
}

.crypto-card-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0d1f3c;
    margin: 0;
    line-height: 1.2;
}

.crypto-card-symbol {
    font-size: 0.78rem;
    color: rgba(13, 31, 60, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.crypto-card-price {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.65rem;
    font-weight: 600;
    color: #0d1f3c;
    margin: 0.5rem 0 0.35rem;
    line-height: 1.1;
}

.crypto-card-change {
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.crypto-card-change.positive,
.price-up {
    color: #2a7a5e;
}

.crypto-card-change.negative,
.price-down {
    color: #c75c5c;
}

.crypto-card-change::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

.crypto-card-change.positive::before {
    border-bottom: 7px solid #2a7a5e;
}

.crypto-card-change.negative::before {
    border-top: 7px solid #c75c5c;
}

.crypto-card-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(13, 31, 60, 0.08);
    font-size: 0.78rem;
    color: rgba(13, 31, 60, 0.6);
}

.crypto-card-stat {
    display: flex;
    flex-direction: column;
}

.crypto-card-stat-val {
    color: #0d1f3c;
    font-weight: 600;
    margin-top: 0.1rem;
}

/* Loading state */
.crypto-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(13, 31, 60, 0.5);
}

.crypto-loading::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(201, 168, 76, 0.3);
    border-top-color: #c9a84c;
    border-radius: 50%;
    margin-left: 0.5rem;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

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

/* ============================================================================
   DARK MODE
   ============================================================================ */
[data-theme="dark"] .tool-wrap,
[data-theme="dark"] .crypto-wrap {
    color: #faf7f0;
}

[data-theme="dark"] .tool-card,
[data-theme="dark"] .crypto-fear-greed,
[data-theme="dark"] .crypto-card {
    background: rgba(13, 31, 60, 0.5);
    border-color: rgba(250, 247, 240, 0.08);
}

[data-theme="dark"] .tool-card h3,
[data-theme="dark"] .crypto-card-name,
[data-theme="dark"] .crypto-card-price,
[data-theme="dark"] .crypto-header h1,
[data-theme="dark"] .crypto-header h2,
[data-theme="dark"] .quiz-question,
[data-theme="dark"] .quiz-result-name {
    color: #faf7f0;
}

[data-theme="dark"] .tool-field label,
[data-theme="dark"] .tool-bar-label {
    color: rgba(250, 247, 240, 0.85);
}

[data-theme="dark"] .tool-field input,
[data-theme="dark"] .tool-field select,
[data-theme="dark"] .tool-field textarea,
[data-theme="dark"] .quiz-option {
    background: rgba(250, 247, 240, 0.05);
    color: #faf7f0;
    border-color: rgba(250, 247, 240, 0.2);
}

[data-theme="dark"] .tool-result {
    background: linear-gradient(135deg, rgba(13, 31, 60, 0.6) 0%, rgba(13, 31, 60, 0.4) 100%);
}

[data-theme="dark"] .tool-result-item {
    background: rgba(13, 31, 60, 0.6);
    border-color: rgba(201, 168, 76, 0.25);
}

[data-theme="dark"] .tool-result-item .val {
    color: #faf7f0;
}

[data-theme="dark"] .tool-result-item.gold .val {
    color: #c9a84c;
}

[data-theme="dark"] .tool-table tr:nth-child(even) td {
    background: rgba(250, 247, 240, 0.04);
}

[data-theme="dark"] .tool-table td {
    border-bottom-color: rgba(250, 247, 240, 0.08);
}

[data-theme="dark"] .crypto-card-stats {
    border-top-color: rgba(250, 247, 240, 0.08);
}

[data-theme="dark"] .crypto-card-stat-val {
    color: #faf7f0;
}

[data-theme="dark"] .crypto-update,
[data-theme="dark"] .crypto-card-symbol,
[data-theme="dark"] .crypto-card-stats {
    color: rgba(250, 247, 240, 0.6);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 720px) {
    .tool-wrap {
        margin: 1rem auto 3rem;
    }
    .tool-card {
        padding: 1.25rem;
    }
    .tool-card h3 {
        font-size: 1.1rem;
    }
    .tool-result {
        padding: 1.5rem;
    }
    .tool-result.show {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    .tool-result-item .val {
        font-size: 1.5rem;
    }
    .quiz-question {
        font-size: 1.2rem;
    }
    .crypto-fg-value {
        font-size: 3rem;
    }
    .crypto-card-price {
        font-size: 1.4rem;
    }
}

/* ============================================================================
   FIM ADF — TOOLS.CSS
   ============================================================================ */
