/* CRM Avançado - Estilos Customizados */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 8px;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Layout Geral */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #495057;
}

/* Container principal centralizado e limitado */
.container-fluid {
    max-width: 1400px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

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

/* Ajustes específicos para o Kanban */
.kanban-board {
    max-width: 1600px;
    margin: 0 auto;
}

/* Ajustes para diferentes tamanhos de tela */
@media (min-width: 1800px) {
    .container-fluid {
        max-width: 1600px;
    }
    
    .container {
        max-width: 1400px;
    }
}

@media (max-width: 1400px) {
    .container-fluid {
        max-width: 1200px;
    }
}

@media (max-width: 1200px) {
    .container-fluid {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Navbar Customizada */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    margin: 0 0.25rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* Stats Cards */
.stats-card {
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--box-shadow-lg);
}

.border-left-primary {
    border-left-color: var(--primary-color) !important;
}

.border-left-success {
    border-left-color: var(--success-color) !important;
}

.border-left-info {
    border-left-color: var(--info-color) !important;
}

.border-left-warning {
    border-left-color: var(--warning-color) !important;
}

/* Botões */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Formulários */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* Tabelas */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
    transform: scale(1.01);
}

/* Badges */
.badge {
    border-radius: 20px;
    padding: 0.4em 0.8em;
    font-weight: 500;
}

/* Alertas */
.alert {
    border: none;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-primary {
    border-left-color: var(--primary-color);
    background-color: rgba(102, 126, 234, 0.1);
    color: #4c63d2;
}

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

.alert-info {
    border-left-color: var(--info-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Responsividade */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

/* Estados de Loading */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Dropdown melhorado */
.dropdown-menu {
    border: none;
    box-shadow: var(--box-shadow-lg);
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

/* Melhorias visuais específicas */
.text-gray-800 {
    color: #5a5c69 !important;
}

.text-gray-300 {
    color: #d1d3e2 !important;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-xs {
    font-size: 0.75rem;
}

/* Login page específico */
.login-container {
    min-height: 100vh;
}

/* Ícones customizados */
.fa-2x {
    font-size: 2em;
}

.fa-3x {
    font-size: 3em;
}

/* Scrollbar customizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Melhorias para acessibilidade */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .card-header {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===== ESTILOS PARA ETIQUETAS (TAGS) ===== */

/* Container dos campos de etiquetas */
.tags-input-container {
    position: relative;
}

/* Etiquetas selecionadas */
.selected-tags {
    min-height: 40px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 8px;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    transition: all 0.3s ease;
}

.selected-tags:empty {
    display: none;
}

.selected-tags.has-tags {
    display: flex;
}

/* Etiqueta individual */
.tag-item {
    display: inline-flex;
    align-items: center;
    background-color: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 0.875rem;
    font-weight: 500;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.tag-item .tag-remove {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tag-item .tag-remove:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Etiquetas nos cards de leads */
.lead-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.lead-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    background-color: #6c757d;
}

/* Filtro de etiquetas */
.tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.filter-tag {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 0.875rem;
    border: 2px solid #e9ecef;
    background: white;
    color: #6c757d;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.filter-tag:hover {
    border-color: #007bff;
    color: #007bff;
}

.filter-tag.active {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.filter-tag .tag-count {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 1px 4px;
    font-size: 0.75rem;
    min-width: 16px;
    text-align: center;
}

/* Gerenciamento de etiquetas na página de configurações */
.tag-management-card {
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    background: white;
    transition: all 0.3s ease;
}

.tag-management-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

/* Preview da etiqueta no modal */
.tag-preview-container {
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    text-align: center;
}

/* Responsividade para etiquetas */
@media (max-width: 768px) {
    .selected-tags {
        min-height: 35px;
        padding: 6px;
    }
    
    .tag-item {
        font-size: 0.8rem;
        padding: 3px 6px;
    }
    
    .lead-tag {
        font-size: 0.7rem;
        padding: 1px 4px;
    }
    
    .filter-tag {
        font-size: 0.8rem;
        padding: 3px 6px;
    }
}

/* Estados de interação */
.tags-input-container.focus .selected-tags {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Animação para remoção de etiquetas */
@keyframes tagRemove {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

.tag-item.removing {
    animation: tagRemove 0.3s ease forwards;
}