/*
 * app-details.css
 * ─────────────────────────────────────────────────────────────────────────────
 * Styles for the Application / Record details page.
 * Reusable across any details page that uses .app-card, .app-toolbar,
 * .status-badge and the tab-bar component.
 * Fully dark/light mode aware via CSS variables from dark-mode.css.
 *
 * Deploy to : /include/styles/app-details.css
 * Include in: page_foot.inc  OR  the page itself
 *   <link rel="stylesheet" href="/include/styles/app-details.css">
 *
 * Dependencies:
 *   dark-mode.css  — provides --dm-* CSS variables
 *   tab-bar.css    — tab bar component styles
 * ─────────────────────────────────────────────────────────────────────────────
 */


/* ══════════════════════════════════════════════════════════════
   PAGE WRAPPER
   ══════════════════════════════════════════════════════════════ */

.app-page {
    padding: 0 0 40px;
    max-width: 1020px;
    margin: 0 auto;
}


/* ══════════════════════════════════════════════════════════════
   STICKY TOOLBAR
   ══════════════════════════════════════════════════════════════ */

.app-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid var(--dm-border, #272d3d);
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--dm-surface, #181c27);
    max-width: 1020px;
}

html.light-mode .app-toolbar {
    background: #f4f6fb;
    border-color: #dde2ee;
}

.app-toolbar .tb-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-toolbar .tb-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-wrap: wrap;
}


/* ══════════════════════════════════════════════════════════════
   SECTION CARD
   ══════════════════════════════════════════════════════════════ */

