/* =============================================================
   ETRAFFIC EXTENSIONS — CSS
   Extensões visuais para o módulo Estratégia de Tráfego
   ============================================================= */

/* ── Sub-tabs internas do módulo Estratégia ─────────────────── */
.etraffic-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.etraffic-tab-btn {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #94a3b8);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family, inherit);
    transition: all 0.22s ease;
    white-space: nowrap;
}

.etraffic-tab-btn:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary, #f1f5f9);
}

.etraffic-tab-btn.active {
    background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(109,40,217,0.15));
    color: #a78bfa;
    border: 1px solid rgba(124,58,237,0.35);
    box-shadow: 0 2px 10px rgba(124,58,237,0.15);
}

/* ── Painel de link do cliente ─────────────────────────────── */
.client-link-panel {
    background: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(59,130,246,0.04));
    border: 1px solid rgba(124,58,237,0.2);
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 20px;
    animation: evyFadeIn 0.3s ease;
}

.client-link-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.client-link-title {
    font-size: .92rem;
    font-weight: 800;
    color: var(--text-primary, #f1f5f9);
    display: flex;
    align-items: center;
    gap: 8px;
}

.client-link-url-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-family: 'Courier New', monospace;
    font-size: .81rem;
    color: #a78bfa;
    overflow: hidden;
}

.client-link-url-box span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-link-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-link-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 9px;
    border: 1.5px solid;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-family, inherit);
    transition: all 0.2s;
}

.btn-link-generate {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border-color: transparent;
    color: white;
    box-shadow: 0 3px 12px rgba(124,58,237,0.35);
}

.btn-link-generate:hover { transform: translateY(-1px); box-shadow: 0 5px 18px rgba(124,58,237,0.5); }

.btn-link-copy {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
    color: var(--text-secondary, #94a3b8);
}

.btn-link-copy:hover { background: rgba(255,255,255,0.08); color: var(--text-primary, #f1f5f9); }

.btn-link-resend {
    background: rgba(59,130,246,0.08);
    border-color: rgba(59,130,246,0.3);
    color: #60a5fa;
}

.btn-link-resend:hover { background: rgba(59,130,246,0.15); }

/* Status badges do link */
.link-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.link-status-pending {
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.3);
    color: #fbbf24;
}

.link-status-answered {
    background: rgba(5,150,105,0.12);
    border: 1px solid rgba(5,150,105,0.3);
    color: #10b981;
}

.link-status-editing {
    background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.3);
    color: #60a5fa;
}

/* ── Tabela de estratégias / respostas ────────────────────── */
.etraffic-table-wrapper {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    overflow: hidden;
}

.etraffic-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}

.etraffic-table thead th {
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.35);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 11px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    text-align: left;
    white-space: nowrap;
}

.etraffic-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.etraffic-table tbody tr:last-child { border-bottom: none; }
.etraffic-table tbody tr:hover { background: rgba(255,255,255,0.025); }

