/* Modal Base Styles - Light and Dark Mode */

/* Ensure modal appears above everything including navbar (z-index: 1100) */
.modal {
    z-index: 1200 !important;
}

.modal-backdrop {
    z-index: 1150 !important;
    background-color: rgba(0, 0, 0, 0.5);
}

/* Light Mode Modal Styles */
.modal-content {
    max-height: 90vh;
    border-radius: 0.5rem;
}

.modal-dialog {
    margin: 1.75rem auto;
    position: relative;
    z-index: 1200;
}

.modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 3.5rem);
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

.modal-header {
    padding: 0.875rem 1.25rem; /* Reduced from 1rem 1.5rem */
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    font-size: 1.125rem; /* Reduced from 1.25rem */
    font-weight: 600;
}

.modal-body {
    padding: 1.25rem; /* Reduced from 1.5rem */
    max-height: calc(90vh - 130px);
    overflow-y: auto;
}

.modal-footer {
    padding: 0.875rem 1.25rem; /* Reduced from 1rem 1.5rem */
    border-top: 1px solid #dee2e6;
}

/* Form spacing improvements */
.modal-body .row {
    margin-bottom: 0;
}

.modal-body .row > [class*="col-"] {
    margin-bottom: 0.75rem;
}

.form-label {
    font-size: 0.8125rem; /* Reduced from 0.875rem */
    margin-bottom: 0.35rem; /* Reduced from 0.375rem */
    font-weight: 500;
}

.form-control,
.form-select {
    font-size: 0.875rem; /* Reduced from 0.95rem */
    padding: 0.45rem 0.65rem; /* Reduced from 0.5rem 0.75rem */
}

.form-control:focus,
.form-select:focus {
    outline: none !important;
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

/* Required field indicator */
.text-danger {
    color: #dc3545 !important;
}

/* Button sizing in modal footer */
.modal-footer .btn {
    min-width: 90px; /* Reduced from 100px */
    padding: 0.45rem 0.875rem; /* Reduced from 0.5rem 1rem */
    font-size: 0.875rem; /* Added smaller font */
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem auto;
        max-width: calc(100vw - 1rem);
        width: calc(100vw - 1rem);
    }
    
    .modal-content {
        max-height: calc(100vh - 1rem);
        overflow-y: auto;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-header,
    .modal-footer {
        padding: 0.75rem 1rem;
        flex-shrink: 0;
    }
    
    .modal-header .btn-close {
        padding: 0.5rem;
        margin: -0.25rem -0.25rem -0.25rem auto;
    }
}

/* Ensure modal shows above sidebar and navbar */
.modal-dialog {
    position: relative;
    z-index: 1200;
}
