/* Global Modal Styles for Admin Panel */

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

.modal-backdrop.hidden {
    display: none;
}

/* Modal Content */
.modal-content {
    background: var(--volvo-white);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.modal-header {
    background: var(--volvo-gray-50);
    border-bottom: 1px solid var(--volvo-gray-200);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--volvo-gray-800);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--volvo-gray-500);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    background: var(--volvo-gray-200);
    color: var(--volvo-gray-700);
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--volvo-gray-100);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--volvo-gray-300);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--volvo-gray-400);
}

/* Modal Footer */
.modal-footer {
    background: var(--volvo-gray-50);
    border-top: 1px solid var(--volvo-gray-200);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Modal Sizes */
.modal-sm .modal-content {
    max-width: 500px;
}

.modal-lg .modal-content {
    max-width: 1000px;
}

.modal-xl .modal-content {
    max-width: 1400px;
}

.modal-fullscreen .modal-content {
    max-width: 98vw;
    max-height: 95vh;
}

/* Dark Theme Modals */
body.dark-theme .modal-backdrop {
    background: rgba(0, 0, 0, 0.8);
}

body.dark-theme .modal-content {
    background: var(--dark-bg-card);
    border: 1px solid var(--dark-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

body.dark-theme .modal-header {
    background: var(--dark-bg-tertiary);
    border-bottom-color: var(--dark-border);
}

body.dark-theme .modal-title {
    color: var(--dark-text-primary);
}

body.dark-theme .modal-close {
    color: var(--dark-text-muted);
}

body.dark-theme .modal-close:hover {
    background: var(--dark-bg-secondary);
    color: var(--dark-text-primary);
}

body.dark-theme .modal-body {
    color: var(--dark-text-secondary);
    background: var(--dark-bg-card);
}

body.dark-theme .modal-body::-webkit-scrollbar-track {
    background: var(--dark-bg-tertiary);
}

body.dark-theme .modal-body::-webkit-scrollbar-thumb {
    background: var(--dark-border);
}

body.dark-theme .modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--dark-border-light);
}

body.dark-theme .modal-footer {
    background: var(--dark-bg-tertiary);
    border-top-color: var(--dark-border);
}

/* Modal Form Elements */
.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--volvo-gray-700);
}

.modal-body .form-group input,
.modal-body .form-group textarea,
.modal-body .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--volvo-gray-300);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.modal-body .form-group input:focus,
.modal-body .form-group textarea:focus,
.modal-body .form-group select:focus {
    outline: none;
    border-color: var(--volvo-blue);
    box-shadow: 0 0 0 3px rgba(0, 48, 87, 0.1);
}

/* Dark Theme Form Elements */
body.dark-theme .modal-body .form-group label {
    color: var(--dark-text-secondary);
}

body.dark-theme .modal-body .form-group input,
body.dark-theme .modal-body .form-group textarea,
body.dark-theme .modal-body .form-group select {
    background: var(--dark-bg-tertiary);
    border-color: var(--dark-border);
    color: var(--dark-text-primary);
}

body.dark-theme .modal-body .form-group input:focus,
body.dark-theme .modal-body .form-group textarea:focus,
body.dark-theme .modal-body .form-group select:focus {
    border-color: var(--dark-accent-blue);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Modal Buttons */
.modal-footer .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-footer .btn-primary {
    background: var(--volvo-blue);
    color: white;
    border: none;
}

.modal-footer .btn-primary:hover {
    background: #004a7c;
    transform: translateY(-1px);
}

.modal-footer .btn-secondary {
    background: var(--volvo-gray-200);
    color: var(--volvo-gray-700);
    border: 1px solid var(--volvo-gray-300);
}

.modal-footer .btn-secondary:hover {
    background: var(--volvo-gray-300);
    transform: translateY(-1px);
}

/* Dark Theme Modal Buttons */
body.dark-theme .modal-footer .btn-primary {
    background: var(--dark-accent-blue);
    color: var(--dark-text-primary);
}

body.dark-theme .modal-footer .btn-primary:hover {
    background: #1976d2;
}

body.dark-theme .modal-footer .btn-secondary {
    background: var(--dark-bg-secondary);
    color: var(--dark-text-secondary);
    border-color: var(--dark-border);
}

body.dark-theme .modal-footer .btn-secondary:hover {
    background: var(--dark-bg-tertiary);
    color: var(--dark-text-primary);
}

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

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

body.dark-theme .modal-loading::after {
    background: rgba(26, 26, 26, 0.8);
}

.modal-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--volvo-gray-200);
    border-top: 4px solid var(--volvo-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

body.dark-theme .modal-loading .loading-spinner {
    border-color: var(--dark-border);
    border-top-color: var(--dark-accent-blue);
}

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

/* Responsive Modals */
@media (max-width: 768px) {
    .modal-backdrop {
        padding: 10px;
    }
    
    .modal-content {
        max-width: 98vw;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .modal-footer .btn:last-child {
        margin-bottom: 0;
    }
}

/* Modal Animations */
.modal-fade-in {
    animation: modalFadeIn 0.3s ease-out;
}

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

.modal-slide-up {
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Overlay Click */
.modal-backdrop.clickable {
    cursor: pointer;
}

.modal-backdrop.clickable .modal-content {
    cursor: default;
}

/* Modal Close on Escape */
.modal-backdrop:focus {
    outline: none;
}

/* Modal Content Focus */
.modal-content:focus {
    outline: none;
}


