/**
 * ferramenta.css - Estilos base para a pagina wrapper de ferramentas
 * Extraido do CSS inline de ferramenta.php (Fase 1.1 - Melhoria Mobile/PWA)
 *
 * Este arquivo contem APENAS estilos desktop/base.
 * Estilos mobile estao em ferramenta-mobile.css
 */

/* ==================== PAGE BASE ==================== */
.ferramenta-page {
    background-color: #f8f9fa;
}

.ferramenta-layout {
    max-width: 1200px;
    margin: 0 auto;
}

/* ==================== HEADER (legacy, usado por ferramentas antigas) ==================== */
.ferramenta-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 20px 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.8);
    position: relative;
    overflow: hidden;
}

.ferramenta-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ferramenta-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.ferramenta-icon {
    font-size: 2.5rem;
    text-align: center;
    min-width: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.2));
}

.ferramenta-details h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: #2d3748;
    font-weight: 700;
    line-height: 1.2;
}

.ferramenta-description {
    font-size: 0.95rem;
    color: #718096;
    line-height: 1.5;
    margin-bottom: 12px;
}

/* ==================== META / TAGS ==================== */
.ferramenta-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 4px 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    color: #4a5568;
}

.meta-label {
    font-weight: 600;
    color: #2d3748;
}

.canal-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.canal-link:hover {
    color: #764ba2;
}

.ferramenta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #4a5568;
    font-weight: 500;
    border: 1px solid rgba(203, 213, 224, 0.3);
}

