/* ════════════════════════════════════════════════════════════════
   BEMARAHA — Gmail-inspired layout
   ════════════════════════════════════════════════════════════════ */

/* ── ROOT WRAPPER ─────────────────────────────────────────────── */
.bemaraha-root {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #F6F8FC;
    font-family: 'Google Sans', Roboto, sans-serif;
}

/* ── APPBAR ───────────────────────────────────────────────────── */
.bemaraha-appbar {
    display: flex;
    align-items: center;
    height: 64px;
    min-height: 64px;
    background: #FFFFFF;
    border-bottom: 1px solid #E0E0E0;
    padding: 0 8px 0 4px;
    z-index: 1100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    gap: 4px;
}

.bemaraha-logo {
    font-size: 18px;
    font-weight: 700;
    color: #202124;
    letter-spacing: -0.5px;
    margin-left: 4px;
    white-space: nowrap;
}

.bemaraha-module-chip {
    background: #D3E3FD !important;
    color: #1A73E8 !important;
    font-size: 11px !important;
    height: 22px !important;
    margin-left: 6px;
}

.bemaraha-spacer {
    flex: 1;
}

/* Search bar */
.bemaraha-search {
    display: flex;
    align-items: center;
    background: #F1F3F4;
    border-radius: 24px;
    padding: 0 16px;
    height: 44px;
    width: 40%;
    max-width: 560px;
    min-width: 160px;
    gap: 8px;
}

.bemaraha-search-icon {
    color: #5F6368;
    font-size: 20px !important;
}

.bemaraha-search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: #202124;
}

.bemaraha-avatar {
    margin-left: 8px;
    cursor: pointer;
    font-size: 14px !important;
    width: 32px !important;
    height: 32px !important;
}

/* ── BODY ROW ─────────────────────────────────────────────────── */
.bemaraha-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── LEFT RAIL (64px, always visible) ────────────────────────── */
.bemaraha-rail {
    width: 64px;
    min-width: 64px;
    flex-shrink: 0;
    background: #F6F8FC;
    border-right: 1px solid #E0E0E0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 8px;
    overflow: hidden;
}

.bemaraha-rail-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: #D3E3FD;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 200ms ease;
}

.bemaraha-rail-icon:hover {
    background: #B8D0F8;
}

/* ── LEFT NAV PANEL (240px, collapsible) ─────────────────────── */
.bemaraha-nav {
    width: 240px;
    min-width: 240px;
    flex-shrink: 0;
    background: #FFFFFF;
    border-right: 1px solid #E0E0E0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 225ms cubic-bezier(0.4, 0, 0.6, 1),
                min-width 225ms cubic-bezier(0.4, 0, 0.6, 1),
                opacity 225ms ease;
}

.bemaraha-nav--closed {
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    border-right: none;
    overflow: hidden;
}

.bemaraha-nav--open {
    width: 240px;
    min-width: 240px;
    opacity: 1;
}

.bemaraha-nav-link {
    border-radius: 0 24px 24px 0 !important;
    margin-right: 16px !important;
}

.active-nav-item {
    background-color: #D3E3FD !important;
    color: #1A73E8 !important;
    font-weight: 600 !important;
}

.active-nav-item .mud-nav-link-icon {
    color: #1A73E8 !important;
}

.mud-nav-link:hover:not(.active-nav-item) {
    background-color: #F1F3F4 !important;
}

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.bemaraha-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    min-width: 0;
}

/* ── BREADCRUMBS ─────────────────────────────────────────────── */
.bemaraha-breadcrumbs {
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid #E0E0E0;
    font-size: 13px;
}

.bemaraha-breadcrumbs .mud-link {
    color: #1A73E8 !important;
    font-weight: 500;
}

.bemaraha-breadcrumbs .mud-breadcrumb-item:last-child .mud-link,
.bemaraha-breadcrumbs .mud-breadcrumb-item:last-child span {
    color: #202124 !important;
    font-weight: 600;
    pointer-events: none;
}

/* ── RIGHT PANEL ─────────────────────────────────────────────── */
.bemaraha-right {
    width: 320px;
    min-width: 320px;
    flex-shrink: 0;
    border-left: 1px solid #E0E0E0;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
    animation: slideInRight 200ms ease;
}

.bemaraha-right-header {
    display: flex;
    align-items: center;
    padding: 12px 8px 12px 16px;
    border-bottom: 1px solid #E0E0E0;
    min-height: 52px;
}

.bemaraha-right-title {
    flex: 1;
    font-weight: 500 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bemaraha-right-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* ── MOBILE OVERLAY ──────────────────────────────────────────── */
.bemaraha-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1200;
}

/* ── CARDS ───────────────────────────────────────────────────── */
.bemaraha-card {
    background: #FFFFFF !important;
    border: 1px solid #E0E0E0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

.bemaraha-card:hover {
    box-shadow: 0 1px 6px rgba(32,33,36,.2) !important;
}

/* ── DATA GRID ───────────────────────────────────────────────── */
.mud-table-container {
    border-radius: 8px;
    border: 1px solid #E0E0E0;
}

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes slideInRight {
    from { transform: translateX(320px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(-240px); }
    to   { transform: translateX(0); }
}

/* ── SCROLLBARS ──────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 8px; height: 8px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: #DADCE0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #BDC1C6; }

/* ── MOBILE ──────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .bemaraha-search { display: none; }
    .bemaraha-rail   { display: none; }
    .bemaraha-nav--open {
        position: fixed;
        top: 64px;
        left: 0;
        height: calc(100vh - 64px);
        z-index: 1300;
        box-shadow: 4px 0 8px rgba(0,0,0,0.16);
        animation: slideInLeft 225ms cubic-bezier(0,0,.2,1);
    }
    .bemaraha-right {
        position: fixed;
        top: 64px;
        right: 0;
        height: calc(100vh - 64px);
        z-index: 1300;
        box-shadow: -4px 0 8px rgba(0,0,0,0.16);
    }
}

/* ── ERROR BOUNDARY ──────────────────────────────────────────── */
.bemaraha-error-box {
    border: 2px solid #D93025;
    border-radius: 8px;
    background: #FFF0EE;
    padding: 16px;
    margin: 16px 0;
    font-size: 13px;
}

.bemaraha-error-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #D93025;
    font-weight: 600;
}

.bemaraha-error-icon { font-size: 18px; }

.bemaraha-error-recover {
    margin-left: auto;
    padding: 4px 12px;
    border: 1px solid #D93025;
    border-radius: 4px;
    background: transparent;
    color: #D93025;
    cursor: pointer;
    font-size: 12px;
}

.bemaraha-error-recover:hover { background: #D93025; color: white; }

.bemaraha-error-message {
    color: #D93025;
    margin-bottom: 8px;
    font-weight: 500;
}

.bemaraha-error-details summary {
    cursor: pointer;
    color: #5F6368;
    font-size: 12px;
}

.bemaraha-error-details pre {
    margin-top: 8px;
    font-size: 11px;
    color: #202124;
    background: #F8F8F8;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
