/* Global Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-secondary {
    color: var(--text-secondary);
}

.mb-1 {
    margin-bottom: 1rem;
}

.mb-15 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 1rem;
}

.mt-2 {
    margin-top: 2rem;
}

.ml-1 {
    margin-left: 1rem;
}

.my-1 {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.m-2-0-1 {
    margin: 2rem 0 1rem;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.align-center {
    align-items: center;
}

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

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

.justify-end {
    justify-content: flex-end;
}

.gap-05 {
    gap: 0.5rem;
}

.gap-1 {
    gap: 1rem;
}

.w-full {
    width: 100% !important;
}

.h-full {
    height: 100% !important;
}

.p-05 {
    padding: 0.5rem;
}

.p-075 {
    padding: 0.75rem;
}

.p-1 {
    padding: 1rem;
}

.p-2 {
    padding: 2rem;
}

.border-1 {
    border: 1px solid var(--bg-secondary);
}

.radius-05 {
    border-radius: 0.5rem;
}

.radius-sm {
    border-radius: var(--radius-sm);
}

.bg-white {
    background: white;
}

.bg-secondary {
    background: var(--bg-secondary);
}

.sticky-top {
    position: sticky;
    top: 100px;
}

.hidden {
    display: none !important;
}

.font-0875 {
    font-size: 0.875rem;
}

.font-1125 {
    font-size: 1.125rem;
}

.font-125 {
    font-size: 1.25rem;
}

.font-15 {
    font-size: 1.5rem;
}

.font-2 {
    font-size: 2rem;
}

.font-4 {
    font-size: 4rem;
}

.font-bold {
    font-weight: 700;
}

.primary-color {
    color: var(--primary-color);
}

/* Custom Component Styles to replace inline hacks */
.lang-select-style {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-secondary);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    font-family: inherit;
}

.modal-legacy {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.max-w-500-centered {
    max-width: 500px;
    margin: 1rem auto;
}

.input-full-style {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-family: inherit;
}

/* =================================================================
   MISSING UTILITY CLASSES (used in admin modals)
   ================================================================= */

/* ── Max-width ─────────────────────────────────────────────────── */
.max-w-md  { max-width: 448px;  width: 100%; }
.max-w-lg  { max-width: 512px;  width: 100%; }
.max-w-xl  { max-width: 576px;  width: 100%; }
.max-w-2xl { max-width: 672px;  width: 100%; }

/* ── Max-height ────────────────────────────────────────────────── */
.max-h-80vh { max-height: 80vh; }
.max-h-90vh { max-height: 90vh; }

/* ── Overflow ──────────────────────────────────────────────────── */
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Flex utilities ────────────────────────────────────────────── */
.flex          { display: flex !important; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.space-x-2 > * + * { margin-left: 0.5rem; }

/* ── Spacing (supplement existing) ────────────────────────────── */
.mb-2  { margin-bottom: 0.5rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }
.mb-8  { margin-bottom: 2rem; }
.mt-4  { margin-top: 1rem; }
.mt-6  { margin-top: 1.5rem; }
.mt-8  { margin-top: 2rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* ── Modal-internal 2-col form grid ────────────────────────────── */
/* Used for date pickers, size/occupancy fields, etc. inside modals */
.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ── RWD: collapse utilities on small screens ───────────────────── */
@media (max-width: 639px) {
    /* All max-w-* inside a modal overlay should go full-width */
    .modal-overlay .max-w-md,
    .modal-overlay .max-w-lg,
    .modal-overlay .max-w-xl,
    .modal-overlay .max-w-2xl {
        max-width: 100%;
    }

    /* max-h tightens on small screens */
    .modal-overlay .max-h-80vh { max-height: 85vh; }
    .modal-overlay .max-h-90vh { max-height: 90vh; }
}

/* ── RWD: 2-col inline grids inside modals → 1-col on mobile ───── */
/* Targets all inline style="grid-template-columns: 1fr 1fr" patterns */
@media (max-width: 479px) {
    /* Override inline grid-template-columns for 2-col form grids */
    .modal-content [style*="grid-template-columns: 1fr 1fr"],
    .modal-card    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* permission checkbox grid in user modal */
    .modal-content [style*="grid-template-columns: 1fr 1fr; gap: 0.5rem"],
    .modal-card    [style*="grid-template-columns: 1fr 1fr; gap: 0.5rem"] {
        grid-template-columns: 1fr !important;
    }

    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    /* space-x-2 → wrap & gap on mobile */
    .space-x-2 {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .space-x-2 > * + * { margin-left: 0; }
}
