/* Custom CSS for BODH CRM */

.kanban-board {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 15px 0;
}

.kanban-column {
    min-width: 260px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
}

.kanban-header {
    background: #6c757d;
    color: white;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8em;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.kanban-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.kanban-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: move;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.9em;
    position: relative;
    z-index: 1;
}

.kanban-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 2;
    transform: translateY(-2px);
}

.kanban-card.sortable-ghost {
    opacity: 0.5;
}

.kanban-card.sortable-chosen {
    transform: rotate(5deg);
}

.card-school-code {
    font-weight: bold;
    color: #0d6efd;
    font-size: 0.8em;
    margin-bottom: 3px;
}

.card-school-name {
    font-weight: 600;
    margin: 3px 0;
    font-size: 0.9em;
    line-height: 1.2;
}

.card-details {
    font-size: 0.75em;
    color: #6c757d;
    line-height: 1.3;
}

.card-details div {
    margin-bottom: 2px;
}

.card-value {
    font-weight: bold;
    color: #198754;
    font-size: 0.8em;
}

/* Vibrant Stage Colors for Kanban Headers */
.stage-lead {
    background: linear-gradient(135deg, #17a2b8, #138496) !important;
    color: white !important;
}

.stage-demo-scheduled {
    background: linear-gradient(135deg, #ffc107, #e0a800) !important;
    color: #212529 !important;
}

.stage-pilot-running {
    background: linear-gradient(135deg, #6f42c1, #5a32a3) !important;
    color: white !important;
}

.stage-proposal-sent {
    background: linear-gradient(135deg, #28a745, #1e7e34) !important;
    color: white !important;
}

.stage-negotiation {
    background: linear-gradient(135deg, #fd7e14, #e55a00) !important;
    color: white !important;
}

.stage-closed-won {
    background: linear-gradient(135deg, #28a745, #1e7e34) !important;
    color: white !important;
}

.stage-closed-lost {
    background: linear-gradient(135deg, #dc3545, #bd2130) !important;
    color: white !important;
}

.stage-renewal-due {
    background: linear-gradient(135deg, #e83e8c, #d91a72) !important;
    color: white !important;
}

.stage-renewal-completed {
    background: linear-gradient(135deg, #20c997, #17a085) !important;
    color: white !important;
}

/* Custom Badge Colors */
.bg-purple {
    background: linear-gradient(135deg, #6f42c1, #5a32a3) !important;
    color: white !important;
}

.bg-orange {
    background: linear-gradient(135deg, #fd7e14, #e55a00) !important;
    color: white !important;
}

.bg-pink {
    background: linear-gradient(135deg, #e83e8c, #d91a72) !important;
    color: white !important;
}

.bg-teal {
    background: linear-gradient(135deg, #20c997, #17a085) !important;
    color: white !important;
}

/* Enhanced Stage Badges */
.stage-badge {
    font-size: 0.8em !important;
    font-weight: 600 !important;
    padding: 0.5em 0.8em !important;
    border-radius: 20px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
}

.stage-badge:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

.dashboard-card {
    transition: transform 0.2s;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.activity-timeline {
    position: relative;
    padding-left: 25px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.activity-item {
    position: relative;
    margin-bottom: 12px;
    background: white;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    font-size: 0.9em;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 15px;
    width: 10px;
    height: 10px;
    background: #0d6efd;
    border-radius: 50%;
    border: 2px solid white;
}

.btn-sm {
    font-size: 0.75em;
    padding: 0.25rem 0.5rem;
}

/* Smaller buttons in kanban cards */
.kanban-card .btn-sm {
    font-size: 0.7em;
    padding: 0.2rem 0.4rem;
    margin-right: 0.25rem;
}

.table-responsive {
    border-radius: 6px;
    overflow: hidden;
}

.badge {
    font-size: 0.75em;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.navbar-brand {
    font-weight: bold;
}

.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: white;
    border: none;
}

.text-primary {
    color: #0d6efd !important;
}

.bg-primary {
    background: linear-gradient(135deg, #0d6efd, #6610f2) !important;
}

/* Kanban drag and drop styles */
.kanban-cards {
    min-height: 200px;
    padding: 10px;
}

.sortable-ghost {
    opacity: 0.4;
    background: #f8f9fa !important;
}

.sortable-chosen {
    cursor: grabbing !important;
}

.sortable-drag {
    opacity: 1 !important;
    transform: rotate(5deg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3) !important;
}

/* Progress bars in opportunities */
.progress {
    background-color: #e9ecef;
}

.progress-bar {
    background: linear-gradient(45deg, #28a745, #20c997);
    transition: width 0.6s ease;
}

/* Activity timeline enhancements */
.activity-item:last-child::after {
    display: none;
}

.activity-item::after {
    content: '';
    position: absolute;
    left: -25px;
    top: 35px;
    width: 2px;
    height: calc(100% - 25px);
    background: #dee2e6;
}

/* Enhanced cards */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Button enhancements */
.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Table enhancements */
.table th {
    border-top: none;
    font-weight: 600;
    background: #f8f9fa;
}

.table-striped>tbody>tr:nth-of-type(odd)>td {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Table footer styling */
.table tfoot td {
    border-top: 2px solid #0d6efd;
    background: #f8f9ff;
    font-weight: 600;
    vertical-align: middle;
}

.table tfoot .badge {
    font-size: 0.9em;
    padding: 0.5em 0.8em;
}

.table tfoot .text-success,
.table tfoot .text-primary {
    font-size: 0.9em;
    font-weight: 600;
}

.table tfoot .text-success i,
.table tfoot .text-primary i {
    margin-right: 0.25rem;
}

/* Modal enhancements */
.modal-content {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
}

/* Alert enhancements */
.alert {
    border: none;
    border-radius: 8px;
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Custom scrollbar for Kanban */
.kanban-board::-webkit-scrollbar {
    height: 8px;
}

.kanban-board::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.kanban-board::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Filter Section Styling */
.filter-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.filter-section .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.filter-section .form-select,
.filter-section .form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: all 0.2s ease;
}

.filter-section .form-select:focus,
.filter-section .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.filter-section .input-group .btn {
    border-color: #ced4da;
}

.filter-section .input-group .btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* Filter Results Text */
#filterResults {
    font-style: italic;
    color: #6c757d;
}

/* Enhanced Kanban Cards for Filtered View */
.kanban-card.filtered-highlight {
    border-left: 4px solid #0d6efd;
    background: #f8f9ff;
}

/* Table Search Highlighting */
.table-search-highlight {
    background-color: #fff3cd !important;
}

/* Dashboard Follow-ups Scroll Container */
.followup-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.followup-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.followup-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.followup-scroll-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.followup-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Dashboard Recent Activities Scroll Container */
.activity-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.activity-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.activity-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.activity-scroll-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.activity-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Compact activity item content */
.activity-item .fw-bold {
    font-size: 0.95em;
    line-height: 1.3;
}

.activity-item .row.g-0 {
    margin-bottom: 0.25rem;
}

.activity-item small {
    font-size: 0.8em;
    line-height: 1.2;
}

.activity-item p.small {
    font-size: 0.75em;
    line-height: 1.3;
    margin-top: 0.25rem;
}

/* Dashboard Cards Equal Height */
.dashboard-activity-row {
    display: flex;
    align-items: stretch;
}

.dashboard-activity-row .card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-activity-row .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dashboard-activity-row .followup-scroll-container,
.dashboard-activity-row .activity-scroll-container {
    flex: 1;
    min-height: 400px;
    max-height: 400px;
}

/* Follow-up list item improvements */
.followup-scroll-container .list-group-item {
    border-left: none;
    border-right: none;
    padding: 12px 16px;
    transition: background-color 0.2s ease;
}

.followup-scroll-container .list-group-item:hover {
    background-color: #f8f9fa;
}

.followup-scroll-container .list-group-item:first-child {
    border-top: none;
}

.followup-scroll-container .list-group-item:last-child {
    border-bottom: none;
}

/* Text truncation for long school names */
.followup-scroll-container .text-truncate {
    max-width: 200px;
}

/* Badge positioning */
.followup-scroll-container .badge {
    font-size: 0.75em;
    white-space: nowrap;
}

/* Dashboard Filter Styling */
.dashboard-filter-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 20px;
}

.dashboard-filter-card .card-header {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border-bottom: 1px solid #dee2e6;
}

.dashboard-filter-card .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.dashboard-filter-card .form-select,
.dashboard-filter-card .form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.dashboard-filter-card .form-select:focus,
.dashboard-filter-card .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.dashboard-filter-card .btn-group .btn {
    font-size: 0.9em;
    padding: 0.5rem 1rem;
}

.dashboard-filter-card .alert-info {
    background-color: #e7f3ff;
    border-color: #b8daff;
    color: #0c5460;
    font-size: 0.9em;
}

/* Filter collapse animation */
.collapse {
    transition: height 0.35s ease;
}

/* Active filter indicator */
.filter-active {
    border-left: 4px solid #0d6efd !important;
    background-color: #f8f9ff !important;
}

/* Lead Activities Modal Styles */
.lead-row:hover {
    background-color: #f8f9fa !important;
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.lead-row {
    transition: all 0.2s ease;
}

#activitiesModal .modal-dialog {
    max-width: 900px;
}

#activitiesModal .activity-timeline {
    max-height: 400px;
    overflow-y: auto;
    padding-left: 0;
}

#activitiesModal .activity-timeline::before {
    display: none;
}

#activitiesModal .activity-item {
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    position: relative;
}

#activitiesModal .activity-item::before {
    display: none;
}

#activitiesModal .activity-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Responsive Filter Adjustments */
@media (max-width: 768px) {
    .filter-section .row>div {
        margin-bottom: 15px;
    }

    .filter-section .col-md-1 {
        margin-top: 10px;
    }

    /* Dashboard filter responsive */
    .dashboard-filter-card .col-md-2 {
        margin-bottom: 15px;
    }

    .dashboard-filter-card .btn-group {
        width: 100%;
    }

    /* Adjust follow-up container height on mobile */
    .followup-scroll-container {
        max-height: 250px;
    }

    .followup-scroll-container .text-truncate {
        max-width: 150px;
    }

    /* Adjust activity container height on mobile */
    .activity-scroll-container {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
    }

    .kanban-column {
        min-width: 100%;
    }

    .dashboard-card h4 {
        font-size: 1.2rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* Kanban Card Dropdown Styles */
.kanban-card .dropdown {
    z-index: 1050;
}

.kanban-card .dropdown-menu {
    z-index: 1051 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
}

.kanban-card .dropdown-toggle {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.kanban-card:hover .dropdown-toggle {
    opacity: 1;
}

.kanban-card .dropdown-menu .dropdown-item {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.kanban-card .dropdown-menu .dropdown-item:hover {
    background-color: #f8f9fa;
}

.kanban-card .dropdown-menu .dropdown-item.active {
    background-color: #0d6efd;
    color: white;
}

/* Chart Styling for Opportunities Page */
#leadsVsOpportunitiesChart {
    height: 300px !important;
}

/* Chart responsive adjustments */
@media (max-width: 768px) {
    #leadsVsOpportunitiesChart {
        height: 250px !important;
    }
}

/*
 Second Chart Styling for Opportunities Page */
#opportunityWeightedChart {
    height: 300px !important;
}

/* Chart responsive adjustments for both charts */
@media (max-width: 768px) {
    #opportunityWeightedChart {
        height: 250px !important;
    }

    /* Stack charts vertically on mobile */
    .row .col-md-6 {
        margin-bottom: 20px;
    }
}

/* Cli
ckable school names in Kanban cards */
.card-school-name a {
    transition: all 0.2s ease;
}

.card-school-name a:hover {
    color: #0d6efd !important;
    text-decoration: underline !important;
}

/* Make it clear that school names are clickable */
.card-school-name {
    cursor: pointer;
}

/* Table clickable lead names */
.lead-clickable:hover {
    color: #0d6efd !important;
    background-color: #f8f9fa !important;
}

/* H
ighlight leads with opportunities */
.has-opportunity {
    background: linear-gradient(135deg, #d4edda 0%, #f8f9fa 100%) !important;
    border-left: 4px solid #28a745 !important;
}

/* Kanban card highlighting for leads with opportunities */
.kanban-card .card-school-name.has-opportunity {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #28a745;
    margin: 2px 0;
}

/* Table row highlighting for leads with opportunities */
.lead-row.has-opportunity {
    background: linear-gradient(135deg, #d4edda 0%, #f8f9fa 100%) !important;
    border-left: 4px solid #28a745 !important;
}

.lead-row.has-opportunity:hover {
    background: linear-gradient(135deg, #c3e6cb 0%, #e9ecef 100%) !important;
}

/* Table cell highlighting for leads with opportunities */
.lead-clickable.has-opportunity {
    font-weight: 600;
    color: #155724 !important;
}

.lead-clickable.has-opportunity:hover {
    color: #0d6efd !important;
    background-color: rgba(40, 167, 69, 0.1) !important;
}

/* Opportunity icon styling */
.fas.fa-chart-line[title="Has Opportunity"] {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}