/* =================================================================
   bip-modal.css
   Reusable modal chrome. Bootstrap-style class API; no Bootstrap dep.

   Markup:
     <div class="bip-modal" id="...">
       <div class="bip-modal-dialog bip-modal-dialog--{sm|md|lg|xl}">
         <div class="bip-modal-content">
           <div class="bip-modal-header">
             <h5 class="bip-modal-title">...</h5>
             <button class="bip-modal-close bip-modal-x">×</button>
           </div>
           <div class="bip-modal-body">...</div>
           <div class="bip-modal-footer">
             <button class="bip-modal-close bip-btn-secondary">Close</button>
           </div>
         </div>
       </div>
     </div>

   Class roles:
     .bip-modal-close — BEHAVIOR ONLY (JS hooks into this to close).
                        Combine with any button style class (.bip-modal-x,
                        .bip-btn-secondary, etc.) for visual styling.
     .bip-modal-x     — STYLE for the round red X icon used in headers.

   Open / close JS in assets/js/bip-modal.js — toggles .is-open and
   triggers the fade + slide transition below.
   ================================================================= */

.bip-modal {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    inset: 0;
    z-index: 99000;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
    box-sizing: border-box;
    /* Fade-out: opacity glides; visibility flips at the end so clicks
       can't hit a modal that's mid-fade-out. */
    transition: opacity 0.25s ease, visibility 0s 0.25s;
}
.bip-modal.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.25s ease, visibility 0s 0s;
}
body.bip-modal-open { overflow: hidden; }

.bip-modal-dialog {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.30);
    width: 100%;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Fade-up entry: starts 20px below, slides into place. */
    transform: translateY(20px);
    transition: transform 0.25s ease;
}
.bip-modal.is-open .bip-modal-dialog { transform: translateY(0); }

.bip-modal-dialog--sm { max-width: 400px; }
.bip-modal-dialog--md { max-width: 600px; }
.bip-modal-dialog--lg { max-width: 800px; }
.bip-modal-dialog--xl { max-width: 1100px; }

.bip-modal-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* Sticky header (stays pinned while body scrolls). */
.bip-modal-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}
.bip-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

/* Round red X icon (header). Behavior comes from .bip-modal-close. */
.bip-modal-x {
    width: 32px;
    height: 32px;
    border: 0;
    background: red;
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex: 0 0 auto;
    transition: background 0.15s ease, transform 0.15s ease;
}
.bip-modal-x:hover  { background: #c00; color: #fff; transform: scale(1.05); }
.bip-modal-x:active { transform: scale(0.95); }

/* Scrollable body with a minimum height so short content doesn't look
   collapsed against the header and footer. */
.bip-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 22px;
    min-height: 200px;
}

/* Sticky footer. */
.bip-modal-footer {
    flex: 0 0 auto;
    padding: 14px 22px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 767px) {
    .bip-modal { padding: 15px 10px; }
    .bip-modal-dialog { max-height: calc(100vh - 30px); }
    .bip-modal-header,
    .bip-modal-footer { padding-left: 16px; padding-right: 16px; }
    .bip-modal-body { padding: 16px; }
}