.etraffic-table tbody td {
    padding: 12px 14px;
    color: var(--text-secondary, #94a3b8);
    vertical-align: middle;
}

.etraffic-table tbody td:first-child { color: var(--text-primary, #f1f5f9); font-weight: 600; }

/* ── Filtros de tabela ────────────────────────────────────── */
.etraffic-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.etraffic-filter-input {
    flex: 1;
    min-width: 160px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.09);
    border-radius: 9px;
    padding: 8px 12px;
    color: var(--text-primary, #f1f5f9);
    font-size: .83rem;
    font-family: var(--font-family, inherit);
    outline: none;
    transition: border-color 0.2s;
}

.etraffic-filter-input:focus {
    border-color: rgba(124,58,237,0.5);
}

.etraffic-filter-input::placeholder { color: rgba(255,255,255,0.2); }

.etraffic-filter-select {
    /* Oculto — substituído pelo EtrafficSelect JS */
    display: none !important;
}

/* ── EtrafficSelect — dropdown customizado ──────────────────── */
.etraffic-select-wrapper {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.etraffic-select-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px 8px 12px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.09);
    border-radius: 9px;
    color: var(--text-secondary, #94a3b8);
    font-size: .83rem;
    font-family: var(--font-family, inherit);
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    user-select: none;
    white-space: nowrap;
    min-width: 148px;
}

.etraffic-select-trigger:hover {
    border-color: rgba(124,58,237,0.45);
    background: rgba(124,58,237,0.06);
    color: var(--text-primary, #f1f5f9);
}

.etraffic-select-wrapper.open .etraffic-select-trigger {
    border-color: rgba(124,58,237,0.6);
    background: rgba(124,58,237,0.08);
    color: #a78bfa;
}

.etraffic-select-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.etraffic-select-arrow {
    flex-shrink: 0;
    color: rgba(255,255,255,0.25);
    transition: transform 0.22s cubic-bezier(.34,1.3,.64,1), color 0.2s;
}

.etraffic-select-wrapper.open .etraffic-select-arrow {
    transform: rotate(180deg);
    color: #a78bfa;
}

/* Painel dropdown */
.etraffic-select-panel {
    position: fixed;
    z-index: 99999;
    background: #0e0e1a;
    border: 1.5px solid rgba(124,58,237,0.35);
    border-radius: 13px;
    box-shadow:
        0 0 0 1px rgba(124,58,237,0.1),
        0 20px 60px rgba(0,0,0,0.65),
        0 8px 24px rgba(124,58,237,0.12);
    padding: 5px;
    min-width: 200px;
    overflow: hidden;
    opacity: 0;
    transform: scaleY(0.88) translateY(-6px);
    transform-origin: top center;
    transition: opacity 0.18s ease, transform 0.2s cubic-bezier(.34,1.3,.64,1);
    pointer-events: none;
}

.etraffic-select-panel.visible {
    opacity: 1;
    transform: scaleY(1) translateY(0);
    pointer-events: all;
}

/* Item do dropdown */
.etraffic-select-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: .83rem;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    white-space: nowrap;
    border: 1px solid transparent;
}

.etraffic-select-item:hover {
    background: rgba(124,58,237,0.1);
    color: var(--text-primary, #f1f5f9);
    border-color: rgba(124,58,237,0.2);
}

.etraffic-select-item.selected {
    background: rgba(124,58,237,0.14);
    color: #a78bfa;
    border-color: rgba(124,58,237,0.25);
}

.etraffic-select-item-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: currentColor;
    opacity: 0.5;
}

.etraffic-select-item.selected .etraffic-select-item-dot {
    opacity: 1;
    box-shadow: 0 0 6px currentColor;
}

.etraffic-select-check {
    margin-left: auto;
    color: #a78bfa;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.etraffic-select-item.selected .etraffic-select-check {
    opacity: 1;
}

/* ── Ações rápidas na tabela ──────────────────────────────── */
.etraffic-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-row-action {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-row-open   { background: rgba(124,58,237,0.1); border-color: rgba(124,58,237,0.3); color: #a78bfa; }
.btn-row-dup    { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.25); color: #60a5fa; }
.btn-row-export { background: rgba(5,150,105,0.08); border-color: rgba(5,150,105,0.25); color: #34d399; }
.btn-row-arch   { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.35); }

.btn-row-action:hover { opacity: .85; transform: translateY(-1px); }

/* ── Status badges para tabelas ───────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

.status-draft    { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.4); border: 1px solid rgba(255,255,255,0.1); }
.status-analysis { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.status-approved { background: rgba(5,150,105,0.12); color: #10b981; border: 1px solid rgba(5,150,105,0.3); }
.status-archived { background: rgba(239,68,68,0.08); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* Respostas clientes */
.status-not-sent   { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.35); border: 1px solid rgba(255,255,255,0.1); }
.status-sent       { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.status-viewed     { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.status-replied    { background: rgba(5,150,105,0.12); color: #10b981; border: 1px solid rgba(5,150,105,0.3); }

/* ── Seção vazia ──────────────────────────────────────────── */
.etraffic-empty {
    text-align: center;
    padding: 56px 24px;
    background: rgba(255,255,255,0.02);
    border: 1.5px dashed rgba(255,255,255,0.07);
    border-radius: 14px;
    animation: evyFadeIn 0.3s ease;
}

.etraffic-empty-icon { font-size: 2.8rem; margin-bottom: 14px; }
.etraffic-empty h3   { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin: 0 0 6px; }
.etraffic-empty p    { font-size: .85rem; color: var(--text-secondary); margin: 0; }

/* ── Contador de resultados ──────────────────────────────── */
.etraffic-count {
    font-size: .78rem;
    color: var(--text-tertiary);
    padding: 8px 14px;
    background: rgba(255,255,255,0.02);
    border-top: 1px solid rgba(255,255,255,0.05);
    text-align: right;
}

/* ========================================================
   PLANOS E PAGAMENTOS
   ======================================================== */

.billing-section {
    animation: evyFadeIn 0.3s ease;
}

/* Card do plano atual */
.billing-current-plan {
    background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(109,40,217,0.06));
    border: 1.5px solid rgba(124,58,237,0.3);
    border-radius: 18px;
    padding: 24px 26px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.billing-current-plan::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(124,58,237,0.15), transparent 70%);
    pointer-events: none;
}

.billing-plan-name {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -.01em;
    margin-bottom: 4px;
}

.billing-plan-price {
    font-size: 2.2rem;
    font-weight: 900;
    color: #a78bfa;
    letter-spacing: -.02em;
}

.billing-plan-price span {
    font-size: .95rem;
    font-weight: 500;
    color: var(--text-tertiary);
}

/* Status da assinatura */
.billing-status-active  { color: #10b981; }
.billing-status-pending { color: #fbbf24; }
.billing-status-cancelled { color: #f87171; }

/* Grid de planos */
.billing-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.billing-plan-card {
    background: rgba(255,255,255,0.02);
    border: 1.5px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 22px;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}

.billing-plan-card.featured {
    background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(109,40,217,0.07));
    border-color: rgba(124,58,237,0.4);
    box-shadow: 0 4px 24px rgba(124,58,237,0.15);
}

.billing-plan-card.current-indicator {
    border-color: #10b981 !important;
    background: rgba(5,150,105,0.06) !important;
}

.billing-plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}

.billing-badge-featured {
    position: absolute;
    top: -1px; right: 16px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 3px 10px;
    border-radius: 0 0 8px 8px;
}

.billing-badge-current {
    position: absolute;
    top: -1px; right: 16px;
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 3px 10px;
    border-radius: 0 0 8px 8px;
}

.billing-plan-resource {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: .82rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    line-height: 1.4;
}

.billing-plan-resource-check {
    color: #10b981;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Histórico de pagamentos */
.billing-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 12px;
    flex-wrap: wrap;
    transition: background .15s;
}

.billing-history-row:last-child { border-bottom: none; }
.billing-history-row:hover { background: rgba(255,255,255,0.02); }

/* Botões de ação do billing */
.btn-billing {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 10px;
    border: 1.5px solid;
    font-size: .83rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-family, inherit);
    transition: all 0.2s;
}

.btn-billing-primary {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border-color: transparent;
    color: white;
    box-shadow: 0 3px 12px rgba(124,58,237,0.35);
}
.btn-billing-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 18px rgba(124,58,237,0.5); }

.btn-billing-ghost {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
    color: var(--text-secondary);
}
.btn-billing-ghost:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.btn-billing-danger {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.25);
    color: #f87171;
}
.btn-billing-danger:hover { background: rgba(239,68,68,0.15); }

.btn-billing-success {
    background: rgba(5,150,105,0.1);
    border-color: rgba(5,150,105,0.4);
    color: #10b981;
}
.btn-billing-success:hover { background: rgba(5,150,105,0.18); }

/* ── Painel lateral de status (billing) ─────────────────── */
.billing-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.billing-info-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 14px 16px;
}

.billing-info-label {
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 5px;
}

.billing-info-value {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Modal de confirmação de plano ──────────────────────── */
.billing-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: evyFadeIn 0.2s ease;
}

.billing-modal {
    background: #0f0f1a;
    border: 1.5px solid rgba(124,58,237,0.35);
    border-radius: 20px;
    padding: 32px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: evyFadeIn 0.25s ease;
}

/* ── Loading skeleton ──────────────────────────────────── */
.etraffic-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 6px;
    height: 14px;
}

@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Responsividade ────────────────────────────────────── */
@media (max-width: 768px) {
    .etraffic-tab-btn { font-size: .75rem; padding: 7px 10px; }
    .etraffic-table thead { display: none; }
    .etraffic-table tbody tr { display: flex; flex-direction: column; padding: 12px; }
    .etraffic-table tbody td { padding: 4px 0; border: none; }
    .billing-plans-grid { grid-template-columns: 1fr; }
    .billing-info-grid  { grid-template-columns: 1fr 1fr; }
}