.app-card {
    border: 1px solid var(--dm-border, #272d3d);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
}

html.light-mode .app-card {
    border-color: #dde2ee;
}

/* ── Card header ── */
.app-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(79,142,247,.07);
    border-bottom: 1px solid var(--dm-border, #272d3d);
}

html.light-mode .app-card-header {
    background: rgba(37,99,235,.05);
    border-color: #dde2ee;
}

.app-card-header i {
    color: var(--dm-accent, #4f8ef7);
    font-size: .9rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

html.light-mode .app-card-header i {
    color: #2563eb;
}

.app-card-title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--dm-accent, #4f8ef7);
    margin: 0;
}

html.light-mode .app-card-title {
    color: #2563eb;
}

/* ── Card body ── */
.app-card-body {
    padding: 0;
}

    .app-card-body.padded {
        padding: 16px;
    }


/* ══════════════════════════════════════════════════════════════
   STATUS BADGES
   ══════════════════════════════════════════════════════════════ */

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
}

    /* Dark mode badge colours */
    .status-badge.s-00 {
        background: rgba(148,163,184,.15);
        color: #94a3b8;
    }

    .status-badge.s-10 {
        background: rgba(245,158,11,.15);
        color: #fbbf24;
    }

    .status-badge.s-20 {
        background: rgba(59,130,246,.15);
        color: #60a5fa;
    }

    .status-badge.s-30,
    .status-badge.s-35 {
        background: rgba(139,92,246,.15);
        color: #a78bfa;
    }

    .status-badge.s-40,
    .status-badge.s-45 {
        background: rgba(16,185,129,.15);
        color: #34d399;
    }

    .status-badge.s-50 {
        background: rgba(5,150,105,.15);
        color: #10b981;
    }

    .status-badge.s-90 {
        background: rgba(239,68,68,.15);
        color: #f87171;
    }

/* Light mode badge colours */
html.light-mode .status-badge.s-00 {
    background: #f1f5f9;
    color: #475569;
}

html.light-mode .status-badge.s-10 {
    background: #fef3c7;
    color: #92400e;
}

html.light-mode .status-badge.s-20 {
    background: #dbeafe;
    color: #1d4ed8;
}

html.light-mode .status-badge.s-30,
html.light-mode .status-badge.s-35 {
    background: #ede9fe;
    color: #5b21b6;
}

html.light-mode .status-badge.s-40,
html.light-mode .status-badge.s-45 {
    background: #d1fae5;
    color: #065f46;
}

html.light-mode .status-badge.s-90 {
    background: #fee2e2;
    color: #991b1b;
}


/* ══════════════════════════════════════════════════════════════
   AUDIT TOOLBAR STRIP
   ══════════════════════════════════════════════════════════════ */

.audit-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
    border-bottom: 1px solid var(--dm-border, #272d3d);
}

html.light-mode .audit-toolbar {
    border-color: #dde2ee;
}


/* ══════════════════════════════════════════════════════════════
   TAB CONTENT AREA
   Connected visually to the tab-bar above it
   ══════════════════════════════════════════════════════════════ */

.app-tab-content {
    min-height: 300px;
    padding: 0;
    border: 1px solid var(--dm-border, #272d3d);
    border-top: none;
    border-radius: 0 0 10px 10px;
}

html.light-mode .app-tab-content {
    border-color: #dde2ee;
}

/* Connect tab-bar top to match card radius */
.app-page .tab-bar {
    border-radius: 10px 10px 0 0 !important;
    border: 1px solid var(--dm-border, #272d3d) !important;
    border-bottom: 2px solid var(--dm-accent, #4f8ef7) !important;
}

html.light-mode .app-page .tab-bar {
    border-color: #dde2ee !important;
    border-bottom-color: #2563eb !important;
}


/* ══════════════════════════════════════════════════════════════
   PROCESSOR SUMMARY — compact view
   ══════════════════════════════════════════════════════════════ */

.proc-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 991px) {
    .proc-summary-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

@media (max-width: 575px) {
    .proc-summary-grid {
        grid-template-columns: 1fr;
    }
}

.proc-cell {
    padding: 12px 16px;
    border-bottom: 1px solid var(--dm-border, #272d3d);
    border-right: 1px solid var(--dm-border, #272d3d);
}

    .proc-cell:nth-child(4n) {
        border-right: none;
    }

    .proc-cell:nth-last-child(-n+4) {
        border-bottom: none;
    }

html.light-mode .proc-cell {
    border-color: #dde2ee;
}

.proc-label {
    font-size: .68rem;
    font-weight: 600;
    color: var(--dm-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}

.proc-value {
    font-size: .9rem;
    font-weight: 600;
    color: var(--dm-text, #e2e8f0);
}

html.light-mode .proc-value {
    color: #1e2535;
}

.proc-value.accent {
    color: var(--dm-accent, #4f8ef7);
}

html.light-mode .proc-value.accent {
    color: #2563eb;
}

/* ── Expand / collapse toggle bar ── */
.proc-expand-bar {
    display: flex;
    justify-content: center;
    padding: 6px;
    border-top: 1px solid var(--dm-border, #272d3d);
    background: rgba(79,142,247,.03);
}

html.light-mode .proc-expand-bar {
    border-color: #dde2ee;
    background: rgba(37,99,235,.02);
}

.proc-expand-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--dm-text-muted, #64748b);
    font-size: .75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 4px;
    transition: color .15s, background .15s;
}

    .proc-expand-btn:hover {
        color: var(--dm-accent, #4f8ef7);
        background: rgba(79,142,247,.08);
    }

html.light-mode .proc-expand-btn:hover {
    color: #2563eb;
    background: rgba(37,99,235,.06);
}

.proc-expand-btn i {
    font-size: .7rem;
    transition: transform .2s;
}


/* ══════════════════════════════════════════════════════════════
   INFO GRID  (optional — for custom detail layouts)
   ══════════════════════════════════════════════════════════════ */

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 991px) {
    .info-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

@media (max-width: 575px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

.info-cell {
    padding: 10px 16px;
    border-bottom: 1px solid var(--dm-border, #272d3d);
    border-right: 1px solid var(--dm-border, #272d3d);
}

    .info-cell:nth-child(4n) {
        border-right: none;
    }

    .info-cell:last-child,
    .info-cell:nth-last-child(-n+4) {
        border-bottom: none;
    }

html.light-mode .info-cell {
    border-color: #dde2ee;
}

.info-label {
    font-size: .68rem;
    font-weight: 600;
    color: var(--dm-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 3px;
}

.info-value {
    font-size: .85rem;
    color: var(--dm-text, #e2e8f0);
    font-weight: 500;
}

html.light-mode .info-value {
    color: #1e2535;
}

.info-value.accent {
    color: var(--dm-accent, #4f8ef7);
    font-weight: 600;
}

html.light-mode .info-value.accent {
    color: #2563eb;
}
