/* CRM User Management Styles */

/* Page-specific styles */
.crm-user-page .content-header h2 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0;
}

/* Table styles */
#crmUserTable {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#crmUserTable th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#crmUserTable th:hover {
    background-color: #e9ecef;
}

#crmUserTable th i {
    margin-left: 5px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

#crmUserTable th:hover i {
    opacity: 0.8;
}

#crmUserTable th i.fa-sort-up,
#crmUserTable th i.fa-sort-down {
    opacity: 1;
    color: #007bff;
}

#crmUserTable th i.fa-sort-up {
    color: #28a745;
}

#crmUserTable th i.fa-sort-down {
    color: #dc3545;
}

/* Modal table sorting styles */
#modalCRMUserTable th {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#modalCRMUserTable th:hover {
    background-color: #e9ecef;
}

#modalCRMUserTable th i {
    margin-left: 5px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

#modalCRMUserTable th:hover i {
    opacity: 0.8;
}

#modalCRMUserTable th i.fa-sort-up,
#modalCRMUserTable th i.fa-sort-down {
    opacity: 1;
    color: #007bff;
}

#modalCRMUserTable th i.fa-sort-up {
    color: #28a745;
}

#modalCRMUserTable th i.fa-sort-down {
    color: #dc3545;
}

/* Modal table compact styling */
#modalCRMUserTable {
    font-size: 0.875rem;
    margin-bottom: 0;
}

#modalCRMUserTable th {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid #dee2e6;
}

#modalCRMUserTable td {
    padding: 0.5rem 0.25rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#modalCRMUserTable td:first-child,
#modalCRMUserTable td:nth-child(2) {
    white-space: normal;
    word-break: break-word;
}

/* Modal action buttons */
.unsubscribe-btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    border-radius: 0.2rem;
    transition: all 0.2s ease;
    min-width: 2rem;
}

.unsubscribe-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.unsubscribe-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Compact badge styling */
#modalCRMUserTable .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
}

#crmUserTable td {
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
}

/* Badge styles */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

.badge.bg-primary {
    background-color: #007bff !important;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Action button styles */
.view-details {
    transition: all 0.2s ease;
}

.view-details:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Button group styles */
.btn-group {
    gap: 2px;
}

.btn-group .btn {
    border-radius: 4px !important;
    margin: 0 1px;
}

.btn-group .btn:first-child {
    border-top-left-radius: 4px !important;
    border-bottom-left-radius: 4px !important;
}

.btn-group .btn:last-child {
    border-top-right-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
}

/* Re-process button styles */
.reprocess-btn {
    transition: all 0.2s ease;
}

.reprocess-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.reprocess-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.reprocess-btn .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal styles */
#crmUserDetailModal .modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

#crmUserDetailModal .modal-title {
    color: #2c3e50;
    font-weight: 600;
}

#crmUserDetailModal .modal-body {
    padding: 1.5rem;
}

#crmUserDetailModal .row {
    margin-bottom: 1rem;
}

#crmUserDetailModal strong {
    color: #495057;
    font-weight: 600;
}

/* Modal search styles */
#crmUserDetailModal .search-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

#crmUserDetailModal .search-container input {
    padding-left: 35px; /* Make room for clear icon */
    padding-right: 35px; /* Make room for search icon */
}

#crmUserDetailModal .search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

#crmUserDetailModal .clear-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    padding: 5px;
}

#crmUserDetailModal .clear-icon:hover {
    color: #dc3545;
}

/* Modal loading state */
#modalLoadingState {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#modalLoadingState .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Modal table styles */
#modalCRMUserTable {
    margin-top: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
}

#modalCRMUserTable th {
    background-color: #e9ecef;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 2px solid #dee2e6;
}

#modalCRMUserTable td {
    font-size: 0.875rem;
    padding: 0.5rem;
    vertical-align: middle;
}

#modalCRMUserTable tbody tr:hover {
    background-color: #e3f2fd;
}

/* Modal pagination styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    flex: 1;
    min-width: 200px;
}

.pagination-nav {
    flex-shrink: 0;
}

#modalPagination .page-link {
    color: #007bff;
    border-color: #dee2e6;
    font-size: 0.875rem;
}

/* Mobile responsive styles for modal table */
@media (max-width: 768px) {
    #crmUserDetailModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    #crmUserDetailModal .modal-body {
        padding: 1rem;
    }
    
    /* Modal table mobile optimization */
    #modalTableContainer {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #modalCRMUserTable {
        min-width: 800px; /* Ensure table doesn't get too compressed */
        font-size: 0.8rem;
    }
    
    #modalCRMUserTable th,
    #modalCRMUserTable td {
        padding: 0.375rem 0.25rem;
        font-size: 0.75rem;
    }
    
    #modalCRMUserTable th {
        font-size: 0.7rem;
        font-weight: 600;
    }
    
    /* Hide less important columns on very small screens */
    #modalCRMUserTable th:nth-child(6), /* Days */
    #modalCRMUserTable th:nth-child(7), /* Visits */
    #modalCRMUserTable th:nth-child(8), /* Orders */
    #modalCRMUserTable td:nth-child(6),
    #modalCRMUserTable td:nth-child(7),
    #modalCRMUserTable td:nth-child(8) {
        display: none;
    }
    
    /* Make action buttons more touch-friendly */
    .unsubscribe-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
        min-width: 60px;
    }
    
    /* Modal pagination mobile */
    .pagination-container {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .pagination-info {
        text-align: center;
        min-width: auto;
        order: 1;
    }
    
    .pagination-nav {
        order: 2;
    }
    
    #modalPagination {
        justify-content: center;
    }
    
    #modalPagination .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
        margin: 0.125rem;
    }
}

