/* Leads Page Specific Styles */
.leads-container {
    min-height: 100vh;
    padding-top: 80px;
}

.leads-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Filters Bar */
.filters-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    flex: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 120px;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
}

/* Leads Table */
.leads-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.table-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-title svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.table-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
}

.leads-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leads-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.leads-table tbody tr:hover {
    background: var(--bg-secondary);
}

.lead-company {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lead-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.lead-info h4 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.lead-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.lead-contact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.contact-item svg {
    width: 14px;
    height: 14px;
}

.lead-score {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.lead-score.high {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.lead-score.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.lead-score.low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.lead-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.lead-status.new {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.lead-status.qualified {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.lead-status.contacted {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.lead-status.converted {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.lead-status.lost {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.lead-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sm svg {
    width: 16px;
    height: 16px;
}

.btn-primary-sm {
    background: var(--primary);
    color: white;
}

.btn-secondary-sm {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-danger-sm {
    background: var(--danger);
    color: white;
}

.next-action {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.next-action-main {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.next-action-icon {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 999px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.next-action-icon svg {
    width: 14px;
    height: 14px;
}

.next-action-tooltip {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: var(--shadow-md);
}

.next-action-tooltip p {
    margin: 0 0 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.next-action-hint {
    margin: 0 0 0.75rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.next-action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}

.next-action-link:hover {
    text-decoration: underline;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header h2 svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-label svg {
    width: 16px;
    height: 16px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-card);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1500;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast svg {
    width: 20px;
    height: 20px;
}

.toast.success svg {
    color: var(--success);
}

.toast.error svg {
    color: var(--danger);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.user-details h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-details span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

[x-cloak] { display: none !important; }

/* Score cell com ícone de enriquecido */
.lead-score-cell {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.enriched-badge {
    display: inline-flex;
    align-items: center;
    color: var(--warning);
    opacity: 0.85;
}

.enriched-badge svg {
    width: 13px;
    height: 13px;
}

/* ---- DDI Selector (phone-input-group) ---- */
.phone-input-group {
    display: flex;
    gap: 0;
    align-items: stretch;
}

.phone-input-group .ddi-select {
    flex-shrink: 0;
    width: auto;
    min-width: 90px;
    border-radius: var(--radius) 0 0 var(--radius);
    border-right: none;
    background: var(--bg-input, var(--bg-card));
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 13px;
    padding: 0 8px;
    cursor: pointer;
    appearance: auto;
}

.phone-input-group .form-input {
    flex: 1;
    border-radius: 0 var(--radius) var(--radius) 0;
}
