/* ═══════════════════════════════════════════════════════════════
   XAF Light — CSS matching XAF Blazor application shell
   Mirrors: DevExpress.ExpressApp.Blazor/Styles/layout/template.css
            DevExpress.ExpressApp.Blazor/Styles/layout/navigation.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Flex helpers ──────────────────────────────────────────────── */
.xaf-flex-auto { flex: auto; }
.xaf-ellipsis { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

/* ── App root ──────────────────────────────────────────────────── */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ── Header ────────────────────────────────────────────────────── */
.header {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    z-index: 1030;
    min-height: 3.1rem;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075);
    background-color: #fff;
}

.header-left-side {
    align-items: center;
    display: flex;
    min-width: 270px;
    width: 270px;
    padding-left: .5rem;
}

.header-logo { font-size: 1rem; }

.header-right-side {
    align-items: center;
    display: flex;
    overflow: hidden;
    padding-right: 1rem;
    padding-left: 1rem;
    width: 100%;
}

.xaf-header-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 0.5rem;
}

.btn-header {
    min-width: 2.25rem;
    min-height: 2.25rem;
    border: none;
    background-color: transparent;
    background-image: none;
    color: inherit;
    box-shadow: none;
}

.btn-hamburger { padding: 0; cursor: pointer; }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
    display: none;
    flex-direction: column;
    min-width: 270px;
    width: 270px;
    border-right: 1px solid #e0e0e0;
    background: #fafafa;
    overflow-y: auto;
}

@media (min-width: 576px) {
    .sidebar { display: flex; }
}

.sidebar-sm-shadow { display: none; }

/* Collapse toggle — desktop: hide sidebar; mobile: show sidebar */
.collapse-toggle .sidebar { display: none !important; }
.collapse-toggle .header-left-side {
    max-width: 270px;
    width: auto;
    min-width: auto;
}

@media (max-width: 575.98px) {
    .header-left-side {
        width: auto;
        min-width: auto;
    }
    .header-left-side .header-logo { display: none; }

    .collapse-toggle .sidebar {
        display: flex !important;
        position: fixed;
        z-index: 20;
        top: 3.1rem;
        bottom: 0;
        left: 0;
    }
    .collapse-toggle .sidebar-sm-shadow {
        display: block;
        position: fixed;
        left: 270px;
        top: 3.1rem;
        width: 100%;
        height: 100%;
        z-index: 15;
        background-color: black;
        opacity: 0.3;
    }
}

/* ── Navigation tree view ──────────────────────────────────────── */
.xaf-tree-view {
    padding: 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.xaf-navmenu .oi {
    max-width: 16px;
    max-height: 16px;
    width: 16px;
    height: 16px;
    font-size: 14px;
    margin-right: 5px;
}

.about-info {
    font-size: 0.7rem;
    line-height: 0.9rem;
    margin: 0.75rem 1rem 1.5rem;
    opacity: .5;
}

/* ── Main content ──────────────────────────────────────────────── */
.app .main { flex-direction: column; }

.main-content.xaf-flex-auto {
    overflow: auto;
    padding: 1rem;
}

@media (max-width: 575.98px) {
    .main-content.xaf-flex-auto {
        padding: 0.5rem;
    }
}

/* ── XAF-style action toolbar ──────────────────────────────────── */
.xaf-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.25rem 0;
    margin-bottom: 0.25rem;
}

/* ── Detail view content ───────────────────────────────────────── */
.detail-view-content { padding: 0; }

/* ── Blazor error UI ───────────────────────────────────────────── */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── XAF Layout Editor — Design Mode ── */
/* Ported from DevExpress.ExpressApp.Blazor layout-editor.css */

.xaf-design-mode {
    background: rgba(0,0,0,0.04);
    border-radius: 4px;
    padding: 4px;
}
.xaf-design-mode .dxbl-fl-item,
.xaf-design-mode .dxbl-fl-group,
.xaf-design-mode .dxbl-fl-gt {
    position: relative;
}
.xaf-design-mode .dxbl-fl-item,
.xaf-design-mode .dxbl-group-header {
    cursor: move;
}
.xaf-design-mode .dxbl-group {
    box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.16);
}
/* Hover highlight on items */
.xaf-design-mode .dxbl-fl-item:hover::after {
    content: " ";
    position: absolute;
    top: -2px; bottom: -2px; left: 2px; right: 2px;
    background-color: rgba(13,110,253,0.08);
    border: 1px solid rgba(13,110,253,0.6);
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
}
/* Dragging state */
.xaf-dragging-element {
    opacity: 0.4 !important;
}
/* Floating drag label */
.xaf-drag-label {
    display: none;
    position: fixed;
    padding: 4px 10px;
    border: 1px solid rgba(13,110,253,0.6);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
}
.xaf-drag-label-visible {
    display: block !important;
}
/* Drop zone indicators (blue lines) */
.xaf-dropzone { position: relative; }
.xaf-dropzone-top::before {
    content: " "; position: absolute;
    top: -2px; left: 0; right: 0; height: 3px;
    background: #0d6efd; border-radius: 2px;
    z-index: 5;
}
.xaf-dropzone-bottom::before {
    content: " "; position: absolute;
    bottom: -2px; left: 0; right: 0; height: 3px;
    background: #0d6efd; border-radius: 2px;
    z-index: 5;
}
.xaf-dropzone-left::before {
    content: " "; position: absolute;
    top: 0; bottom: 0; left: -2px; width: 3px;
    background: #0d6efd; border-radius: 2px;
    z-index: 5;
}
.xaf-dropzone-right::before {
    content: " "; position: absolute;
    top: 0; bottom: 0; right: -2px; width: 3px;
    background: #0d6efd; border-radius: 2px;
    z-index: 5;
}
.xaf-dropzone-inside::before {
    content: " "; position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    background-color: rgba(13,110,253,0.06);
    border: 2px solid rgba(13,110,253,0.5);
    border-radius: 4px;
    z-index: 5;
    pointer-events: none;
}
/* Resize splitters */
.xaf-design-mode .resize-splitter {
    position: absolute;
    left: -1px; top: 0;
    width: 0; height: 100%;
    border: dashed 1px rgba(0,0,0,0.15);
}
.xaf-design-mode .resize-splitter:hover {
    border: solid 1px #0d6efd;
}
.xaf-design-mode .resize-splitter-zone {
    position: absolute;
    left: -6px; top: 0;
    width: 12px; height: 100%;
    cursor: col-resize;
    z-index: 25;
}
.xaf-resizing {
    cursor: col-resize !important;
    user-select: none;
}

