
/* ---------- Links that launch sheets ---------- */
a.sheet-link, button.sheet-link,
a.open-sheet, button.open-sheet {
    display: inline-block;
    color: #007bff;
    background-color: transparent;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

a.sheet-link:hover, button.sheet-link:hover,
a.open-sheet:hover, button.open-sheet:hover {
    color: #9c27b0;
}

/* --- Z-INDEX and FOCUS MANAGEMENT --- */
.bottom-sheet,
.left-sheet,
.right-sheet {
    z-index: 1000; /* Base stacking level for all sheets */
}

.bottom-sheet.active-sheet,
.left-sheet.active-sheet,
.right-sheet.active-sheet {
    z-index: 1001; /* Active sheet is always on top */
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.3) !important; /* Visual cue for the active sheet */
}

/* ---------- Bottom Sheet (NEW CSS-Controlled Sizing) ---------- */
.bottom-sheet {
    --sheet-height: 80vh;       /* Default initial height */
    --sheet-min-height: 80px;  /* Default minimum height */
    height: var(--sheet-height);
    min-height: var(--sheet-min-height);
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;   
    overflow: hidden; 
    flex-direction: column; 
    background: #fff;
    border-radius: 16px 16px 0 0;
    display: none;
    transition: height 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* ---------- Left Sheet (NEW CSS-Controlled Sizing) ---------- */
.left-sheet {
    --sheet-width: 500px;      /* Default initial width */
    --sheet-min-width: 360px;  /* Default minimum width */
    width: var(--sheet-width);
    min-width: var(--sheet-min-width);

    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    background: #fff;
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    display: none;
    flex-direction: column;
    transition: width 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* ---------- Right Sheet (NEW CSS-Controlled Sizing) ---------- */
.right-sheet {
    --sheet-width: 500px;      /* Default initial width */
    --sheet-min-width: 360px;  /* Default minimum width */
    width: var(--sheet-width);
    min-width: var(--sheet-min-width);
    
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    background: #fff;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
    display: none;
    flex-direction: column;
    transition: width 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* --- HOW TO CUSTOMISE SIZES PER-PAGE --- */
/*
#bottomSheetAsk {
    --sheet-height: 600px;
    --sheet-min-height: 200px;
}
#rightSheet {
    --sheet-width: 650px;
}
*/

.bottom-sheet.active,
.left-sheet.active,
.right-sheet.active {
    display: flex;
}

.left-sheet > div.sheet-header { justify-content: left; }
.right-sheet > div.sheet-header { justify-content: right; }

/* ---------- Common Sheet Header ---------- */
.sheet-header {
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f2f2f2;
    border-bottom: 1px solid #e0e0e0;
    user-select: none;
    padding: 0 10px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.header-controls .control {
    cursor: pointer;
    font-size: 2.2rem;
    border: 1px solid #9c27b0;
    border-radius: 5px;
    padding: 0.2em 0.5em;
    background: #fff;
    color: #9c27b0;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}
.header-controls .control:hover {
    background-color: #9c27b0;
    color: #fff;
}

/* ---------- Sheet Content ---------- */
.sheet-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    position: relative;
}

.sheet-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}