/* ============================================================
   Workspace — Internal Browser Tabs (iframe-based MDI)
   Two responsibilities:
     1. .framed  → app chrome hidden when a page is loaded inside
                   a workspace iframe (auto-detected in header.php)
     2. .ws-*    → the tab-bar + iframe stack shell itself
   Additive only — no existing selectors are overridden destructively.
   ============================================================ */

/* ---- Framed (embed) mode : hide app chrome inside iframes ---- */
html.framed .navbar,
html.framed .footer,
html.framed .admin-sidebar,
html.framed .admin-sidebar-mobile-btn,
html.framed #adminSidebarOverlay,
html.framed .prop-sidebar,
html.framed .prop-sidebar-mobile-btn,
html.framed #propSidebarOverlay {
    display: none !important;
}
html.framed body { min-height: 0 !important; background: #fff; }
html.framed .admin-layout,
html.framed .prop-layout { min-height: 0; display: block; }
html.framed .admin-main,
html.framed .prop-main { width: 100%; }
html.framed .main-content { padding: 0 !important; }

/* ---- Workspace shell ---- */
.ws-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    min-width: 0;
}

/* Tab bar */
.ws-tabbar {
    display: flex;
    align-items: stretch;
    gap: 8px;
    background: var(--sidebar-bg, #1a2035);
    border-bottom: 1px solid rgba(0, 0, 0, .2);
    padding: 6px 8px 0 8px;
    flex-shrink: 0;
}
.ws-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
.ws-tabs::-webkit-scrollbar { height: 4px; }
.ws-tabs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 2px; }

.ws-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .08);
    color: #cbd3e1;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 8px 10px 8px 12px;
    font-size: .85rem;
    line-height: 1.1;
    white-space: nowrap;
    cursor: pointer;
    max-width: 220px;
    user-select: none;
    transition: background .15s ease, color .15s ease;
}
.ws-tab:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.ws-tab.active { background: #fff; color: #1a2035; font-weight: 600; }
.ws-tab > i { font-size: .9rem; flex-shrink: 0; }
.ws-tab .ws-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}
.ws-tab .ws-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: inherit;
    opacity: .55;
    font-size: 1.05rem;
    line-height: 1;
    border-radius: 50%;
    flex-shrink: 0;
}
.ws-tab .ws-tab-close:hover { opacity: 1; background: rgba(0, 0, 0, .12); }

/* Tab-bar action buttons (home / reload / pop-out) */
.ws-tab-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-bottom: 6px;
    flex-shrink: 0;
}
.ws-tab-actions button {
    border: none;
    background: rgba(255, 255, 255, .1);
    color: #cbd3e1;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    transition: background .15s ease, color .15s ease;
}
.ws-tab-actions button:hover { background: rgba(255, 255, 255, .22); color: #fff; }

/* Frame stack */
.ws-frames {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #f1f3f7;
}
.ws-frames iframe {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}
.ws-empty {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    color: #8a94a6;
    text-align: center;
    padding: 24px;
}
.ws-empty i { font-size: 2.4rem; opacity: .5; }

/* RTL: tab close sits on the natural trailing edge automatically via flex */
[dir="rtl"] .ws-tab { padding: 8px 12px 8px 10px; }