@media (max-width: 576px) {
    #crmUserDetailModal .modal-dialog {
        margin: 0.25rem;
        max-width: calc(100% - 0.5rem);
    }
    
    #crmUserDetailModal .modal-body {
        padding: 0.75rem;
    }
    
    /* Further optimize table for very small screens */
    #modalCRMUserTable {
        min-width: 600px;
        font-size: 0.75rem;
    }
    
    #modalCRMUserTable th,
    #modalCRMUserTable td {
        padding: 0.25rem 0.125rem;
        font-size: 0.7rem;
    }
    
    /* Hide more columns on very small screens */
    #modalCRMUserTable th:nth-child(5), /* Last Date */
    #modalCRMUserTable th:nth-child(6), /* Days */
    #modalCRMUserTable th:nth-child(7), /* Visits */
    #modalCRMUserTable th:nth-child(8), /* Orders */
    #modalCRMUserTable th:nth-child(9), /* Spend */
    #modalCRMUserTable td:nth-child(5),
    #modalCRMUserTable td:nth-child(6),
    #modalCRMUserTable td:nth-child(7),
    #modalCRMUserTable td:nth-child(8),
    #modalCRMUserTable td:nth-child(9) {
        display: none;
    }
    
    /* Make search container full width */
    #crmUserDetailModal .search-container {
        width: 100%;
    }
    
    #crmUserDetailModal .search-container input {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Optimize action buttons */
    .unsubscribe-btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.7rem;
        min-width: 50px;
    }
    
    /* Compact pagination */
    #modalPagination .page-link {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
        margin: 0.0625rem;
    }
}

#modalPagination .page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: #0056b3;
}

#modalPagination .page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
}

#modalPagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
}

.pagination-info {
    font-size: 0.875rem;
}

/* Modal results count */
#modalResultsCount {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Filter dropdown styles */
.dropdown-item[data-filter] {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-item[data-filter]:hover {
    background-color: #f8f9fa;
}

/* Search container styles */
.search-container {
    position: relative;
    width: 300px;
}

.search-container input {
    padding-right: 30px;
    height: 38px;
    border-radius: 6px;
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
}

.clear-icon {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    cursor: pointer;
    transition: color 0.2s ease;
}

.clear-icon:hover {
    color: #dc3545;
}

/* Loading styles */
.loading-component {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.progress-container-component {
    width: 200px;
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-component {
    height: 100%;
    background-color: #007bff;
    animation: progress-animation 1.5s ease-in-out infinite;
}

.loading-text-component {
    color: #6c757d;
    font-size: 0.875rem;
}

@keyframes progress-animation {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 100%;
        margin-left: 0%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Responsive styles */
@media (max-width: 768px) {
    .search-container {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .action-left {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #crmUserTable {
        font-size: 0.875rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Empty state styles */
.text-center.text-muted.py-4 {
    padding: 2rem 1rem;
}

.text-center.text-muted.py-4 i {
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* Hover effects for table rows */
#crmUserTable.table-striped tbody tr:hover,
#crmUserTable tbody tr:hover,
#crmUserTable tr:hover {
    background-color: #e3f2fd !important;
    transition: background-color 0.2s ease;
}

#crmUserTable.table-striped tbody tr:hover td,
#crmUserTable tbody tr:hover td,
#crmUserTable tr:hover td {
    background-color: #e3f2fd !important;
    transition: background-color 0.2s ease;
}

/* Status indicator styles */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-indicator.active {
    background-color: #28a745;
}

.status-indicator.inactive {
    background-color: #6c757d;
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.toast-notification {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    border-left: 4px solid #007bff;
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-notification.success {
    border-left-color: #28a745;
}

.toast-notification.error {
    border-left-color: #dc3545;
}

.toast-notification.warning {
    border-left-color: #ffc107;
}

.toast-notification.info {
    border-left-color: #17a2b8;
}

.toast-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.toast-icon {
    margin-right: 8px;
    font-size: 16px;
}

.toast-icon.success {
    color: #28a745;
}

.toast-icon.error {
    color: #dc3545;
}

.toast-icon.warning {
    color: #ffc107;
}

.toast-icon.info {
    color: #17a2b8;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    flex-grow: 1;
}

.toast-close {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

.toast-close:hover {
    color: #495057;
}

.toast-body {
    padding: 12px 16px;
    color: #495057;
    font-size: 14px;
    line-height: 1.4;
}

.toast-progress {
    height: 3px;
    background: #e9ecef;
    width: 100%;
}

.toast-progress-bar {
    height: 100%;
    background: #007bff;
    width: 100%;
    transition: width linear;
}

.toast-progress-bar.success {
    background: #28a745;
}

.toast-progress-bar.error {
    background: #dc3545;
}

.toast-progress-bar.warning {
    background: #ffc107;
}

.toast-progress-bar.info {
    background: #17a2b8;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast-notification {
        margin-bottom: 8px;
    }
} 