/**
 * File: assets/css/dmsilm-shell.css
 * DMSI DDLS Admin 3-Column Shell Layout
 *
 * Column 1 (~160px fixed)  — Sections nav
 * Column 2 (~180px fixed)  — Pages nav
 * Column 3 (fluid)         — Content
 *
 * @package    DMSILM
 * @since      2.0.0
 */

/* ==========================================================================
   Design Tokens
   ========================================================================== */

:root {
    /* Shell dimensions */
    --dmsilm-shell-col1-width: 160px;
    --dmsilm-shell-col2-width: 180px;
    --dmsilm-shell-header-height: 0px; /* WP header already accounted for */

    /* Column colors */
    --dmsilm-shell-col1-bg: #1e1e2d;
    --dmsilm-shell-col1-text: #aaaabb;
    --dmsilm-shell-col1-text-active: #ffffff;
    --dmsilm-shell-col1-active-bg: rgba(255, 255, 255, 0.12);
    --dmsilm-shell-col1-hover-bg: rgba(255, 255, 255, 0.07);
    --dmsilm-shell-col1-separator: rgba(255, 255, 255, 0.1);

    --dmsilm-shell-col2-bg: #f8f9fa;
    --dmsilm-shell-col2-border: #e0e0e0;
    --dmsilm-shell-col2-text: #3c3c3c;
    --dmsilm-shell-col2-text-active: #667eea;
    --dmsilm-shell-col2-active-bg: #eef0fd;
    --dmsilm-shell-col2-hover-bg: #f0f0f1;

    --dmsilm-shell-col3-bg: #ffffff;

    /* Badge */
    --dmsilm-shell-badge-bg: #667eea;
    --dmsilm-shell-badge-text: #ffffff;

    /* Misc */
    --dmsilm-shell-radius: 4px;
    --dmsilm-shell-transition: 0.15s ease;
}

/* ==========================================================================
   Outer wrapper — resets WP default padding and sets up flex layout
   ========================================================================== */

.dmsilm-shell-wrap {
    display: flex;
    flex-direction: row;
    min-height: calc(100vh - 32px); /* 32px = WP admin bar */
    margin: -10px 0 -10px -2px; /* pull flush to WP wrap edges */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: #1d2327;
    overflow: hidden;
}

/* ==========================================================================
   Column 1 — Sections (fixed ~160px, dark sidebar)
   ========================================================================== */

.dmsilm-shell-col1 {
    flex: 0 0 var(--dmsilm-shell-col1-width);
    width: var(--dmsilm-shell-col1-width);
    min-width: var(--dmsilm-shell-col1-width);
    background: var(--dmsilm-shell-col1-bg);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.dmsilm-shell-col1-inner {
    display: flex;
    flex-direction: column;
    padding: 24px 0 16px 0;
    flex: 1;
}

/* Logo / branding area */
.dmsilm-shell-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px 12px;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--dmsilm-shell-col1-separator);
    margin-bottom: 6px;
}

.dmsilm-shell-logo .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #667eea;
}

/* Section items */
.dmsilm-shell-section-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    color: var(--dmsilm-shell-col1-text);
    text-decoration: none;
    border-radius: 0;
    transition: background var(--dmsilm-shell-transition), color var(--dmsilm-shell-transition);
    white-space: nowrap;
    overflow: hidden;
}

.dmsilm-shell-section-item:hover,
.dmsilm-shell-section-item:focus {
    background: var(--dmsilm-shell-col1-hover-bg);
    color: var(--dmsilm-shell-col1-text-active);
    text-decoration: none;
    outline: none;
}

.dmsilm-shell-section-item.is-active {
    background: var(--dmsilm-shell-col1-active-bg);
    color: var(--dmsilm-shell-col1-text-active);
}

.dmsilm-shell-section-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.dmsilm-shell-section-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12.5px;
}

/* Group separator in col1 */
.dmsilm-shell-col1-separator {
    height: 1px;
    background: var(--dmsilm-shell-col1-separator);
    margin: 6px 14px;
}

/* ==========================================================================
   Column 2 — Pages (fixed ~180px, light sidebar)
   ========================================================================== */

.dmsilm-shell-col2 {
    flex: 0 0 var(--dmsilm-shell-col2-width);
    width: var(--dmsilm-shell-col2-width);
    min-width: var(--dmsilm-shell-col2-width);
    background: var(--dmsilm-shell-col2-bg);
    border-right: 1px solid var(--dmsilm-shell-col2-border);
    overflow-y: auto;
    overflow-x: hidden;
}

.dmsilm-shell-col2-inner {
    padding: 24px 0 16px 0;
}

/* Accordion — details/summary for responsive collapse */
.dmsilm-shell-col2-accordion {
    border: none;
}

.dmsilm-shell-col2-summary {
    display: none; /* Hidden on desktop; shown on mobile */
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 13px;
    color: var(--dmsilm-shell-col2-text);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--dmsilm-shell-col2-border);
    list-style: none;
}

.dmsilm-shell-col2-summary::-webkit-details-marker {
    display: none;
}

.dmsilm-shell-col2-chevron {
    font-size: 14px;
    width: 14px;
    height: 14px;
    transition: transform var(--dmsilm-shell-transition);
}

