/**
 * Custom AJAX Handler Styles
 * Provides styling for loading states, toast notifications, and form validation
 */

 body{
    background-color: #82818514 !important;
 }

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

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

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

/* Form Validation Styles */
.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

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

.is-valid {
    border-color: #198754 !important;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25) !important;
}

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

/* Button Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast-custom {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
    margin-bottom: 10px;
    min-width: 300px;
}

.toast-custom .toast-header {
    border-bottom: 1px solid #e9ecef;
    background: transparent;
    padding: 12px 16px 8px;
}

.toast-custom .toast-body {
    padding: 12px 16px;
    font-size: 14px;
}

.toast-custom.toast-success {
    border-left: 4px solid #28a745;
}

.toast-custom.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-custom.toast-warning {
    border-left: 4px solid #ffc107;
}

.toast-custom.toast-info {
    border-left: 4px solid #17a2b8;
}

/* Form Styles */
.ajax-form {
    position: relative;
}

.ajax-form .form-control:focus {
    border-color: #696cff;
    box-shadow: 0 0 0 0.2rem rgba(105, 108, 255, 0.25);
}

.ajax-form .btn-primary {
    background-color: #696cff;
    border-color: #696cff;
}

.ajax-form .btn-primary:hover {
    background-color: #5f62e6;
    border-color: #5f62e6;
}

/* Table Loading States */
.table-loading {
    position: relative;
    min-height: 200px;
}

.table-loading::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #6c757d;
    font-size: 14px;
}

/* Search Input Styles */
.search-input {
    position: relative;
}

.search-input .search-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.search-input.loading .search-spinner {
    display: block;
}

/* Pagination Loading */
.pagination-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* File Upload Styles */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: #696cff;
    background-color: #f8f9ff;
}

.file-upload-area.dragover {
    border-color: #696cff;
    background-color: #f8f9ff;
}

.file-upload-area .upload-icon {
    font-size: 48px;
    color: #6c757d;
    margin-bottom: 16px;
}

.file-upload-area .upload-text {
    color: #6c757d;
    font-size: 14px;
}

/* Bulk Actions */
.bulk-actions {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
}

.bulk-actions.show {
    display: block;
}

.bulk-actions .selected-count {
    font-weight: 600;
    color: #696cff;
}

/* Action Buttons */
.action-btn {
    transition: all 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.action-btn:active {
    transform: translateY(0);
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.active {
    background-color: #28a745;
}

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

.status-indicator.pending {
    background-color: #ffc107;
}

.status-indicator.error {
    background-color: #dc3545;
}

/* Progress Bars */
.progress-custom {
    height: 6px;
    border-radius: 3px;
    background-color: #e9ecef;
}

.progress-custom .progress-bar {
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Modal Loading */
.modal-loading .modal-content {
    position: relative;
}

.modal-loading .modal-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.modal-loading .modal-content::before {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    color: #6c757d;
    font-size: 14px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast-custom {
        min-width: auto;
        width: 100%;
    }

    .loading-overlay {
        padding: 20px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.fade-out {
    animation: fadeOut 0.3s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.slide-out-right {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOutRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

/* Utility Classes */
.cursor-pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

.user-select-none {
    user-select: none;
}

.transition-all {
    transition: all 0.3s ease;
}

.shadow-hover:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Print Styles */
@media print {
    .loading-overlay,
    .toast-container,
    .bulk-actions,
    .action-btn {
        display: none !important;
    }
}

/* Fix for horizontal layout menu overlap */
.layout-horizontal .content-wrapper {
    padding-top: 4.5rem; /* Adjust to match your menu height if needed */
}


@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
    100% { transform: translateX(0); }
  }
  .card.shake {
    animation: shake 0.35s;
  }


  .alert-warning, .text-warning, .text-warning-emphasis, .bg-warning, .bg-gradient-warning, .btn-warning, .badge-warning, .border-warning{
    background-color: rgb(255, 192, 0) !important;
    border-color: rgb(255, 192, 0) !important;

  }

  .bg-dark-grey {
    --bs-bg-opacity: 1;
    background-color: #434343 !important;
}