/* =============================================================
   ALERTAS TELEGRAM — Premium
   ============================================================= */

/* Telegram status card */
.alert-telegram-status {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.tg-connected, .tg-pending, .tg-disconnected {
    display: flex;
    align-items: center;
    gap: 14px;
}

.tg-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.tg-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.tg-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.tg-sub code {
    background: var(--bg-body);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.tg-disconnected {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
}

.tg-connected {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.15);
}

/* Alert cards */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    transition: border-color 0.2s;
}

.alert-card:hover {
    border-color: var(--primary);
}

.alert-card.alert-paused {
    opacity: 0.6;
}

.alert-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-card-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    border-radius: 10px;
}

.alert-card-info {
    flex: 1;
    min-width: 0;
}

.alert-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-status-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.status-active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-paused {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.alert-card-condition {
    font-size: 11px;
    color: var(--primary);
    font-weight: 500;
    margin-top: 2px;
    font-family: var(--font-display);
}

.field-tip {
    font-size: 11px;
    cursor: help;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.field-tip:hover {
    opacity: 1;
}

.alert-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.alert-delete:hover {
    color: #ef4444 !important;
}

.alert-card-meta {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 10px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.alert-card-meta i {
    font-size: 11px;
    margin-right: 3px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 90%;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 0;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-footer {
    padding: 0 20px 18px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

/* PRO badge */
.badge-pro {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    line-height: 1;
}

.nav-item.premium-only {
    position: relative;
}

/* Responsive */
@media (max-width: 768px) {
    .alert-card-header {
        flex-wrap: wrap;
    }
    .alert-card-meta {
        flex-direction: column;
        gap: 4px;
    }
    .modal-box {
        width: 95%;
    }
}

/* Stats de acerto */
.alert-stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.alert-stat-label {
    flex: 0 0 140px;
    font-weight: 600;
    color: var(--text-primary);
}

.alert-stat-count {
    flex: 0 0 100px;
    color: var(--text-muted);
    font-size: 12px;
}

.alert-stat-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-body);
    border-radius: 4px;
    overflow: hidden;
}

.alert-stat-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
}

.alert-stat-pct {
    flex: 0 0 44px;
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .alert-stat-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .alert-stat-label {
        flex: 1 1 100%;
    }
    .alert-stat-bar {
        flex: 1 1 auto;
    }
}

/* Calibração do modelo */
.alert-calib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.calib-suggest-box {
    margin: 14px 0 8px;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(59, 130, 246, 0.06));
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
}

.calib-suggest-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.calib-suggest-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.calib-suggest-rec {
    min-width: 160px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.calib-suggest-rec-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.calib-suggest-rec-val {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.15;
    margin: 4px 0;
    font-family: var(--font-display);
}

.calib-suggest-rec-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

.calib-suggest-msg {
    flex: 1;
    min-width: 200px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.calib-suggest-notes {
    margin: 12px 0 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.calib-line-list, .calib-alert-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calib-line-row, .calib-alert-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
}

.calib-line-name, .calib-alert-name {
    font-weight: 600;
    color: var(--text-primary);
}

.calib-line-rec {
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-display);
}

.calib-line-sub, .calib-alert-sub {
    color: var(--text-muted);
    font-size: 11px;
}

.calib-alert-info {
    flex: 1;
    min-width: 0;
}

.calib-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.calib-badge-up {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.calib-badge-down {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.calib-badge-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

/* ===== ALERT MODE TOGGLE ===== */
.alert-mode-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px;
}
.alert-mode-btn {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.alert-mode-btn.active {
    background: var(--primary);
    color: var(--bg-body);
}
.alert-mode-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* Avançado: esconde campos em modo simples */
.mode-simple .alert-adv-only { display: none !important; }
.mode-advanced .alert-adv-only { display: block; }

/* ===== TELEGRAM PREVIEW ===== */
.alert-tg-preview {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-top: 2px;
}
.alert-tg-preview-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.alert-tg-preview-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.tg-pv-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.tg-pv-match {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.tg-pv-line {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 2px;
}
.tg-pv-scope {
    font-size: 10px;
    color: var(--text-muted);
}
.tg-pv-foot {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}
