/*
assets/d365-style.css
Version: 1.0.4
Description: Styles for PA D365 Product Configurator
Change Log:
[2025-12-17] Version 1.0.4
- STYLE: Updated .pa-d365-container box-shadow to a subtler, dual-layer shadow.
[2025-12-17] Version 1.0.3 - Settings Hardening (Fallbacks).
[2025-12-17] Version 1.0.2 - Namespace scroll hints.
[2025-12-17] Version 1.0.1 - Fixed layout & toggle selectors.
*/

:root {
    /* --- DIMENSIONS --- */
    --pa-d365-container-width: 1400px;
    --pa-d365-col-width-ref: 200px;
    --pa-d365-col-width-std: 220px;
    
    /* --- FONTS --- */
    --pa-d365-font-family: 'Albert Sans', Helvetica, Arial, sans-serif;
    --pa-d365-fs-base: 0.95rem;
    --pa-d365-fs-header-title: 1rem; 
    --pa-d365-fs-header-sub: 0.9rem;
    --pa-d365-fs-price: 1.5rem;
    --pa-d365-fs-price-sub: 0.9rem;
    --pa-d365-fs-cat: 0.85rem;
    
    /* --- SPACING --- */
    --pa-d365-header-padding: 20px 13px; 
    --pa-d365-cell-padding-y: 12px; 
    --pa-d365-header-title-height: 45px;
    --pa-d365-header-sub-height: 40px;
    --pa-d365-header-price-height: 50px;
    
    /* --- COLORS --- */
    --pa-color-text: #000; 
    --pa-color-border: #eee; 
    --pa-color-border-sticky: #ddd;
    --pa-bg-white: #fff;
    --pa-bg-zebra: #f9f9f9;
    --pa-bg-cat: #f2f2f2; 
    --pa-bg-cat-admin: #FFC300;

    --pa-color-midnight: #003366;
    --pa-color-congress: #004080;
    --pa-color-azure: #0073E6;
    --pa-color-mine: #333333;
    --pa-color-red: #c72929;
    --pa-color-orange: #F05A25;
    --pa-color-yellow: #FFBD4A;
    --pa-color-concrete: #f2f2f2;
    --pa-color-silver: #A8A8A8;

    /* --- MATRIX ICONS --- */
    --pa-check-full: #333;
    --pa-check-some: #333;
}

/* ================= FRONTEND STYLES ================= */

.pa-d365-container {
    font-family: var(--pa-d365-font-family);
    max-width: var(--pa-d365-container-width, 1400px);
    margin: 0px auto;
    color: var(--pa-color-text);
    box-sizing: border-box;
    /* UPDATED SHADOW */
    box-shadow: 0 0 0.125rem rgba(0, 0, 0, 0.10), 0 0.25rem 0.5rem rgba(0, 0, 0, 0.12);
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.pa-d365-outer-wrapper { position: relative; }

.pa-d365-scroll-wrapper {
    overflow-x: auto;
    overflow-y: scroll;
    width: 100%;
    min-height: 70vh;     
    max-height: 70vh;
    border: none;
    position: relative;
    scroll-behavior: smooth;
    overscroll-behavior: contain; 
}

/* --- FULL HEIGHT OVERRIDE FOR COLLAPSIBLE MODE --- */
.pa-d365-container.pa-is-collapsible .pa-d365-scroll-wrapper {
    min-height: auto !important;
    max-height: none !important;
    overflow-y: hidden !important;
    height: auto !important;
    overscroll-behavior: auto !important;
}

.pa-d365-container.pa-is-collapsible .pa-d365-hint-bottom { display: none !important; }

/* --- VISIBILITY LOGIC --- */
.pa-feature-row.pa-filtered-out { display: none !important; }
.pa-feature-row.pa-collapsed-hidden { display: none !important; }

.pa-d365-container.pa-is-filtering .pa-feature-row { display: table-row !important; }
.pa-d365-container.pa-is-filtering .pa-feature-row.pa-filtered-out { display: none !important; }

/* ... (SCROLL HINTS) ... */
.pa-d365-scroll-hint {
    position: absolute;
    background: rgba(44, 62, 80, 0.9);
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: auto;
    cursor: pointer;
    opacity: 0; 
    transition: opacity 0.3s ease, transform 0.2s ease, background 0.2s;
    z-index: 200;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 5px;
}
.pa-d365-scroll-hint:hover { background: rgba(44, 62, 80, 1); transform: scale(1.05); }
.pa-d365-hint-right { top: 50%; right: 20px; transform: translateY(-50%); }
.pa-d365-hint-right:hover { transform: translateY(-50%) scale(1.05); }
.pa-d365-hint-bottom { bottom: 20px; left: 50%; transform: translateX(-50%); }
.pa-d365-hint-bottom:hover { transform: translateX(-50%) scale(1.05); }
.pa-d365-scroll-hint.visible { opacity: 1; }

/* TABLE RESET */
table.pa-d365-table {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
    background: var(--pa-bg-white);
    min-width: 1000px;
    border: none !important;
    /* FIX: Force fixed layout to prevent jumping width */
    table-layout: fixed; 
}

table.pa-d365-table th,
table.pa-d365-table td {
    border: none;
}

/* STICKY HEADER ROW */
.pa-d365-header-row th {
    padding: var(--pa-d365-header-padding, 20px 13px);
    text-align: center;
    color: #fff;
    vertical-align: top;
    position: sticky;
    top: 0;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.2); 
    border-bottom: 4px solid #fff; 
}

