UNPKG

geeks-ui-framework

Version:

A modern, lightweight CSS framework with 15+ components for developers. Build beautiful interfaces with minimal effort.

310 lines (263 loc) 5.92 kB
/* =================================== MODAL COMPONENT =================================== */ /* Modal Backdrop */ .modal { position: fixed; top: 0; left: 0; z-index: 1050; display: none; width: 100%; height: 100%; overflow-x: hidden; overflow-y: auto; outline: 0; background-color: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); } .modal.show { display: flex; align-items: center; justify-content: center; animation: modalFadeIn 0.3s ease-out; } /* Modal Dialog */ .modal-dialog { position: relative; width: auto; margin: 1rem; pointer-events: none; max-width: 500px; animation: modalSlideIn 0.3s ease-out; } .modal-dialog-centered { display: flex; align-items: center; min-height: calc(100% - 2rem); } /* Modal Content */ .modal-content { position: relative; display: flex; flex-direction: column; width: 100%; pointer-events: auto; background-color: var(--white); background-clip: padding-box; border: 1px solid var(--border-color); border-radius: 0.5rem; box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); outline: 0; } /* Modal Header */ .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 1.5rem 1rem 1.5rem; border-bottom: 1px solid var(--border-color); border-top-left-radius: calc(0.5rem - 1px); border-top-right-radius: calc(0.5rem - 1px); } .modal-title { margin: 0; line-height: 1.5; font-size: 1.25rem; font-weight: 600; color: var(--text-color); } /* Modal Body */ .modal-body { position: relative; flex: 1 1 auto; padding: 1.5rem; color: var(--text-color); line-height: 1.6; } /* Modal Footer */ .modal-footer { display: flex; align-items: center; justify-content: flex-end; padding: 1rem 1.5rem 1.5rem 1.5rem; border-top: 1px solid var(--border-color); border-bottom-right-radius: calc(0.5rem - 1px); border-bottom-left-radius: calc(0.5rem - 1px); gap: 0.5rem; } .modal-footer>* { margin: 0; } /* Close Button */ .modal-close { position: relative; width: 2rem; height: 2rem; padding: 0; margin: 0; background: none; border: none; font-size: 1.5rem; line-height: 1; color: var(--muted-color); cursor: pointer; transition: color 0.15s ease-in-out, opacity 0.15s ease-in-out; display: flex; align-items: center; justify-content: center; border-radius: 0.25rem; } .modal-close:hover { color: var(--text-color); background-color: var(--light-gray); } .modal-close:focus { outline: 0; box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25); } .modal-close::before { content: '×'; font-weight: 300; } /* Modal Sizes */ .modal-sm { max-width: 300px; } .modal-lg { max-width: 800px; } .modal-xl { max-width: 1140px; } .modal-fullscreen { width: 100vw; max-width: none; height: 100%; margin: 0; } .modal-fullscreen .modal-content { height: 100%; border: 0; border-radius: 0; } .modal-fullscreen .modal-header, .modal-fullscreen .modal-footer { border-radius: 0; } /* Modal Animations */ @keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes modalSlideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } /* Modal Scrollable */ .modal-dialog-scrollable { height: calc(100% - 2rem); } .modal-dialog-scrollable .modal-content { max-height: 100%; overflow: hidden; } .modal-dialog-scrollable .modal-body { overflow-y: auto; } /* Responsive Modal */ @media (min-width: 576px) { .modal-dialog { max-width: 500px; margin: 1.75rem auto; } .modal-dialog-centered { min-height: calc(100% - 3.5rem); } .modal-sm { max-width: 300px; } .modal-lg { max-width: 800px; } .modal-xl { max-width: 1140px; } } @media (min-width: 992px) { .modal-lg, .modal-xl { max-width: 800px; } } @media (min-width: 1200px) { .modal-xl { max-width: 1140px; } } /* Modal Variants */ .modal-primary .modal-header { background-color: var(--primary-color); border-color: var(--primary-color); color: var(--white); } .modal-primary .modal-title { color: var(--white); } .modal-primary .modal-close { color: rgba(255, 255, 255, 0.8); } .modal-primary .modal-close:hover { color: var(--white); background-color: rgba(255, 255, 255, 0.1); } .modal-success .modal-header { background-color: var(--success-color); border-color: var(--success-color); color: var(--white); } .modal-warning .modal-header { background-color: var(--warning-color); border-color: var(--warning-color); color: var(--text-color); } .modal-danger .modal-header { background-color: var(--danger-color); border-color: var(--danger-color); color: var(--white); } .modal-info .modal-header { background-color: var(--info-color); border-color: var(--info-color); color: var(--white); } /* Modal JavaScript Helper Classes */ .modal-backdrop { position: fixed; top: 0; left: 0; z-index: 1040; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.5); } .modal-backdrop.fade { opacity: 0; } .modal-backdrop.show { opacity: 0.5; } /* Body Class Helper */ body.modal-open { overflow: hidden; }