/* ==========================================================================
   Modals
   ========================================================================== */

/* Modal overlay */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
.modal-container { position: relative; background: white; border-radius: var(--radius-lg); width: 90%; max-width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: modal-slide-in 0.2s ease; }
.modal-container-lg { max-width: 700px; }
.modal-container-sm { max-width: 380px; }

/* Modal sections */
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--secondary-color); padding: 0; line-height: 1; }
.modal-close:hover { color: var(--dark-color); }
.modal-body { padding: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); }

/* Tabs inside modals */
.tab-bar { display: flex; margin-bottom: 1.25rem; border-bottom: 2px solid var(--border-color); }
.tab-btn { background: none; border: none; padding: 0.625rem 1rem; cursor: pointer; font-size: 0.9rem; color: var(--secondary-color); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 0.2s, border-color 0.2s; }
.tab-btn:hover { color: var(--dark-color); }
.tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); font-weight: 500; }

/* Animation */
@keyframes modal-slide-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Toast notifications */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 3000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.75rem 1.25rem; border-radius: var(--radius-md); color: white; font-size: 0.9rem; font-weight: 500; animation: toast-slide-in 0.3s ease; box-shadow: var(--shadow-lg); }
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
@keyframes toast-slide-in { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* Mobile: keep modals inside the viewport and scrollable. */
@media (max-width: 768px) {
    .modal-container { width: calc(100% - 1.5rem); max-height: 88vh; display: flex; flex-direction: column; }
    .modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
}
