/* CRM - Custom Styles */

/* Sidebar */
#sidebar {
    min-width: 250px;
    max-width: 250px;
    min-height: 100vh;
    transition: all 0.3s;
}

#sidebar.collapsed {
    margin-left: -250px;
}

#sidebar .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

#sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#sidebar .nav-link.active {
    font-weight: 600;
}

#sidebar .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 8px;
}

/* Page content */
#page-content-wrapper {
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
    background-color: #f8f9fa;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.5rem;
}

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

/* Stats cards */
.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    font-size: 0.88rem;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Map */
#map {
    height: 500px;
    border-radius: 0.5rem;
}

.map-fullpage #map {
    height: calc(100vh - 120px);
}

/* Pipeline / Kanban */
.pipeline-column {
    min-width: 280px;
    max-width: 320px;
    background-color: #f1f3f5;
    border-radius: 0.5rem;
}

.pipeline-card {
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.pipeline-card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* Daily plan */
.task-item {
    border-left: 4px solid #dee2e6;
    transition: all 0.2s;
}

.task-item.priority-low {
    border-left-color: #198754;
}

.task-item.priority-medium {
    border-left-color: #ffc107;
}

.task-item.priority-high {
    border-left-color: #fd7e14;
}

.task-item.priority-urgent {
    border-left-color: #dc3545;
}

.task-item:hover {
    background-color: #f8f9fa;
}

/* Value category badges */
.value-a {
    background-color: #ffd700;
    color: #000;
}

.value-b {
    background-color: #c0c0c0;
    color: #000;
}

.value-c {
    background-color: #cd7f32;
    color: #fff;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #sidebar {
        margin-left: -250px;
        position: fixed;
        z-index: 1050;
    }

    #sidebar.active {
        margin-left: 0;
    }

    .container-fluid {
        padding: 12px !important;
    }

    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 8px;
    }

    #map {
        height: 350px;
    }

    .pipeline-column {
        min-width: 100%;
    }
}

@media (max-width: 992px) {
    .table td, .table th {
        font-size: 0.82rem;
        padding: 0.5rem 0.4rem;
    }

    .table .btn-sm {
        padding: 0.2rem 0.35rem;
        font-size: 0.75rem;
    }

    /* Stack filter form on smaller screens */
    form.row.g-2 > [class*="col-md"] {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 576px) {
    form.row.g-2 > [class*="col-md"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Activity counter */
.activity-counter {
    font-size: 2rem;
    font-weight: 700;
}

.activity-counter .target {
    font-size: 1rem;
    color: #6c757d;
    font-weight: 400;
}

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}