/* ==================== ACTION BUTTONS (legacy) ==================== */
.ferramenta-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-favorite,
.btn-share {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-favorite {
    background: #6c757d;
    color: white;
}

.btn-share {
    background: #17a2b8;
    color: white;
}

/* ==================== TOOL INTERFACE ==================== */
.ferramenta-interface {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.interface-container {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
}

/* ==================== FORM STYLES ==================== */
.tool-form h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.required {
    color: #dc3545;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
}

.range-value {
    display: inline-block;
    margin-left: 10px;
    font-weight: bold;
    color: #667eea;
}

.help-text {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.btn-process,
.btn-reset {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-process {
    background: #f39c12;
    color: white;
    flex: 1;
}

.btn-reset {
    background: #6c757d;
    color: white;
}

/* ==================== TOOL RESULT ==================== */
.tool-result {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
}

.tool-result h3 {
    margin-bottom: 15px;
    color: #333;
}

.result-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    min-height: 100px;
}

.loading {
    text-align: center;
    font-size: 1.1rem;
    color: #667eea;
}

.result-success {
    color: #28a745;
    font-weight: bold;
    margin-bottom: 10px;
}

.result-data {
    margin: 15px 0;
}

.data-item {
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.result-summary {
    background: #e7f3ff;
    padding: 10px;
    border-radius: 4px;
    color: #0066cc;
}

.result-actions {
    display: flex;
    gap: 10px;
}

.btn-copy,
.btn-download,
.btn-share {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-copy {
    background: #17a2b8;
    color: white;
}

.btn-download {
    background: #28a745;
    color: white;
}

/* ==================== INSTRUCOES ==================== */
.ferramenta-instrucoes {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.ferramenta-instrucoes h2 {
    margin-bottom: 20px;
    color: #333;
}

.instrucoes-content {
    line-height: 1.6;
    color: #666;
}

/* ==================== FERRAMENTAS RELACIONADAS ==================== */
.ferramentas-relacionadas {
    margin-top: 32px;
    padding: 0;
    background: transparent;
}

.relacionadas-header {
    margin-bottom: 24px;
}

.relacionadas-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.relacionadas-subtitle {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
    font-weight: 400;
}

.relacionadas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Cards hidden by the orphan-trim script */
.relacionada-card.relacionada-hidden {
    display: none;
}

/* Card — entire card is a link */
.relacionada-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.relacionada-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.2);
}

/* Image */
.relacionada-img {
    position: relative;
    height: 120px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.relacionada-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.relacionada-card:hover .relacionada-img img {
    transform: scale(1.06);
}

/* Placeholder when no image */
.relacionada-img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.relacionada-img--placeholder span {
    font-size: 2.2rem;
    filter: grayscale(0.2);
    opacity: 0.8;
}

/* Body */
.relacionada-body {
    padding: 14px 14px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.relacionada-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 6px 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.relacionada-desc {
    font-size: 0.78rem;
    color: #718096;
    line-height: 1.45;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* CTA */
.relacionada-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    margin: 4px 10px 10px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.relacionada-card:hover .relacionada-cta {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.relacionada-cta-arrow {
    transition: transform 0.2s ease;
}

.relacionada-card:hover .relacionada-cta-arrow {
    transform: translateX(3px);
}

/* ==================== TOOL TOOLBAR [TOOLS_ZERO_PAYWALL] ==================== */
.ferramenta-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    margin: 0 0 8px 0;
    background: transparent;
    gap: 10px;
}

.toolbar-canal-link {
    font-size: 0.85rem;
    color: #667eea;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-canal-link:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
    text-decoration: none;
    color: #5a67d8;
}

.toolbar-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.toolbar-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    line-height: 1;
    color: #64748b;
}

.toolbar-btn:hover {
    background: #f0f4ff;
    border-color: #cbd5e1;
}

/* ==================== TOKEN INFO WIDGET ==================== */
.token-info-widget {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.82rem;
    color: #475569;
    position: relative;
}

.token-info-widget:hover {
    border-color: #a78bfa;
    background: #faf5ff;
}

.token-info-widget.has-active-cost {
    border-color: #d97706;
    background: #fffbeb;
    animation: tiwPulse 2s ease-in-out 3;
}

@keyframes tiwPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
    50% { box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15); }
}

.tiw-icon { font-size: 1rem; flex-shrink: 0; }
.tiw-label { color: #94a3b8; font-size: 0.78rem; }
.tiw-balance { font-weight: 600; color: #334155; font-family: 'Courier New', monospace; }
.tiw-balance.tiw-updated { animation: tiwBalUpdate 0.6s ease; }

@keyframes tiwBalUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: #7c3aed; }
    100% { transform: scale(1); }
}

/* ==================== TOKEN INFO MODAL ==================== */
.tiw-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.tiw-modal-backdrop.active {
    display: flex;
}

.tiw-modal {
    background: #fff;
    border-radius: 16px;
    width: 90vw;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}

.tiw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.tiw-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
}

.tiw-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.tiw-modal-close:hover { color: #475569; }

.tiw-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.tiw-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 0;
}

.tiw-tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 500;
    transition: all 0.2s;
}

.tiw-tab-btn.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

.tiw-tab-btn:hover:not(.active) { color: #64748b; }

.tiw-tab-content { display: none; }
.tiw-tab-content.active { display: block; }

.tiw-total-balance {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
}

.tiw-total-balance small {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 400;
}

.tiw-buckets {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tiw-bucket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.85rem;
}

.tiw-bucket-name { color: #64748b; }
.tiw-bucket-val { font-weight: 600; color: #334155; font-family: 'Courier New', monospace; }

.tiw-warning {
    margin-top: 12px;
    padding: 10px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #92400e;
}

.tiw-cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.tiw-cost-row:last-child { border-bottom: none; }
.tiw-cost-name { color: #475569; }
.tiw-cost-val { font-weight: 600; color: #7c3aed; }

.tiw-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
    gap: 8px;
}

.tiw-btn-manage {
    padding: 8px 16px;
    background: #7c3aed;
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.tiw-btn-manage:hover { background: #6d28d9; color: white; text-decoration: none; }

.tiw-btn-close {
    padding: 8px 16px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.tiw-btn-close:hover { background: #e2e8f0; }

/* ==================== @deprecated 2026-02-21 [TOOLS_ZERO_PAYWALL] ====================
 * Seções abaixo foram deprecadas com a reestruturação de acesso a ferramentas.
 * Stats compact bar, action buttons compact e token balance substituídos por
 * ferramenta-toolbar + token-info-widget acima.
 *
.ferramenta-stats-compact { ... }
.btn-canal-compact { ... }
.stats-compact-info { ... }
.stat-compact-item { ... }
.stat-compact-icon { ... }
.stat-compact-label { ... }
.stat-compact-value { ... }
.ferramenta-actions-compact { ... }
.btn-favorite-compact, .btn-share-compact { ... }
.balance-amount { ... }
.balance-updated { ... }
.loading-balance { ... }
.success-balance { ... }
.error-balance { ... }
.free-tag { ... }
.tokens-warning { ... }
==================== Fim da seção deprecada ==================== */

/* ==================== BREADCRUMB TOOL ==================== */
.breadcrumb-tool {
    margin: -30px -30px 20px -30px;
    border-radius: 0;
    width: calc(100% + 60px);
}

/* Hide duplicate breadcrumbs from views when centralized one is rendered */
.interface-container > .breadcrumb-tool ~ .breadcrumb-tool {
    display: none;
}

.ferramenta-page-description {
    color: #6c757d;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: -4px 0 16px 0;
    padding: 0 4px;
}

/* ==================== DISCLAIMER ==================== */
.ferramenta-disclaimer {
    background: rgba(255, 193, 7, 0.05);
    border-top: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 0 0 12px 12px;
    padding: 15px 20px;
    margin: 20px -30px -30px -30px;
}

.disclaimer-text {
    margin: 0;
    color: #6c757d;
    line-height: 1.4;
    text-align: center;
}

.disclaimer-text small {
    font-size: 0.8rem;
}

.disclaimer-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.disclaimer-text a:hover {
    text-decoration: underline;
}

/* ==================== TOKENS MODAL ==================== */
@keyframes tokensModalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==================== DESKTOP RESPONSIVE ==================== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .ferramenta-info {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .ferramenta-details h1 {
        font-size: 1.6rem;
    }

    .ferramenta-meta {
        justify-content: center;
    }

    .meta-item {
        font-size: 0.8rem;
        padding: 3px 6px;
    }

    /* @deprecated 2026-02-21 [TOOLS_ZERO_PAYWALL]
    .ferramenta-stats-compact {
        padding: 8px 12px;
        margin: 0 0 10px 0;
    } */

    .ferramenta-toolbar {
        padding: 6px 12px;
    }

    .tiw-label { display: none; }

    .toolbar-btn {
        padding: 5px 8px;
        font-size: 0.9rem;
    }

    .interface-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

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

    .relacionadas-grid {
        gap: 12px;
    }

    .relacionada-img {
        height: 90px;
    }

    .relacionadas-header h2 {
        font-size: 1.25rem;
    }

    .ferramenta-disclaimer {
        padding: 12px 15px;
        margin: 15px -20px -20px -20px;
    }

    .disclaimer-text small {
        font-size: 0.75rem;
    }
}

/* ==================== TOKENS MODAL RESPONSIVE ==================== */
@media (max-width: 768px) {
    .tokens-modal-content {
        width: 95%;
        margin: 20px;
    }

    .tokens-modal-header {
        padding: 15px 20px;
    }

    .tokens-modal-header h2 {
        font-size: 1.3rem;
    }

    .tokens-modal-body {
        padding: 20px;
    }

    .tokens-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .solutions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tokens-actions {
        flex-direction: column;
        gap: 8px;
    }

    .btn-tokens-info,
    .btn-tokens-help,
    .btn-tokens-premium,
    .btn-tokens-refresh {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .tokens-modal-content {
        width: 98%;
        margin: 10px;
    }

    .tokens-modal-header {
        padding: 12px 15px;
    }

    .tokens-modal-header h2 {
        font-size: 1.2rem;
    }

    .tokens-modal-body {
        padding: 15px;
    }

    .tokens-info {
        padding: 15px;
    }

    .tokens-icon {
        font-size: 2rem;
    }

    .solution-item {
        padding: 12px;
    }

    .solution-icon {
        font-size: 1.5rem;
    }

    .ferramenta-disclaimer {
        padding: 10px 12px;
        margin: 12px -15px -15px -15px;
    }

    .disclaimer-text small {
        font-size: 0.7rem;
    }

    .relacionadas-grid {
        gap: 10px;
    }

    .relacionada-img {
        height: 80px;
    }

    .relacionada-body {
        padding: 10px 12px 6px;
    }

    .relacionada-title {
        font-size: 0.85rem;
    }

    .relacionada-desc {
        font-size: 0.74rem;
    }

    .relacionada-cta {
        margin: 2px 8px 8px;
        padding: 7px 10px;
        font-size: 0.75rem;
    }
}

/* ── Abbreviation Tooltip (FOWLR, PAR, etc.) ── */
abbr.abbr-tip {
    position: relative;
    text-decoration: none;
    border-bottom: 1.5px dotted currentColor;
    cursor: help;
    font-weight: inherit;
}

abbr.abbr-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    max-width: 300px;
    padding: 10px 14px;
    background: #1e293b;
    color: #f1f5f9;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.45;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    white-space: normal;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 9999;
}

abbr.abbr-tip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 9999;
}

abbr.abbr-tip:hover::after,
abbr.abbr-tip:hover::before,
abbr.abbr-tip:focus::after,
abbr.abbr-tip:focus::before {
    opacity: 1;
    visibility: visible;
}

/* Mobile: tap to show, reposition if overflows */
@media (max-width: 640px) {
    abbr.abbr-tip::after {
        min-width: 180px;
        max-width: 250px;
        font-size: 0.78rem;
        left: 0;
        transform: translateX(0);
    }

    abbr.abbr-tip::before {
        left: 20px;
        transform: translateX(0);
    }
}
