/* ============================================================================
   SIDE PANEL MODAL SYSTEM - Professional Implementation
   ============================================================================ */

/* Side Panel Container - Full Screen Replacement */
.side-panel-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1070;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    box-shadow: none;
    will-change: transform;
}

/* Side Panel Active State */
.side-panel-container.active {
    transform: translateX(0) !important;
}

/* Side Panel Header */
.side-panel-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: white;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.side-panel-header h5 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.side-panel-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.side-panel-header .btn-close:hover {
    opacity: 1;
}

/* Side Panel Body */
.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: #f8f9fa;
}

/* Custom scrollbar for side panel */
.side-panel-body::-webkit-scrollbar {
    width: 8px;
}

.side-panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.side-panel-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.side-panel-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Side Panel Form Styles */
.side-panel-body .form-label {
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.side-panel-body .form-control,
.side-panel-body .form-select {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.side-panel-body .form-control:focus,
.side-panel-body .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    outline: none;
}

.side-panel-body .form-control::placeholder {
    color: #6c757d;
}

/* Dropdown with action button in side panel */
.side-panel-body .dropdown-with-action-btn {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.side-panel-body .dropdown-with-action-btn .form-select {
    flex: 1;
    margin: 0;
}

.side-panel-body .dropdown-action-btn {
    padding: 0.75rem 0.875rem;
    flex-shrink: 0;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.side-panel-body .dropdown-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Alert boxes in side panel */
.side-panel-body .alert {
    border-radius: 0.375rem;
    border: 1px solid transparent;
    padding: 0.875rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.side-panel-body .alert-info {
    background-color: #cfe2ff;
    border-color: #b6d4fe;
    color: #084298;
}

.side-panel-body .alert-warning {
    background-color: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

/* Side Panel Footer */
.side-panel-footer {
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
    justify-content: flex-end;
}

.side-panel-footer .btn {
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
}

.side-panel-footer .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.side-panel-footer .btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
}

.side-panel-footer .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.side-panel-footer .btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.side-panel-footer .btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Loading state for buttons */
.side-panel-footer .btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.side-panel-footer .btn .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.25em;
}

/* Backdrop for side panel - Full screen */
.side-panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 1069;
    transition: background 0.3s ease;
    cursor: pointer;
    will-change: background;
}

.side-panel-backdrop.active {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Responsive: Mobile Devices */
@media (max-width: 576px) {
    .side-panel-container {
        width: 100%;
        height: 100%;
    }

    .side-panel-body {
        padding: 1.5rem;
    }

    .side-panel-footer {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .side-panel-footer .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Responsive: Tablet */
@media (min-width: 577px) and (max-width: 992px) {
    .side-panel-container {
        width: 100%;
        height: 100%;
    }
}

/* Form Groups Spacing */
.side-panel-body .mb-3 {
    margin-bottom: 1.5rem;
}

.side-panel-body .mb-3:last-child {
    margin-bottom: 1rem;
}

/* Invalid feedback */
.side-panel-body .invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

.side-panel-body .form-control.is-invalid,
.side-panel-body .form-select.is-invalid {
    border-color: #dc3545;
}

.side-panel-body .form-control.is-invalid:focus,
.side-panel-body .form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.side-panel-body .is-invalid ~ .invalid-feedback {
    display: block;
}

/* Smooth transitions for all interactive elements */
.side-panel-body input,
.side-panel-body select,
.side-panel-body button {
    transition: all 0.2s ease;
}

/* Animation for slide in/out */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Fade backdrop animation */
@keyframes fadeBackdrop {
    from {
        background: rgba(0, 0, 0, 0);
    }
    to {
        background: rgba(0, 0, 0, 0.5);
    }
}