/* ── Choice action dropdown (compact) ─────────────────────────── */
.xaf-choice-dropdown {
    padding: 0.25rem 0;
}

.xaf-choice-item {
    display: block;
    width: 100%;
    padding: 0.3rem 0.75rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.8125rem;
    cursor: pointer;
    color: #212529;
    white-space: nowrap;
}

.xaf-choice-item:hover {
    background-color: #f0f0f0;
}

.xaf-choice-item.active {
    background-color: #e7f1ff;
    font-weight: 600;
    color: #0d6efd;
}

/* ── Detail view card wrapper ─────────────────────────────────── */
.xaf-detail-card { margin-bottom: 1rem; }
.xaf-detail-card .card-header { font-size: 0.9rem; background: #f8f9fa; }

/* ── Required field indicator ──────────────────────────────────── */
.xaf-required .dxbl-fl-cpt { color: inherit; }

/* ── Toolbar search box ───────────────────────────────────────── */
.toolbar-search { width: 220px; }

@media (max-width: 767.98px) {
    .toolbar-search { width: 140px; }
}

/* ── Split View (Master-Detail side-by-side) ─────────────────── */
.xaf-split-container {
    display: flex;
    gap: 1rem;
    height: calc(100vh - 10rem);
    min-height: 400px;
}

.xaf-split-list {
    flex: 0 0 45%;
    min-width: 300px;
    overflow: auto;
    border-right: 2px solid #dee2e6;
    padding-right: 1rem;
}

.xaf-split-detail {
    flex: 1;
    overflow: auto;
}

@media (max-width: 991.98px) {
    .xaf-split-container {
        flex-direction: column;
        height: auto;
    }
    .xaf-split-list {
        flex: none;
        border-right: none;
        border-bottom: 2px solid #dee2e6;
        padding-right: 0;
        padding-bottom: 1rem;
        max-height: 50vh;
    }
}

/* ── Collection separator ─────────────────────────────────────── */
.collection-separator h5 {
    font-size: 0.95rem;
    color: #495057;
}

/* ── Theme Switcher ───────────────────────────────────────────── */
.xaf-theme-picker { position: relative; }

.xaf-theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1050;
    min-width: 160px;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.15);
}

.xaf-theme-option {
    display: block;
    width: 100%;
    padding: 0.35rem 1rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.875rem;
    cursor: pointer;
    color: #212529;
}

.xaf-theme-option:hover {
    background-color: #f0f0f0;
}

.xaf-theme-option.active {
    background-color: #e7f1ff;
    font-weight: 600;
    color: #0d6efd;
}

/* ── MDI Tab Bar ─────────────────────────────────────────────── */
.xaf-tab-bar {
    overflow-x: auto;
    gap: 0;
    scrollbar-width: thin;
}

.xaf-tab {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.72rem;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    color: #6c757d;
    user-select: none;
    max-width: 160px;
    margin: 0 1px;
    line-height: 1.4;
    transition: background 0.1s;
}

.xaf-tab:hover {
    background: #e2e4e7;
    color: #212529;
}

.xaf-tab.active {
    background: #fff;
    color: #212529;
    border-color: #ccc #ccc #fff;
    font-weight: 500;
    position: relative;
    z-index: 1;
    margin-bottom: -1px;
}

.xaf-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.xaf-tab-close {
    margin-left: 3px;
    border: none;
    background: none;
    font-size: 0.8rem;
    line-height: 1;
    color: #adb5bd;
    cursor: pointer;
    padding: 0 1px;
    opacity: 0;
    transition: opacity 0.15s;
}

.xaf-tab:hover .xaf-tab-close,
.xaf-tab.active .xaf-tab-close {
    opacity: 1;
}

.xaf-tab-close:hover {
    color: #dc3545;
}

/* ── Tab context menu ─────────────────────────────────────────── */
.xaf-tab-context-menu {
    position: fixed;
    z-index: 1060;
    min-width: 140px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.15);
    padding: 0.25rem 0;
}

/* ── Ribbon-style toolbar tabs ───────────────────────────────── */
.xaf-toolbar-tabs {
    margin-bottom: 0.25rem;
}

.xaf-toolbar-tabs .dxbl-tabs {
    min-height: auto;
}

/* ── Loading skeleton / shimmer ───────────────────────────────── */
.xaf-skeleton {
    padding: 0 4px;
}

.xaf-skeleton-bar {
    background: #e0e0e0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.xaf-skeleton-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: xaf-shimmer 1.5s infinite;
}

@keyframes xaf-shimmer {
    0%   { left: -100%; }
    100% { left: 100%; }
}

/* Customization badge */
.xaf-customizing-badge {
    position: sticky;
    bottom: 0;
    background: #fff3cd;
    border-top: 1px solid #ffc107;
    padding: 6px 12px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    z-index: 10;
}
