/* ============================================ */
/* MODAL STYLES */
/* Common styles for all modals */
/* ============================================ */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

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

/* Modal Container */
.modal-container {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 48rem;
    width: 100%;
    margin: 1rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-container-sm {
    max-width: 32rem;
}

.modal-container-lg {
    max-width: 64rem;
}

.modal-container-xl {
    max-width: 80rem;
}

/* Modal Header */
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close-btn {
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
}

.modal-close-btn:hover {
    color: #374151;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-body-no-padding {
    padding: 0;
}

/* Modal Footer */
.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-footer-start {
    justify-content: flex-start;
}

.modal-footer-center {
    justify-content: center;
}

.modal-footer-between {
    justify-content: space-between;
}

/* Specific Modal Styles */

/* Technical Section Modal */
#custom-section-modal .modal-container {
    max-width: 64rem;
}

#custom-section-editor {
    height: 300px;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

/* Archive Modal */
#archive-modal .modal-container {
    max-width: 42rem;
}

#archive-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.archive-item {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.archive-item:hover {
    background-color: #f9fafb;
    border-color: #3b82f6;
}

/* Select Disciplines/Stages Modals */
.select-modal-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.select-modal-item {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.select-modal-item-selected {
    background-color: #eff6ff;
    border-color: #3b82f6;
}

/* Section Editor Modal (Legacy) */
#section-editor-modal textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

/* Toast Notification */
#toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background-color: #10b981;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    animation: slideIn 0.3s ease-out;
}

#toast.hidden {
    display: none;
}

#toast.error {
    background-color: #ef4444;
}

#toast.warning {
    background-color: #f59e0b;
}

#toast.info {
    background-color: #3b82f6;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal Animations */
.modal-overlay {
    animation: fadeIn 0.2s ease-out;
}

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

.modal-container {
    animation: slideUp 0.3s ease-out;
}

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .modal-container {
        max-width: 95%;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1.125rem;
    }
}

/* Scrollbar Styling for Modal Body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}