.pa-d365-header-row th:first-child { 
    z-index: 102; 
    background: var(--pa-bg-white); 
    position: sticky;
    left: 0;
    border-right: 1px solid var(--pa-color-border-sticky);
    border-bottom: 4px solid #fff;
}

.pa-d365-corner-header {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 102 !important;
    vertical-align: middle !important;
}

/* Fullscreen Button */
.pa-fullscreen-btn {
    position: absolute; top: 5px; left: 5px;
    background: none; border: none; cursor: pointer; opacity: 0.3; transition: all 0.2s ease;
    padding: 5px; line-height: 0; color: #333;
}
.pa-fullscreen-btn:hover { opacity: 1; transform: scale(1.1); background: rgba(0,0,0,0.05); border-radius: 4px; }
.pa-fullscreen-btn:focus { outline: none; opacity: 1; border-radius: 4px; }

/* Compare Dropdown */
.pa-compare-wrapper {
    position: absolute; bottom: 8px; left: 10px; right: 10px;
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
}
.pa-compare-label { font-size: 0.7rem; color: #666; text-transform: uppercase; font-weight: 700; }
.pa-compare-select { width: 100%; font-size: 0.8rem; padding: 2px 5px; border: 1px solid #ccc; border-radius: 4px; background: #fff; cursor: pointer; color: #333; }

/* FULLSCREEN */
.pa-d365-container.pa-is-fullscreen {
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important; max-width: none !important; max-height: none !important;
    z-index: 999999; background: var(--pa-bg-white); margin: 0 !important; padding: 110px 20px 20px 20px;
    border-radius: 0; border: none; display: flex; flex-direction: column; align-items: center; justify-content: center; 
}
.pa-d365-container.pa-is-fullscreen .pa-d365-outer-wrapper { width: auto; max-width: 100%; height: auto; max-height: 100%; display: flex; flex-direction: column; }
.pa-d365-container.pa-is-fullscreen .pa-d365-scroll-wrapper { max-height: none !important; height: auto; flex: 1; min-height: 0; }

/* COLUMN SEPARATORS */
.pa-d365-header-row th:nth-child(2), .pa-feature-row td:nth-child(2) { border-left: none; background-clip: border-box; }
.pa-sep-v, .pa-sep-plus { border-right: 30px solid #fff !important; background-clip: padding-box; position: relative; }
.pa-d365-header-row th.pa-sep-v::after, .pa-d365-header-row th.pa-sep-plus::after {
    position: absolute; right: -26px; top: 50%; transform: translateY(-50%);
    width: 22px; height: 22px; background: #f2f2f2; color: #666; border-radius: 50%;
    font-size: 12px; font-weight: bold; display: flex; align-items: center; justify-content: center;
    z-index: 10; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.pa-d365-header-row th.pa-sep-v::after { content: "v"; }
.pa-d365-header-row th.pa-sep-plus::after { content: "+"; font-size: 16px; line-height: 1; }

.pa-header-content { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }

.pa-d365-tier-name { 
    display: flex; align-items: center; justify-content: center; 
    font-size: var(--pa-d365-fs-header-title, 1rem);
    font-weight: 600; text-transform: none; letter-spacing: 1px; opacity: 0.9; line-height: 1.2; 
    height: var(--pa-d365-header-title-height, 45px); margin-bottom: 5px; overflow: hidden;
}
.pa-d365-tier-sub {
    display: flex; align-items: center; justify-content: center; 
    font-size: var(--pa-d365-fs-sub, 0.9rem); font-weight: 600; line-height: 1.2; 
    height: var(--pa-d365-header-sub-height, 40px); margin-bottom: 5px; opacity: 0.9;
}
.pa-d365-price { 
    display: flex; align-items: center; justify-content: center; 
    font-size: var(--pa-d365-fs-price, 1.5rem); font-weight: 700; line-height: 1; 
    height: var(--pa-d365-header-price-height, 50px);
}
.pa-d365-price span { font-size: var(--pa-d365-fs-price-sub, 0.9rem); font-weight: 400; opacity: 0.8; margin-left: 3px; }

/* Filter Checkbox */
.pa-col-filter {
    display: flex; align-items: center; justify-content: center; margin-top: 8px;
    font-size: 0.6rem; font-weight: 400; opacity: 0.9; cursor: pointer;
    background: #666; padding: 4px 8px; border-radius: 12px; transition: background 0.2s; color: #fff !important; 
}
.pa-col-filter input { margin-right: 5px; cursor: pointer; }
.pa-col-filter:hover { background: #444; }
.pa-col-filter:has(input:checked) { background: #27ae60; }
.pa-col-filter input:focus { outline: none !important; box-shadow: none !important; }

/* COLUMN STYLES */
.pa-col-ms { background-color: #6c757d; width: var(--pa-d365-col-width-ref, 200px); border-right: 1px solid rgba(255,255,255,0.2); }
.pa-col-std { background-color: #2c3e50; width: var(--pa-d365-col-width-std, 220px); border-right: 1px solid rgba(255,255,255,0.2); position: relative; }
.pa-col-prem { background: #004080; width: var(--pa-d365-col-width-std, 220px); }

.pa-col-midnight { background-color: var(--pa-color-midnight); }
.pa-col-congress { background-color: var(--pa-color-congress); }
.pa-col-azure     { background-color: var(--pa-color-azure); }
.pa-col-mine      { background-color: var(--pa-color-mine); }
.pa-col-red       { background-color: var(--pa-color-red); }
.pa-col-orange    { background-color: var(--pa-color-orange); }
.pa-col-yellow    { background-color: var(--pa-color-yellow); color: #333; } 

/* PILLS */
.pa-cell-pill.pa-col-ms { background-color: rgba(108, 117, 125, 0.75); }
.pa-cell-pill.pa-col-std { background-color: rgba(0, 51, 102, 0.75); }
.pa-cell-pill.pa-col-prem { background-color: rgba(0, 64, 128, 0.75); }
.pa-cell-pill.pa-col-midnight { background-color: rgba(0, 51, 102, 0.75); }
.pa-cell-pill.pa-col-congress { background-color: rgba(0, 64, 128, 0.75); }
.pa-cell-pill.pa-col-azure    { background-color: rgba(0, 115, 230, 0.75); }
.pa-cell-pill.pa-col-mine     { background-color: rgba(51, 51, 51, 0.75); }
.pa-cell-pill.pa-col-red      { background-color: rgba(199, 41, 41, 0.75); }
.pa-cell-pill.pa-col-orange   { background-color: rgba(240, 90, 37, 0.75); }
.pa-cell-pill.pa-col-yellow   { background-color: rgba(255, 189, 74, 0.75); }

/* GRID CELLS */
.pa-d365-table .pa-feature-row td { 
    padding: var(--pa-d365-cell-padding-y, 12px) 15px; 
    text-align: center; 
    font-size: var(--pa-d365-fs-base, 0.95rem); 
    vertical-align: middle; 
    background-color: var(--pa-bg-white);
    border-bottom: 1px solid var(--pa-color-border) !important; 
    border-right: 1px solid var(--pa-color-border) !important; 
}
.pa-d365-table .pa-feature-row td.pa-has-pill { padding: 0; }

.pa-cell-pill {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100%; min-height: 40px; border-radius: 0; 
    padding: var(--pa-d365-cell-padding-y, 12px) 5px; box-sizing: border-box;
}

.pa-d365-table .pa-feature-row td:first-child { 
    text-align: left; border-right: 1px solid var(--pa-color-border-sticky) !important; 
    position: sticky; left: 0; background: #fff; z-index: 50; padding-left: 28px;
}
.pa-d365-table .pa-feature-row:last-child td { border-bottom: none !important; }
.pa-d365-table .pa-feature-row td:last-child { border-right: none !important; }

.pa-category-row td { 
    background-color: var(--pa-bg-cat); color: #000; font-weight: 700; text-align: left; 
    padding: 10px 13px; text-transform: uppercase; 
    font-size: var(--pa-d365-fs-cat, 0.85rem); /* Added Fallback */
    letter-spacing: 0.5px; 
    position: sticky; left: 0; z-index: 50; border-right: 1px solid var(--pa-color-border-sticky); 
}

/* COLLAPSIBLE */
/* FIX: Updated Selector */
.pa-d365-cat-toggle { cursor: pointer; transition: background-color 0.15s ease; }
.pa-d365-cat-toggle:hover td { background-color: #e8e8e8; }
.pa-pt-cat-content { display: flex; align-items: center; gap: 10px; }
.pa-pt-cat-icon { display: flex; align-items: center; transition: transform 0.3s ease; opacity: 0.6; }
.pa-d365-cat-toggle.pa-cat-active .pa-pt-cat-icon { transform: rotate(180deg); }

.pa-feature-name { 
    text-align: left !important; font-weight: 600; color: #333 !important; 
    width: var(--pa-d365-col-width-std, 220px); min-width: var(--pa-d365-col-width-std, 220px); 
}

/* ICONS */
.pa-check-icon { font-weight: 400; font-size: 1.4rem; line-height: 1; }
.pa-check-full { color: var(--pa-check-full); font-size: 2.3rem; vertical-align: -4px; line-height: 0.5; }
.pa-check-some { color: var(--pa-check-some); }
.pa-cross { color: #bdc3c7; font-size: 1.2em; }
.pa-filled-cell { color: #fff !important; }
.pa-highlight { color: #2c3e50; font-weight: 700; }
.pa-veteran { color: #004080; font-weight: 700; }

/* TOOLTIP */
.pa-tooltip { position: relative; cursor: help; border-bottom: 1px dotted #999; text-decoration: none; }
.pa-global-tooltip {
    position: fixed; background-color: #2c3e50; color: #fff; padding: 10px 12px;
    font-size: 0.85rem; font-weight: 400; text-align: center; border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); z-index: 999999; pointer-events: none;
    max-width: 220px; line-height: 1.4; display: none; 
}
.pa-global-tooltip::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid; border-color: #2c3e50 transparent transparent transparent;
}

@media (max-width: 768px) {
    .pa-d365-table { display: block; }
    .pa-d365-header-row th { padding: 15px 5px; }
    .pa-d365-price { font-size: 1.8rem; }
    .pa-feature-name { width: 120px; font-size: 0.85rem; min-width: 120px; }
}

/* ADMIN OVERRIDES */
.pa-admin-wrapper { max-width: 99% !important; margin: 0 auto !important; padding: 10px; }
.pa-table-responsive { overflow: auto; box-shadow: 0 1px 3px rgba(0,0,0,0.1); max-width: 100%; max-height: 80vh; border: 1px solid #ccc; position: relative; }
#pa-matrix-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 800px; }
#pa-matrix-table th, #pa-matrix-table td { border-right: 1px solid #999 !important; border-bottom: 1px solid #999 !important; vertical-align: top; background-clip: padding-box; }
.pa-col-header-cell { min-width: 140px; width: 140px; padding: 10px 8px !important; color: #fff; position: sticky !important; top: 0; z-index: 100; }
.pa-header-inputs { display: flex; flex-direction: column; gap: 4px; }
.pa-header-inputs input { background: rgba(255,255,255,0.95); border: 1px solid #777; padding: 0 5px; width: 100%; border-radius: 2px; font-size: 11px; height: 26px; line-height: 26px; color: #333; box-sizing: border-box; }
.pa-header-inputs .pa-h-title { font-weight: bold; text-transform: uppercase; font-size: 11px; height: 28px; }
.pa-col-actions { display: flex; justify-content: flex-end; gap: 5px; margin-top: 5px; }
.pa-col-settings-btn, .pa-col-delete-btn { cursor: pointer; color: rgba(255,255,255,0.8); font-size: 16px; }
.pa-col-delete-btn { color: #ffcccc; }
.pa-col-settings-btn:hover, .pa-col-delete-btn:hover { color: #fff; }
.pa-col-move-handle:hover span { color: #fff !important; }
.pa-corner-cell { width: 200px; min-width: 200px; background: #f1f1f1; border-right: 1px solid #999 !important; border-bottom: 1px solid #999 !important; position: sticky !important; top: 0; left: 0; z-index: 110; }
.pa-row-label-cell { width: 200px; min-width: 200px; background: #f9f9f9; padding: 5px 10px !important; vertical-align: middle !important; position: sticky !important; left: 0; z-index: 90; }
.pa-row-label-input { width: 100%; font-weight: 600; color: #444; border: 1px solid #ccc; box-shadow: none; background: transparent; font-size: 12px; }
.pa-row-label-input:focus { background: #fff; border-color: #2271b1; }
.pa-drag-handle { cursor: move; color: #bbb; }
.pa-row-settings-btn { cursor: pointer; color: #bbb; }
.pa-row-settings-btn:hover { color: #2271b1; }
.pa-value-cell { padding: 0 !important; height: 35px; vertical-align: middle !important; cursor: pointer; transition: background 0.1s; text-align: center; background: #fff; }
.pa-value-cell:hover { background: #f0f6fc; }
.pa-cell-preview { display: flex; align-items: center; justify-content: center; height: 100%; padding: 5px; gap: 5px; }
.pa-icon { display: flex; align-items: center; font-weight: bold; font-size: 14px; }
.pa-txt-trunc { max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; color: #666; }
.is-category td { background-color: var(--pa-d365-bg-cat-admin) !important; color: #333 !important; }
.is-category .pa-category-placeholder { background: transparent !important; color: #000; padding: 10px !important; text-transform: uppercase; text-align: left; font-size: 12px; font-weight: 700; }
.is-category .pa-row-label-cell { background: transparent !important; }
.pa-cat-actions { display: none; margin-right: 5px; }
.is-category .pa-cat-actions { display: inline-flex; flex-direction: column; gap: 2px; }
.is-category .pa-drag-handle { display: none !important; }
.pa-move-cat-up, .pa-move-cat-down { cursor: pointer; color: #444; font-size: 16px; width: 18px; height: 18px; text-align: center; }
.pa-move-cat-up:hover, .pa-move-cat-down:hover { color: #000; background: rgba(255,255,255,0.3); border-radius: 3px; }
.ui-dialog { z-index: 100005 !important; box-shadow: 0 5px 15px rgba(0,0,0,0.3); font-size: 13px; }
.pa-form-group { margin-bottom: 15px; }
.pa-form-group label { display: block; font-weight: 600; margin-bottom: 5px; }
.pa-type-selector label { display: block; padding: 5px; margin-bottom: 5px; cursor: pointer; }
.pa-type-selector input { margin-right: 8px; }