﻿/* Customers.css */
.customers-page {
    background-color: #f8f9fa;
    min-height: 100vh;
    padding: 0.75rem 0;
}

/* Page Header Styles */
.page-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 300;
}

.header-title p {
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Compact View Styles - Single Line Bar */
.page-header.compact {
    padding: 0.75rem 1.5rem;
    margin-bottom: 1rem;
}

.compact-bar {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    gap: 1rem;
    height: 2.5rem;
}

.compact-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.compact-icon {
    font-size: 1.25rem;
}

.compact-title {
    font-size: 1.25rem;
    font-weight: 500;
    white-space: nowrap;
}

.compact-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.filter-indicator {
    color: #ffc107;
    font-size: 1.2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

.stat-bubble {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

    .stat-bubble.primary {
        background: rgba(102, 126, 234, 0.3);
    }

    .stat-bubble.success {
        background: rgba(86, 171, 47, 0.3);
    }

    .stat-bubble.info {
        background: rgba(79, 172, 254, 0.3);
    }

    .stat-bubble.warning {
        background: rgba(242, 153, 74, 0.3);
    }

.bubble-value {
    font-weight: 600;
    font-size: 1.1rem;
}

.bubble-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.compact-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.compact-btn {
    padding: 0.25rem 0.75rem;
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

    .stat-card .stat-icon {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
        opacity: 0.8;
    }

    .stat-card .stat-value {
        font-size: 1.75rem;
        font-weight: 600;
        margin: 0;
    }

    .stat-card .stat-label {
        color: white;
        font-size: 0.875rem;
        margin: 0;
    }

    .stat-card.primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }

    .stat-card.success {
        background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
        color: white;
    }

    .stat-card.info {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        color: white;
    }

    .stat-card.warning {
        background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
        color: white;
    }

/* Main Content Area */
.main-content {
    margin-top: 1rem;
}

/* Panel Sections */
.panel-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.panel-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem 1.25rem;
}

    .panel-header h5 {
        font-weight: 600;
        color: #495057;
    }

/* Search Section */
.search-section {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Customer List */
.customer-list {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
}

.customer-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .customer-item:hover {
        background-color: #f8f9fa;
    }

    .customer-item.selected {
        background-color: #e7f1ff;
        border-left: 4px solid #667eea;
        padding-left: calc(1.25rem - 4px);
    }

    .customer-item:last-child {
        border-bottom: none;
    }

.customer-main {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.customer-sub {
    margin-bottom: 0;
}

/* Contact Cards */
.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
}

.contact-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
}

.contact-header {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.contact-comms {
    margin-top: 0.5rem;
}

.comm-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: white;
    border-radius: 4px;
    font-size: 0.875rem;
}

.comm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f8f9fa;
}

.comm-type-label {
    font-weight: 500;
    color: #495057;
    min-width: 80px;
}

.comm-data {
    word-break: break-word;
    flex: 1;
    color: #212529;
}

.contact-mini {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}

.empty-state h4 {
    color: #495057;
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: #495057;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Table Styles */
.table-responsive {
    max-height: calc(100vh - 500px);
    overflow-y: auto;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

/* Modal Customizations */
.modal-xl {
    max-width: 90%;
}

.modal-body dl {
    margin-bottom: 0;
}

.modal-body dt {
    font-weight: 600;
    color: #495057;
}

.modal-body dd {
    color: #212529;
    margin-bottom: 0.5rem;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
}

.page-link {
    color: #667eea;
}

.page-item.active .page-link {
    background-color: #667eea;
    border-color: #667eea;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .customers-page {
        padding: 1rem 0;
    }

    .page-header {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

        .header-actions .btn {
            flex: 1;
            max-width: 150px;
        }

    .header-title h1 {
        font-size: 1.5rem;
    }

    .stats-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

        .stat-card .stat-icon {
            font-size: 1.5rem;
        }

        .stat-card .stat-value {
            font-size: 1.5rem;
        }

    /* Compact view mobile adjustments */
    .page-header.compact {
        padding: 0.5rem 1rem;
    }

    .compact-bar {
        grid-template-columns: auto 1fr auto;
        gap: 0.75rem;
    }

    .compact-title {
        display: none;
    }

    .compact-center {
        gap: 0.5rem;
    }

    .stat-bubble {
        padding: 0.2rem 0.75rem;
    }

    .bubble-value {
        font-size: 1rem;
    }

    .bubble-label {
        display: none;
    }

    .compact-btn {
        padding: 0.25rem 0.5rem;
    }

    /* Main content mobile */
    .main-content .row {
        flex-direction: column;
    }

    .main-content .col-md-4,
    .main-content .col-md-8 {
        width: 100%;
        max-width: 100%;
    }

    .customer-list {
        max-height: 300px;
    }

    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .modal-xl {
        max-width: 100%;
        margin: 0.5rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .page-item {
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 576px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }

    .header-actions {
        flex-direction: column;
    }

        .header-actions .btn {
            width: 100%;
            max-width: none;
        }

    /* Force compact view on mobile */
    .page-header:not(.compact) {
        display: none;
    }

    /* Compact view responsive - keep single line */
    .compact-bar {
        grid-template-columns: auto 1fr auto;
    }

    .compact-icon {
        font-size: 1.1rem;
    }

    .stat-bubble {
        padding: 0.15rem 0.5rem;
        gap: 0.25rem;
    }

    .bubble-value {
        font-size: 0.9rem;
    }

    .compact-btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.875rem;
    }

        .compact-btn .oi {
            font-size: 0.875rem;
        }

    /* Modal responsive */
    .modal-body .row {
        flex-direction: column;
    }

    .modal-body .col-md-6 {
        width: 100%;
        margin-bottom: 1rem;
    }
}

/* Scrollbar Styling */
.customer-list::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 8px;
}

.customer-list::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.customer-list::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

    .customer-list::-webkit-scrollbar-thumb:hover,
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
