/* Modern CRM Styles - Scoped to .crm-frontend-wrap only */
.crm-frontend-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Hero Card */
.crm-frontend-wrap .crm-hero-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 1.5rem;
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.crm-frontend-wrap .crm-hero-copy {
    flex: 1;
}

.crm-frontend-wrap .crm-label {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.crm-frontend-wrap .crm-hero-card h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    color:#fff;
}

.crm-frontend-wrap .crm-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 0.95rem;
    line-height: 1.5;
}

.crm-frontend-wrap .crm-hero-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.crm-frontend-wrap .crm-meta-panel {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 1rem;
}

.crm-frontend-wrap .crm-meta-panel span {
    display: block;
    font-size: 0.7rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.crm-frontend-wrap .crm-meta-panel strong {
    display: block;
    font-size: 0.85rem;
}

/* Filter Panel */
.crm-frontend-wrap .crm-filter-panel {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .crm-frontend-wrap .crm-filter-panel {
        grid-template-columns: 1fr;
    }
}

.crm-frontend-wrap .crm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.crm-frontend-wrap .crm-input-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.crm-frontend-wrap .crm-search-field {
    position: relative;
}

.crm-frontend-wrap .crm-search-field input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.crm-frontend-wrap .crm-search-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.crm-frontend-wrap .crm-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* Multi-select dropdown styles */
.crm-frontend-wrap .crm-multiselect {
    position: relative;
}

.crm-frontend-wrap .crm-multiselect-btn {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: white;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #374151;
    transition: all 0.2s;
}

.crm-frontend-wrap .crm-multiselect-btn:hover {
    border-color: #667eea;
}

.crm-frontend-wrap .crm-multiselect-btn.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.crm-frontend-wrap .crm-multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.crm-frontend-wrap .crm-multiselect-dropdown.show {
    display: block;
}

.crm-frontend-wrap .crm-multiselect-option {
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.crm-frontend-wrap .crm-multiselect-option:hover {
    background: #f3f4f6;
}

.crm-frontend-wrap .crm-multiselect-option input {
    margin: 0;
}

.crm-frontend-wrap .crm-multiselect-option label {
    flex: 1;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
}

/* Filter panel select */
.crm-frontend-wrap .crm-filter-panel select {
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
}

.crm-frontend-wrap .crm-filter-panel select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons - Global button styles */
.crm-frontend-wrap button,
.crm-frontend-wrap .crm-button {
    cursor: pointer;
    transition: all 0.2s;
}

.crm-frontend-wrap button:disabled,
.crm-frontend-wrap .crm-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.crm-frontend-wrap .crm-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.crm-frontend-wrap .crm-button-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.crm-frontend-wrap .crm-button-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.crm-frontend-wrap .crm-button-secondary:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

/* Data Card */
.crm-frontend-wrap .crm-data-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Table Styles */
.crm-frontend-wrap .crm-table-shell {
    overflow-x: auto;
}

/* Table Styles - Updated for 4 columns (without WP Role) */
.crm-frontend-wrap .crm-table-head {
    display: grid;
    grid-template-columns: 1.5fr 2fr 2fr 1.5fr;
    background: #f9fafb;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}

.crm-frontend-wrap .crm-table-row {
    display: grid;
    grid-template-columns: 1.5fr 2fr 2fr 1.5fr;
    padding: 1rem 1.5rem;
    align-items: center;
    transition: background 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.crm-frontend-wrap .crm-table-row:hover {
    background: #f9fafb;
}

.crm-frontend-wrap .crm-table-cell {
    padding: 0.25rem;
}

/* Badges */
.crm-frontend-wrap .crm-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0.125rem;
}

.crm-frontend-wrap .crm-badge-empty {
    background: #f3f4f6;
    color: #6b7280;
}

/* Edit Roles Button */
.crm-frontend-wrap .edit-roles-btn {
    background: white;
    color: #4f46e5;
    border: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.crm-frontend-wrap .edit-roles-btn:hover {
    background: #f9fafb;
    border-color: #4f46e5;
    transform: translateY(-1px);
}

/* Reset Button */
.crm-frontend-wrap #crm-frontend-reset {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

.crm-frontend-wrap #crm-frontend-reset:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

/* Pagination */
.crm-frontend-wrap .crm-pagination {
    padding: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.crm-frontend-wrap .crm-pagination-inner {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.crm-frontend-wrap .crm-pagination-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.crm-frontend-wrap .crm-pagination-info {
    font-size: 0.875rem;
    color: #6b7280;
    margin-left: 1rem;
}

/* Loading States */
.crm-frontend-wrap .crm-skeleton-grid {
    padding: 1.5rem;
}

.crm-frontend-wrap .crm-skeleton-card {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: crmShimmer 1.5s infinite;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

@keyframes crmShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.crm-frontend-wrap .crm-skeleton-line {
    height: 1rem;
    background: rgba(0,0,0,0.1);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.crm-frontend-wrap .crm-skeleton-title {
    width: 60%;
    height: 1.5rem;
}

.crm-frontend-wrap .crm-skeleton-actions {
    width: 40%;
    height: 2rem;
}

/* Empty State */
.crm-frontend-wrap .crm-empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.crm-frontend-wrap .crm-empty-illustration {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.crm-frontend-wrap .crm-empty-copy h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

.crm-frontend-wrap .crm-empty-copy p {
    color: #6b7280;
}

/* Toast Notifications */
.crm-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 99999;
}

.crm-toast {
    background: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    margin-top: 0.5rem;
    animation: crmSlideInRight 0.3s ease-out;
    border-left: 4px solid;
}

.crm-toast-success {
    border-left-color: #10b981;
    color: #065f46;
}

.crm-toast-error {
    border-left-color: #ef4444;
    color: #991b1b;
}

@keyframes crmSlideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal Styles */
.crm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.crm-modal {
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.crm-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 1rem 1rem 0 0;
}

.crm-modal-header h3 {
    margin: 0;
    color: white;
}

.crm-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    opacity: 0.8;
}

.crm-modal-close:hover {
    opacity: 1;
}

.crm-modal-body {
    padding: 1.5rem;
}

.crm-modal-body label {
    display: block;
    /*margin-bottom: 1rem;*/
    font-weight: 600;
    color: #374151;
}

.crm-roles-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.crm-role-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

.crm-role-checkbox:hover {
    background: #f9fafb;
}

.crm-role-checkbox input {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.crm-role-checkbox span {
    font-size: 0.875rem;
    color: #374151;
}

/* Modal Footer - Button Styles */
.crm-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f9fafb;
    border-radius: 0 0 1rem 1rem;
}

.crm-modal-footer .crm-button {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    cursor: pointer;
}

.crm-modal-footer .crm-button-secondary {
    background: white;
    color: #4b5563;
    border: 1px solid #d1d5db;
}

.crm-modal-footer .crm-button-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.crm-modal-footer .crm-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.crm-modal-footer .crm-button-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .crm-frontend-wrap {
        padding: 1rem;
    }
    
    .crm-frontend-wrap .crm-hero-card {
        padding: 1.5rem;
        flex-direction: column;
        text-align: center;
    }
    
    .crm-frontend-wrap .crm-table-head {
        display: none;
    }
    
    .crm-frontend-wrap .crm-table-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .crm-frontend-wrap .crm-table-cell {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .crm-frontend-wrap .crm-table-cell::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 0.75rem;
    }
    
    .crm-frontend-wrap .crm-pagination {
        justify-content: center;
    }
    
    .crm-pagination-inner {
        justify-content: center;
    }
    
    .crm-modal {
        width: 95%;
        margin: 1rem;
    }
}

/* Access Denied Page Styles */
.crm-access-denied {
    text-align: center;
    padding: 60px 30px;
    max-width: 550px;
    margin: 80px auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.1);
    animation: crmFadeInUp 0.5s ease-out;
}

@keyframes crmFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.crm-access-denied-icon {
    font-size: 72px;
    margin-bottom: 20px;
    animation: crmBounce 0.6s ease-out;
}

@keyframes crmBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.crm-access-denied h3 {
    font-size: 28px;
    margin-bottom: 15px;
    color: #1f2937;
    font-weight: 700;
}

.crm-access-denied p {
    color: #6b7280;
    margin-bottom: 15px;
    line-height: 1.6;
    font-size: 16px;
}

.crm-access-denied-btn {
    display: inline-block;
    margin-top: 10px;
    margin-right: 12px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.crm-access-denied-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(102, 126, 234, 0.4);
    color: white;
}

.crm-access-denied-btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.crm-access-denied-btn-secondary:hover {
    background: #d1d5db;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    color: #374151;
}

@media (max-width: 640px) {
    .crm-access-denied {
        margin: 40px 20px;
        padding: 40px 20px;
    }
    
    .crm-access-denied h3 {
        font-size: 22px;
    }
    
    .crm-access-denied-btn {
        display: block;
        margin: 10px auto;
        width: 80%;
        text-align: center;
    }
}