/**
 * Webhook Panel Styles - Compartilhado Evolution & ApiPro
 */

/* Container principal */
.webhook-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card, #fff);
    border-radius: 12px;
    border: 1px solid var(--border, #e2e8f0);
}

[data-theme="dark"] .webhook-section {
    background: rgba(30, 41, 59, 0.8);
    border-color: #334155;
}

/* Header do painel */
.webhook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.webhook-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

/* Badge de status */
.webhook-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.webhook-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.webhook-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

[data-theme="dark"] .webhook-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

[data-theme="dark"] .webhook-badge.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Formulário */
.webhook-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.webhook-url-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.webhook-url-row input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--bg, #f8fafc);
    color: var(--text, #1e293b);
    font-size: 0.95rem;
    font-family: 'Inter', monospace;
}

[data-theme="dark"] .webhook-url-row input {
    background: #0f172a;
    border-color: #475569;
    color: #f1f5f9;
}

.webhook-url-row input:focus {
    outline: none;
    border-color: var(--primary, #10b981);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Toggle switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary, #10b981);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

/* Eventos (checkboxes) */
.webhook-events {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0;
}

.webhook-events label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.webhook-events label:hover {
    border-color: var(--primary, #10b981);
}

[data-theme="dark"] .webhook-events label {
    background: #0f172a;
    border-color: #475569;
}

.webhook-events input:checked+span {
    color: var(--primary, #10b981);
    font-weight: 600;
}

/* Botão Salvar */
.webhook-save-btn {
    padding: 10px 20px;
    background: var(--primary, #10b981);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    width: 100%;
}

.webhook-save-btn:hover {
    background: var(--primary-dark, #059669);
    transform: translateY(-1px);
}

.webhook-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Feedback */
.webhook-feedback {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
    margin-top: 8px;
}

.webhook-feedback.success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.webhook-feedback.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .webhook-feedback.success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

[data-theme="dark"] .webhook-feedback.error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Info text */
.webhook-info {
    font-size: 0.8rem;
    color: var(--text-light, #64748b);
    margin-top: 4px;
}

/* Responsivo */
@media (max-width: 480px) {
    .webhook-url-row {
        flex-direction: column;
    }

    .webhook-events label {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .webhook-header {
        flex-direction: column;
        align-items: flex-start;
    }
}