/* ===================================
   MODAL COMPONENT
   ===================================
   
   Standard modal structure used across all tabs.
   
   HEADER: Clean, title only (no X close button)
   FOOTER: [Delete on left] ... [Save] [Cancel on right]
   
   SPACING CONTRACT:
   - All sections use consistent 16px padding (--space-4)
   - Header, body, footer all aligned
*/

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: var(--space-4);
}

/* Modal content container */
.modal-content {
    background: var(--bg-surface);
    border-radius: var(--border-radius-xl);  /* 12px - consistent with major containers */
    box-shadow: var(--shadow-2xl);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--container-md);
    max-height: 90vh;
}

/* Modal header - consistent 16px padding */
.modal-header {
    padding: var(--space-4);
    border-bottom: var(--border-width-1) solid var(--border-subtle);
}

.modal-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
}

/* Modal body - standard padding */
.modal-body {
    padding: var(--space-4);  /* 16px */
    flex: 1;
    overflow-y: auto;
}

/* Modal footer - tighter vertical padding */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-4);
    gap: var(--space-4);
}

.modal-footer-left {
    display: flex;
    gap: var(--space-3);
}

.modal-footer-right {
    display: flex;
    gap: var(--space-3);
    margin-left: auto;
}

/* Modal active state */
.modal-overlay.active {
    display: flex;
}

/* ===================================
   HELPER PANEL (two-column body)
   ===================================
   When Modal.build({ helperContent }) is set, the body splits into
   a main column (left) and a helper panel (right). Responsive: stacks
   on mobile. Used by: BookingFormModal, Complaints guest finder.
*/

.modal-body-columns {
    display: grid;
    grid-template-columns: var(--modal-helper-ratio, 3fr 2fr);
    gap: var(--space-4);
    min-height: 300px;
}

.modal-body-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    overflow-y: auto;
}

.modal-body-helper {
    background: var(--bg-layer-2);
    border: var(--border-width-1) solid var(--border-subtle);
    border-radius: var(--border-radius-md);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-body-columns {
        grid-template-columns: 1fr !important;
    }

    .modal-body-helper {
        min-height: 150px;
    }
    .modal-overlay {
        padding: var(--space-4);
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-4);
    }
    
    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-footer-left,
    .modal-footer-right {
        width: 100%;
        justify-content: stretch;
    }
    
    .modal-footer-right {
        margin-left: 0;
    }
    
    .modal-footer button {
        flex: 1;
    }
}
