/* Custom styles for CNERP */
.brand-text {
    font-weight: 300 !important;
}

.login-box {
    width: 400px;
}

.card-header a {
    text-decoration: none;
}

/* DataTables customization */
.table-responsive {
    overflow-x: auto;
}

/* Form enhancements */
.form-group label {
    font-weight: 600;
}

.required::after {
    content: " *";
    color: #dc3545;
}

/* Button spacing */
.btn + .btn {
    margin-left: 5px;
}

/* Alert improvements */
.alert {
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Card enhancements */
.card {
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
}

/* Sidebar improvements */
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
    background-color: #007bff;
    color: #fff;
}

/* Table improvements */
.table th {
    border-top: none;
    font-weight: 600;
}

/* Status badges */
.status-active {
    background-color: #28a745;
}

.status-inactive {
    background-color: #6c757d;
}

/* Custom loader */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Performance optimizations */
.img-circle {
    will-change: transform;
    backface-visibility: hidden;
}

/* Lazy loading images */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[data-loaded="true"] {
    opacity: 1;
}

/* Avatar optimizations */
.user-panel .image img {
    width: 2.1rem;
    height: 2.1rem;
    object-fit: cover;
}

/* Preload important images */
.brand-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Reduce reflows */
.main-sidebar {
    contain: layout style;
}

.content-wrapper {
    contain: layout;
}

/* Responsive Table Styles */
@media (max-width: 768px) {
    .content-wrapper, .right-side {
        margin-left: 0 !important;
    }
    
    .main-sidebar {
        margin-left: -230px;
    }
    
    .sidebar-open .main-sidebar {
        margin-left: 0;
    }
    
    /* Mobile responsive table */
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 15px;
        background: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .table-responsive-stack tbody td {
        display: block;
        text-align: left !important;
        border: none;
        border-bottom: 1px solid #eee;
        padding: 8px 0;
        position: relative;
        padding-left: 120px;
    }
    
    .table-responsive-stack tbody td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0;
        top: 8px;
        font-weight: 600;
        color: #495057;
        width: 110px;
        text-align: left;
    }
    
    .table-responsive-stack tbody td:last-child {
        border-bottom: none;
    }
    
    /* Action buttons in mobile */
    .table-responsive-stack .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .table-responsive-stack .btn-group .btn {
        flex: 1;
        min-width: auto;
    }
    
    /* Badge styles in mobile */
    .table-responsive-stack .badge {
        display: inline-block;
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 20px;
    }
    
    /* Phone number in mobile */
    .table-responsive-stack td a[href^="tel:"] {
        color: #007bff;
        text-decoration: none;
        font-weight: 500;
    }
    
    /* Date formatting in mobile */
    .table-responsive-stack td[data-label="Date"] {
        font-weight: 600;
        color: #495057;
    }
    
    /* Name formatting in mobile */
    .table-responsive-stack td[data-label="Name"] strong {
        color: #2c3e50;
        font-size: 16px;
    }
}

/* Tablet responsive adjustments */
@media (max-width: 992px) and (min-width: 769px) {
    .table-responsive-stack th,
    .table-responsive-stack td {
        font-size: 14px;
        padding: 8px 6px;
    }
    
    .table-responsive-stack .btn-group .btn {
        padding: 4px 8px;
        font-size: 12px;
    }
}





@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}





/* Permission matrix styling */
.permission-matrix {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
}

.permission-module {
    margin-bottom: 20px;
}

.permission-module h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #dee2e6;
}

/* Search form improvements */
.search-form .input-group {
    width: 300px;
}

/* Action buttons */
.action-buttons {
    white-space: nowrap;
}

.action-buttons .btn {
    margin-right: 2px;
    margin-bottom: 2px;
}

/* Statistics cards */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stats-card .card-body {
    padding: 1.5rem;
}

.stats-number {
    font-size: 2rem;
    font-weight: bold;
}

.stats-label {
    font-size: 0.9rem;
    opacity: 0.8;
}



/* Validation errors */
.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

/* Success states */
.is-valid {
    border-color: #28a745;
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #28a745;
}

/* Modal interaction fixes */
.modal {
    z-index: 1050 !important;
}

.modal-backdrop {
    z-index: 1040 !important;
}

.modal.show {
    z-index: 1055 !important;
}

.modal-dialog {
    z-index: 1060 !important;
}

.modal-content {
    z-index: 1070 !important;
    position: relative;
    pointer-events: auto !important;
}

.modal-content * {
    pointer-events: auto !important;
}

.modal-header,
.modal-body,
.modal-footer {
    pointer-events: auto !important;
}

.modal-header .close,
.modal-footer .btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Ensure form elements in modals are interactive */
.modal input,
.modal select,
.modal textarea,
.modal button {
    pointer-events: auto !important;
    cursor: auto !important;
}

.modal .btn {
    cursor: pointer !important;
}

/* Fix any potential overlay issues */
body.modal-open {
    overflow: hidden;
}

/* Ensure modal is above everything */
#endCallModal {
    z-index: 9999 !important;
}

#endCallModal .modal-dialog {
    z-index: 10000 !important;
}

#endCallModal .modal-content {
    z-index: 10001 !important;
}