.dmsilm-shell-col2-accordion[open] .dmsilm-shell-col2-chevron {
    transform: rotate(180deg);
}

/* Column 2 section title (desktop) */
.dmsilm-shell-col2-inner::before {
    content: attr(data-section-label);
    display: none; /* not used via CSS attr on inner; label shown differently */
}

.dmsilm-shell-col2-items {
    padding: 8px 0;
}

/* Page items */
.dmsilm-shell-page-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    color: var(--dmsilm-shell-col2-text);
    text-decoration: none;
    font-size: 13px;
    transition: background var(--dmsilm-shell-transition), color var(--dmsilm-shell-transition);
    white-space: nowrap;
    overflow: hidden;
}

.dmsilm-shell-page-item:hover,
.dmsilm-shell-page-item:focus {
    background: var(--dmsilm-shell-col2-hover-bg);
    color: var(--dmsilm-shell-col2-text);
    text-decoration: none;
    outline: none;
}

.dmsilm-shell-page-item.is-active {
    background: var(--dmsilm-shell-col2-active-bg);
    color: var(--dmsilm-shell-col2-text-active);
    font-weight: 600;
    border-right: 3px solid var(--dmsilm-shell-col2-text-active);
}

/* Separator between core and extension pages in col2 */
.dmsilm-shell-col2-separator {
    height: 1px;
    background: var(--dmsilm-shell-col2-border);
    margin: 6px 14px;
}

/* ==========================================================================
   Column 3 — Content (fluid)
   ========================================================================== */

.dmsilm-shell-col3 {
    flex: 1 1 auto;
    background: var(--dmsilm-shell-col3-bg);
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0; /* prevent flex blowout */
}

.dmsilm-shell-col3-inner {
    padding: 20px 24px;
}

/* Ensure WP page title and wrap classes work inside col3 */
.dmsilm-shell-col3 .wrap {
    margin: 0;
}

.dmsilm-shell-col3 h1.wp-heading-inline {
    margin-bottom: 12px;
}

/* ==========================================================================
   Badge
   ========================================================================== */

.dmsilm-shell-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--dmsilm-shell-badge-bg);
    color: var(--dmsilm-shell-badge-text);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* ==========================================================================
   Not-found state
   ========================================================================== */

.dmsilm-shell-not-found {
    padding: 40px;
    text-align: center;
    color: #646970;
}

.dmsilm-shell-not-found h2 {
    color: #1d2327;
    margin-bottom: 8px;
}

.dmsilm-shell-error {
    padding: 12px 16px;
    background: #fce8e8;
    border-left: 4px solid #d63638;
    color: #d63638;
    margin: 16px 0;
}

/* ==========================================================================
   Responsive — Narrow screens (< 782px)
   Column 2 collapses into accordion inside Column 1
   ========================================================================== */

@media (max-width: 1200px) {
    :root {
        --dmsilm-shell-col1-width: 140px;
        --dmsilm-shell-col2-width: 160px;
    }
}

@media (max-width: 960px) {
    :root {
        --dmsilm-shell-col1-width: 44px;
    }

    .dmsilm-shell-section-label,
    .dmsilm-shell-logo-text {
        display: none;
    }

    .dmsilm-shell-logo {
        justify-content: center;
        padding: 14px 6px 12px;
    }

    .dmsilm-shell-section-item {
        justify-content: center;
        padding: 10px;
    }
}

@media (max-width: 782px) {
    /* Stack columns vertically on mobile */
    .dmsilm-shell-wrap {
        flex-direction: column;
        margin: -10px -10px -10px -2px;
    }

    /* Col1 becomes horizontal scrolling top bar */
    .dmsilm-shell-col1 {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .dmsilm-shell-col1-inner {
        flex-direction: row;
        padding: 0;
        align-items: center;
        flex-wrap: nowrap;
    }

    .dmsilm-shell-logo {
        border-bottom: none;
        border-right: 1px solid var(--dmsilm-shell-col1-separator);
        margin-bottom: 0;
        padding: 10px 12px;
    }

    .dmsilm-shell-col1-separator {
        width: 1px;
        height: 24px;
        margin: 0 4px;
    }

    .dmsilm-shell-section-item {
        padding: 10px 12px;
        flex-direction: column;
        gap: 2px;
        font-size: 10px;
    }

    .dmsilm-shell-section-label {
        display: block;
        font-size: 10px;
    }

    .dmsilm-shell-logo-text {
        display: inline;
    }

    /* Col2 becomes a collapsible accordion panel */
    .dmsilm-shell-col2 {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--dmsilm-shell-col2-border);
    }

    .dmsilm-shell-col2-summary {
        display: flex;
    }

    .dmsilm-shell-col2-items {
        padding: 4px 0;
    }

    .dmsilm-shell-page-item.is-active {
        border-right: none;
        border-bottom: 3px solid var(--dmsilm-shell-col2-text-active);
    }

    /* Col3 takes remaining space */
    .dmsilm-shell-col3 {
        flex: 1 1 auto;
    }

    .dmsilm-shell-col3-inner {
        padding: 16px;
    }
}
