/* CRM Prospectos - Estilos Personalizados */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    
    --priority-maxima: #dc3545;
    --priority-alta: #fd7e14;
    --priority-media: #ffc107;
    --priority-baja: #6c757d;
}

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

/* Navbar customizations */
.navbar-brand {
    font-weight: 600;
}

/* Content sections */
.content-section {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

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

/* KPI Cards */
.card.bg-primary, .card.bg-success, .card.bg-warning, .card.bg-info {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card.bg-warning {
    background-color: var(--warning-color) !important;
    color: #000 !important;
}

/* Priority badges */
.badge-prioridad {
    font-size: 0.75em;
    padding: 0.5em 0.75em;
}

.badge-maxima { background-color: var(--priority-maxima) !important; }
.badge-alta { background-color: var(--priority-alta) !important; }
.badge-media { background-color: var(--priority-media) !important; color: #000; }
.badge-baja { background-color: var(--priority-baja) !important; }

/* Estado badges */
.badge-estado {
    font-size: 0.75em;
    padding: 0.5em 0.75em;
    border-radius: 0.5rem;
}

/* Table customizations */
.table > :not(caption) > * > * {
    padding: 0.75rem 0.5rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* DataTables customizations */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
    color: #6c757d;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.375rem 0.75rem;
    margin-left: -1px;
    color: var(--primary-color);
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #dee2e6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #0a58ca;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    color: #fff !important;
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* Pipeline cards */
.pipeline-stage {
    min-height: 500px;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.pipeline-stage:hover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.pipeline-stage-header {
    background-color: #fff;
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.pipeline-prospect-card {
    background: #fff;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pipeline-prospect-card:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Modal customizations */
.modal-xl {
    max-width: 90%;
}

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Form controls */
.form-control, .form-select {
    border-radius: 0.375rem;
}

.form-control:focus, .form-select:focus {
    border-color: rgba(13, 110, 253, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Tags */
.tag {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.5rem;
    margin: 0.125rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.tag-email-obsoleto {
    background-color: #f8d7da;
    color: #721c24;
}

.tag-empresa-grande {
    background-color: #d4edda;
    color: #155724;
}

.tag-alta-oportunidad {
    background-color: #fff3cd;
    color: #856404;
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid #f3f3f3;
    border-top: 0.25rem solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .modal-xl {
        max-width: 95%;
    }
}

/* Utilities */
.text-muted-light {
    color: #8c8c8c !important;
}

.border-start-primary {
    border-left: 4px solid var(--primary-color) !important;
}

.border-start-success {
    border-left: 4px solid var(--success-color) !important;
}

.border-start-warning {
    border-left: 4px solid var(--warning-color) !important;
}

.border-start-danger {
    border-left: 4px solid var(--danger-color) !important;
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Scrollbar customization for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background-color: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #a8a8a8;
}

/* Modal Improvements */
.modal-content {
    border-radius: 0.75rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.75rem 0.75rem 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 0.75rem 0.75rem;
}

/* Form Validation */
.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.4.27L8 2.5 7.6 2z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Button Animations */
.btn {
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Toast Improvements */
.toast {
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.toast-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Character Counter */
.form-text.text-warning {
    color: var(--warning-color) !important;
}

.form-text.text-danger {
    color: var(--danger-color) !important;
}

/* Drag and Drop Visual Feedback */
.pipeline-stage.drag-over {
    background-color: rgba(13, 110, 253, 0.1) !important;
    border: 2px dashed var(--primary-color);
    transition: all 0.2s ease-in-out;
}

.pipeline-prospect-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    transition: all 0.2s ease-in-out;
}

/* Improved Animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.slide-in-up {
    animation: slideInUp 0.3s ease-out;
}

/* Pulse Animation for Important Items */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

/* Improved Focus States */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem 0.5rem;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.25rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}