/* Enterprise CRM - Custom Styles */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #e9ecef;
    
    --border-radius: 12px;
    --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);
    --transition: all 0.2s ease-in-out;
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f6fa;
    color: var(--dark-color);
}

/* Cards and Panels */
.card {
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    transition: var(--transition);
    margin-bottom: 20px;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.card-body {
    padding: 20px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: var(--transition);
    padding: 10px 20px;
}

.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-success {
    background: linear-gradient(135deg, #38a169 0%, #48bb78 100%);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, #e53e3e 0%, #fc8181 100%);
    border: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Tables */
.table {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
    background-color: var(--light-color);
    padding: 15px;
}

.table td {
    padding: 15px;
    vertical-align: middle;
}

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

/* Stats Cards */
.stats-card {
    position: relative;
    overflow: hidden;
}

.stats-card.gradient-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stats-card.gradient-green {
    background: linear-gradient(135deg, #38a169 0%, #48bb78 100%);
}

.stats-card.gradient-orange {
    background: linear-gradient(135deg, #ed8936 0%, #f6ad55 100%);
}

.stats-card.gradient-red {
    background: linear-gradient(135deg, #e53e3e 0%, #fc8181 100%);
}

/* Lead Score Badges */
.lead-score {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    min-width: 50px;
}

.lead-score.hot {
    background: linear-gradient(45deg, var(--danger-color), #ff6b6b);
    color: white;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.lead-score.warm {
    background: linear-gradient(45deg, var(--warning-color), #ffd93d);
    color: #333;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

.lead-score.cold {
    background: linear-gradient(45deg, #6c757d, #adb5bd);
    color: white;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

/* Tags */
.tag {
    display: inline-block;
    padding: 4px 12px;
    margin: 2px 4px 2px 0;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    color: white;
    background: var(--primary-color);
    white-space: nowrap;
    transition: var(--transition);
}

.tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tag.removable {
    padding-right: 25px;
    position: relative;
}

.tag .remove-tag {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 10px;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tag .remove-tag:hover {
    color: white;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
}

/* Pipeline Board */
.pipeline-board {
    display: flex;
    overflow-x: auto;
    padding: 20px 0;
    gap: 20px;
    min-height: 600px;
}

.pipeline-stage {
    flex: 0 0 300px;
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
}

.pipeline-stage:hover {
    border-color: rgba(102, 126, 234, 0.3);
}

.pipeline-stage.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(102, 126, 234, 0.05);
    transform: scale(1.02);
}

.pipeline-stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.pipeline-stage-title {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.1rem;
}

.pipeline-stage-count {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.pipeline-stage-value {
    font-size: 0.8rem;
    color: var(--info-color);
    font-weight: 600;
    margin-top: 5px;
}

.deals-container {
    min-height: 400px;
}

.deal-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 12px;
    cursor: move;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--box-shadow);
}

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

.deal-card.dragging {
    opacity: 0.6;
    transform: rotate(5deg) scale(0.95);
    z-index: 1000;
}

.deal-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.3;
}

.deal-company {
    color: var(--secondary-color);
    font-size: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.deal-company i {
    margin-right: 5px;
}

.deal-value {
    font-weight: bold;
    color: var(--success-color);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.deal-probability {
    font-size: 11px;
    color: var(--info-color);
    background: rgba(23, 162, 184, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
}

.deal-close-date {
    font-size: 11px;
    color: var(--secondary-color);
    position: absolute;
    top: 12px;
    right: 15px;
    background: var(--light-color);
    padding: 2px 6px;
    border-radius: 6px;
}

.deal-overdue {
    color: var(--danger-color) !important;
    background: rgba(220, 53, 69, 0.1);
}

/* Activity Timeline */
.activity-timeline {
    position: relative;
    padding-left: 35px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
}

.activity-item {
    position: relative;
    margin-bottom: 25px;
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.activity-item:hover {
    box-shadow: var(--box-shadow-lg);
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 25px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 3px solid white;
    box-shadow: 0 0 0 2px var(--border-color);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.activity-type {
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.activity-type i {
    margin-right: 8px;
}

.activity-time {
    font-size: 12px;
    color: var(--secondary-color);
}

.activity-description {
    color: var(--dark-color);
    line-height: 1.6;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid var(--border-color);
    transition: var(--transition);
    padding: 12px 15px;
}

.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: var(--dark-color);
    margin-bottom: 8px;
}

.input-group-text {
    background: var(--light-color);
    border: 2px solid var(--border-color);
    border-radius: 8px 0 0 8px;
}

/* Search */
.search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--box-shadow);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.search-result-item:hover {
    background-color: var(--light-color);
}

.search-result-item i {
    margin-right: 10px;
    color: var(--primary-color);
}

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

.alert-success {
    border-left-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
}

.alert-danger {
    border-left-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

.alert-warning {
    border-left-color: var(--warning-color);
    background-color: rgba(255, 193, 7, 0.1);
}

.alert-info {
    border-left-color: var(--info-color);
    background-color: rgba(23, 162, 184, 0.1);
}

/* Dashboard Widgets */
.widget {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.widget:hover {
    box-shadow: var(--box-shadow-lg);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.widget-title {
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.widget-actions {
    display: flex;
    gap: 10px;
}

/* Task List Widget */
.task-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.task-item:last-child {
    border-bottom: none;
}

.task-checkbox {
    margin-right: 12px;
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 2px;
}

.task-due {
    font-size: 12px;
    color: var(--secondary-color);
}

.task-overdue {
    color: var(--danger-color) !important;
}

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

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

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Badge styles */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
}

.status-inactive {
    background: rgba(108, 117, 125, 0.2);
    color: #6c757d;
}

.status-pending {
    background: rgba(255, 193, 7, 0.2);
    color: #b08800;
}

.status-completed {
    background: rgba(23, 162, 184, 0.2);
    color: var(--info-color);
}

/* Responsive Design */
@media (max-width: 992px) {
    .pipeline-board {
        flex-direction: column;
        gap: 15px;
    }
    
    .pipeline-stage {
        flex: 1;
        min-height: 300px;
    }
    
    .stats-value {
        font-size: 1.5rem;
    }
    
    .content-wrapper {
        padding: 20px 15px;
    }
}

@media (max-width: 768px) {
    .card-header,
    .card-body {
        padding: 15px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 0.875rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.875rem;
    }
    
    .deal-card {
        padding: 12px;
    }
    
    .activity-timeline {
        padding-left: 25px;
    }
    
    .activity-timeline::before {
        left: 12px;
    }
    
    .activity-item::before {
        left: -21px;
    }
}

@media (max-width: 576px) {
    .stats-card {
        text-align: center;
    }
    
    .stats-icon {
        display: none;
    }
    
    .widget {
        padding: 15px;
    }
    
    .navbar .container-fluid {
        padding: 0 15px;
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cursor-pointer {
    cursor: pointer;
}

.cursor-move {
    cursor: move;
}

.hover-scale:hover {
    transform: scale(1.02);
    transition: var(--transition);
}

.shadow-sm {
    box-shadow: var(--box-shadow) !important;
}

.shadow {
    box-shadow: var(--box-shadow-lg) !important;
}

.rounded-lg {
    border-radius: var(--border-radius) !important;
}

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

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

/* Print styles */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        margin-top: 0;
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}