@import '../shared/document.css';

/* ============================================================
   ENGINEERING TITLE BLOCK & NIMIÖ (Unified Suite Standard)
   ============================================================ */
.engineering-title-block,
.title-block-card {
    background: #ffffff;
    border: 2px solid #0f172a;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    box-sizing: border-box;
    margin-bottom: 0;
}

.engineering-title-block .title-block-main,
.title-block-card .title-block-main {
    padding: 10px 14px 8px 14px;
    border-bottom: 1.5px solid #0f172a;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.engineering-title-block.is-minimized,
.title-block-card.is-minimized {
    margin-bottom: 12px;
}

.engineering-title-block.is-minimized .title-block-main,
.title-block-card.is-minimized .title-block-main {
    border-bottom: none !important;
}

.engineering-title-block.is-minimized .title-block-grid,
.title-block-card.is-minimized .title-block-grid {
    display: none !important;
}

.engineering-title-block .title-block-grid,
.title-block-card .title-block-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-sizing: border-box;
}

.engineering-title-block .title-block-cell,
.title-block-card .title-block-cell {
    padding: 6px 10px;
    border-right: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    background: #ffffff;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.engineering-title-block .title-block-cell:nth-child(4n),
.title-block-card .title-block-cell:nth-child(4n) {
    border-right: none;
}

.engineering-title-block .title-block-cell:nth-last-child(-n+4),
.title-block-card .title-block-cell:nth-last-child(-n+4) {
    border-bottom: none;
}

.title-block-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    font-weight: 700;
}

.title-block-input {
    font-family: var(--font-mono);
    font-size: 0.80rem;
    font-weight: 600;
    color: var(--color-heading);
    border: 1px solid transparent;
    background: transparent;
    padding: 1px 2px;
    border-radius: 2px;
    width: 100%;
}

.title-block-input:focus {
    border-color: var(--color-accent);
    background: #ffffff;
    outline: none;
}

.title-block-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-heading);
    letter-spacing: -0.01em;
}

.title-block-subtitle {
    font-size: 0.74rem;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.std-ref--na {
    background: #1e3a8a;
    border: 1px solid #60a5fa;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.70rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.btn-minimize-front {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px 7px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ============================================================
   FRONT PAGE PROPERTIES & SUMMARY CARD
   ============================================================ */
.wall-joint-properties-summary-card {
    margin-top: 12px;
    margin-bottom: 20px;
    background: #f8fafc;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    padding: 12px 16px;
}

.summary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid #0284c7;
    padding-bottom: 6px;
    margin-bottom: 10px;
}

.summary-card-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.summary-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 18px;
    font-size: 0.78rem;
}

.summary-item-label {
    color: var(--color-text-secondary);
    display: block;
    font-size: 0.69rem;
    text-transform: uppercase;
}

.summary-item-val {
    color: #0f172a;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.82rem;
}

/* Scorecard status pills */
.scorecard-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.pill-pass {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.pill-fail {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ============================================================
   WORKSPACE LAYOUT & COMMAND DOCK
   ============================================================ */
.workspace-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 100vh;
    box-sizing: border-box;
}

.app-sidebar-dock {
    width: 440px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: var(--sp-md);
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
    flex-shrink: 0;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    z-index: 10;
    box-sizing: border-box;
    margin-bottom: 16px;

    /* Move scrollbar to left */
    direction: rtl;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.app-sidebar-dock > * {
    direction: ltr;
}

.app-sidebar-dock::-webkit-scrollbar {
    width: 5px;
}
.app-sidebar-dock::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

/* --- Right Side Main Workspace --- */
.app-main-workspace {
    flex: 1;
    min-width: 0;
    max-width: 1020px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Attached Hub Nav Bar */
.app-main-workspace .top-hub-nav {
    width: 100%;
    background: #e9e6df;
    border: 1px solid var(--color-border);
    border-top: none;
    border-bottom: 1px solid var(--color-border);
    padding: 8px 16px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Nav Actions & Member Drawer Styles */
.btn-toggle-drawer {
    background: var(--color-accent-bg, #e8f0fa);
    border: 1px solid var(--color-accent-border, #bcd3ed);
    color: var(--color-accent, #0055a3);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-toggle-drawer:hover {
    background: var(--color-accent, #0055a3);
    color: #ffffff;
}

/* Page container (paper sheet) */
.page-container,
.app-main-workspace .page-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: var(--color-paper, #fafaf8);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 24px 32px;
    box-shadow: 0 4px 16px var(--color-paper-shadow, rgba(0, 0, 0, 0.08));
    box-sizing: border-box;
}

/* Dock sections */
.dock-section {
    background: #fafaf8;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    padding: var(--sp-sm) var(--sp-md);
    transition: all 0.15s ease;
}

.dock-section.highlight {
    background: #f0f7ff;
    border-color: #b9d8ff;
}

.dock-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-heading);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--sp-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dock-section-title.collapsible {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

.dock-section-title.collapsible:hover {
    color: var(--color-accent);
}

.dock-section .collapse-icon {
    font-size: 0.70rem;
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
}

.dock-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.dock-section.collapsed .dock-section-body {
    display: none;
}

.dock-meta-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 6px;
}

.dock-meta-field label {
    font-size: 0.74rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    justify-content: space-between;
}

.dock-meta-field label .unit {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-weight: 400;
}

.dock-meta-field input[type="number"],
.dock-meta-field input[type="text"],
.dock-meta-field select {
    width: 100%;
    height: 32px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    color: var(--color-text);
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
}

.dock-meta-field input:focus,
.dock-meta-field select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(0, 85, 163, 0.15);
}

.dock-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Preset Selector Dropdown */
.dock-preset-select {
    width: 100%;
    padding: 7px 10px;
    font-size: 0.80rem;
    font-weight: 600;
    font-family: inherit;
    border: 1.5px solid var(--color-accent);
    border-radius: 4px;
    background: #f0f7ff;
    color: var(--color-accent);
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.15s ease;
}

.dock-preset-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.dock-preset-select optgroup {
    font-weight: 700;
    color: var(--color-heading);
    background: #ffffff;
    font-size: 0.78rem;
}

.dock-preset-select option {
    font-weight: 500;
    color: var(--color-text-main);
    background: #ffffff;
    padding: 4px 6px;
    font-size: 0.78rem;
}

/* Preset buttons (legacy / fallback) */
.preset-buttons-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.btn-dock-preset {
    padding: 6px 4px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-heading);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.btn-dock-preset:hover {
    background: #f1f5f9;
    border-color: var(--color-accent);
}

/* Dock Live HUD Scorecard */
.dock-hud-card {
    background: #ffffff;
    border: 2px solid var(--color-heading);
    border-radius: 8px;
    padding: 12px;
    margin-top: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border-light);
}

.hud-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--color-heading);
    letter-spacing: 0.02em;
}

.hud-verdict-pill {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.hud-verdict-pill.pass {
    background: #dcfce7;
    color: #166534;
}

.hud-verdict-pill.fail {
    background: #fee2e2;
    color: #991b1b;
}

.hud-meter-row {
    margin-bottom: 8px;
}

.hud-meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    margin-bottom: 2px;
}

.hud-meter-name {
    color: var(--color-text-secondary);
}

.hud-meter-val {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--color-heading);
}

.hud-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.hud-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.hud-progress-fill.safe {
    background: var(--color-success);
}

.hud-progress-fill.warn {
    background: var(--color-warning);
}

.hud-progress-fill.danger {
    background: var(--color-error);
}

/* ============================================================
   VISUALIZER SECTION & DRAWINGS GRID
   ============================================================ */
.section-visualizer-card {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 22px;
    box-sizing: border-box;
}

.visualizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.visualizer-title {
    font-family: var(--font-serif);
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--color-heading);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.view-toggle-group {
    display: flex;
    gap: 4px;
}

.btn-view-toggle {
    padding: 4px 10px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-view-toggle:hover {
    background: #f1f5f9;
}

.btn-view-toggle.active {
    background: var(--color-heading);
    color: #ffffff;
    border-color: var(--color-heading);
}

.drawings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

.drawing-box {
    background: #fcfbf9;
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.drawing-box.full-width {
    grid-column: 1 / -1;
}

.drawing-box-title {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.svg-viewport {
    width: 100%;
    height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.svg-viewport svg {
    max-width: 100%;
    max-height: 100%;
}

/* ============================================================
   WHOLE WALL VS SINGLE CONNECTOR BREAKDOWN CARD
   ============================================================ */
.connector-breakdown-card {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.breakdown-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.breakdown-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.80rem;
    padding: 4px 0;
    border-bottom: 1px dashed rgba(34, 197, 94, 0.35);
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-val {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--color-heading);
}

/* ============================================================
   CALCULATION STEPS & KATEX FORMULAS
   ============================================================ */
.calc-step {
    margin-bottom: var(--sp-md);
    border: 1px solid var(--color-border-light);
    background: #ffffff;
    border-radius: 4px;
}

.step-intro {
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

/* ============================================================
   TABLES: CONNECTOR SCHEDULE & 25-POINT MATRIX
   ============================================================ */
.section-table-card {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 22px;
}

.section-table-title {
    font-family: var(--font-serif);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 6px;
}

.suite-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.77rem;
    margin-top: 10px;
    border: 1px solid var(--color-border);
}

.suite-data-table th {
    background: #f5f4f0;
    color: var(--color-heading);
    font-weight: 700;
    text-align: left;
    padding: 7px 9px;
    border: 1px solid var(--color-border);
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
}

.suite-data-table td {
    padding: 6px 9px;
    border: 1px solid var(--color-border-light);
    vertical-align: middle;
}

.suite-data-table td.col-design,
.suite-data-table td.col-cap {
    font-size: 0.80rem;
    white-space: nowrap;
}

.suite-data-table td.col-clause code {
    background: #f1f5f9;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 0.72rem;
}

.suite-data-table tr:hover td {
    background: #fbfbfa;
}

.matrix-row-governing {
    background: #eff6ff !important;
    border-left: 3px solid var(--color-accent) !important;
}

.gov-indicator {
    display: inline-block;
    background: var(--color-accent);
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 2px;
    margin-left: 6px;
}

.prov-badge {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 2px;
    font-size: 0.64rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.prov-normative { background: #dbeafe; color: #1e40af; }
.prov-product { background: #fef3c7; color: #92400e; }
.prov-input { background: #f3f4f6; color: #374151; }
.prov-na { background: #fce7f3; color: #9d174d; }

.matrix-status-pill {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.matrix-status-pill.pass { background: #dcfce7; color: #15803d; }
.matrix-status-pill.fail { background: #fee2e2; color: #b91c1c; }
.matrix-status-pill.na   { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

/* ============================================================
   MEMBER DRAWER & PRINT MODAL
   ============================================================ */
.member-drawer {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.member-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 16px;
    background: var(--color-heading);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-card {
    background: #ffffff;
    border-radius: 8px;
    width: 580px;
    max-width: 90vw;
    padding: 22px 26px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* ============================================================
   PRINTING OMISSION RULES
   ============================================================ */
@media print {
    body {
        background: #ffffff !important;
        padding: 0 !important;
    }

    .app-sidebar-dock,
    .hub-header-bar,
    .top-hub-nav,
    .view-toggle-group,
    .member-drawer,
    .modal-overlay,
    .print-hide {
        display: none !important;
    }

    .workspace-wrapper {
        display: block !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    .page-container {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .calc-step,
    .section-visualizer-card,
    .section-table-card {
        page-break-inside: avoid;
    }
}
