/* ==========================================================================
   TEXT MAP: pacstyle.css
   --------------------------------------------------------------------------
   Section 1: Root Variables & Theme Matrix
   Section 2: Global Resets & Core Layout (3-Column)
   Section 3: Left Column (Weight Analytics)
   Section 4: Center Canvas (Viewport, Images & Flags)
   Section 5: Right Column (Sidebar Controls & Typography)
   Section 6: UI Components (Buttons, Inputs, Sliders)
   Section 7: Standard Modals & Form Grids
   Section 8: Inventory & Dynamic Lists
   Section 9: PacTrack Specific Workspaces (Overlays & Fullscreen)
   Section 10: Search Engine Overlays & Animations
   ========================================================================== */

/* ==========================================
// SECTION 1: ROOT VARIABLES & THEME MATRIX
// ========================================== */
:root {
    --bg-color: #2c251e; --panel-bg: #3d352b; --accent-green: #556b2f; --active-green: #6b8e23;
    --active-yellow: #f1c40f; --text-main: #f5f2eb; --text-muted: #d2c9b1; --display-bg: #000000;
    --border-color: #4a3f31; --weight-bg: #1f1a14; --weight-border: #6b8e23;
}

/* --- PACTRACK 8x2 THEME MATRIX --- */
/* 1. DESERT */
body.theme-desert { --bg-color: #3b2f25; --panel-bg: #4a3b2f; --accent-green: #8b5a2b; --active-green: #cd853f; --text-main: #fdf5e6; --text-muted: #e6c280; --border-color: #5c4a3d; --weight-bg: #2b221a; --weight-border: #cd853f; }
body.theme-desert-light { --bg-color: #fdf5e6; --panel-bg: #e8d5c4; --accent-green: #dcb388; --active-green: #cd853f; --text-main: #3b2f25; --text-muted: #6b5544; --border-color: #c4a78d; --weight-bg: #fdf5e6; --weight-border: #cd853f; }

/* 2. FOREST */
body.theme-forest { --bg-color: #2c251e; --panel-bg: #3d352b; --accent-green: #556b2f; --active-green: #6b8e23; --active-yellow: #f1c40f; --text-main: #f5f2eb; --text-muted: #d2c9b1; --display-bg: #000000; --border-color: #4a3f31; --weight-bg: #1f1a14; --weight-border: #6b8e23; }
body.theme-forest-light { --bg-color: #233026; --panel-bg: #2e3e32; --accent-green: #4f6e56; --active-green: #689e75; --text-main: #f5f2eb; --text-muted: #a3b8aa; --border-color: #384a3c; --weight-bg: #1a241c; --weight-border: #689e75; }

/* 3. URBAN */
body.theme-urban { --bg-color: #2c3e50; --panel-bg: #34495e; --accent-green: #5d6d7e; --active-green: #7fb3d5; --text-main: #ecf0f1; --text-muted: #bdc3c7; --border-color: #465c71; --weight-bg: #1a252f; --weight-border: #7fb3d5; }
body.theme-urban-light { --bg-color: #ecf0f1; --panel-bg: #ffffff; --accent-green: #aeb6bf; --active-green: #7fb3d5; --text-main: #2c3e50; --text-muted: #5d6d7e; --border-color: #d5dbdb; --weight-bg: #e5e8e8; --weight-border: #7fb3d5; }

/* 4. MARINE */
body.theme-marine { --bg-color: #0f172a; --panel-bg: #1e293b; --accent-green: #0284c7; --active-green: #0ea5e9; --text-main: #f8fafc; --text-muted: #94a3b8; --border-color: #334155; --weight-bg: #0b1120; --weight-border: #0ea5e9; }
body.theme-marine-light { --bg-color: #f0f9ff; --panel-bg: #dbeafe; --accent-green: #7dd3fc; --active-green: #0ea5e9; --text-main: #0f172a; --text-muted: #334155; --border-color: #93c5fd; --weight-bg: #f0f9ff; --weight-border: #0ea5e9; }

/* 5. TACTICAL */
body.theme-tactical { --bg-color: #0d0d0d; --panel-bg: #1a1a1a; --accent-green: #333333; --active-green: #4d4d4d; --text-main: #e6e6e6; --text-muted: #999999; --border-color: #262626; --weight-bg: #000000; --weight-border: #4d4d4d; }
body.theme-tactical-light { --bg-color: #121418; --panel-bg: #1e2229; --accent-green: #374151; --active-green: #3b82f6; --text-main: #f5f2eb; --text-muted: #9ca3af; --border-color: #2d3748; --weight-bg: #0f1115; --weight-border: #3b82f6; }

/* 6. RED LIGHT COMPATIBLE */
body.theme-redlight { --bg-color: #0d0000; --panel-bg: #1a0000; --accent-green: #4d0000; --active-green: #800000; --text-main: #ff9999; --text-muted: #cc4444; --border-color: #330000; --weight-bg: #000000; --weight-border: #800000; }
body.theme-redlight-light { --bg-color: #2a0000; --panel-bg: #3d0000; --accent-green: #800000; --active-green: #b30000; --text-main: #ffcccc; --text-muted: #ff6666; --border-color: #5c0000; --weight-bg: #1a0000; --weight-border: #b30000; }

/* 7. CHOCOLATE */
body.theme-chocolate { --bg-color: #2e1c15; --panel-bg: #3d261c; --accent-green: #5c392a; --active-green: #7a4c38; --text-main: #e8dcd8; --text-muted: #b89c91; --border-color: #4f3124; --weight-bg: #1f120e; --weight-border: #7a4c38; }
body.theme-chocolate-light { --bg-color: #e8dcd8; --panel-bg: #d1c3be; --accent-green: #b89c91; --active-green: #967466; --text-main: #2e1c15; --text-muted: #5c392a; --border-color: #b5a49d; --weight-bg: #e8dcd8; --weight-border: #967466; }

/* 8. COLOR BLIND SAFE (Universal High Contrast) */
body.theme-cb { --bg-color: #002244; --panel-bg: #003366; --accent-green: #ffc20a; --active-green: #e6b800; --text-main: #ffffff; --text-muted: #99c2ff; --border-color: #004080; --weight-bg: #001122; --weight-border: #ffc20a; }
body.theme-cb-light { --bg-color: #f0f0f0; --panel-bg: #ffffff; --accent-green: #d55e00; --active-green: #b34f00; --text-main: #000000; --text-muted: #555555; --border-color: #dcdcdc; --weight-bg: #e0e0e0; --weight-border: #d55e00; }

/* ==========================================
// SECTION 2: GLOBAL RESETS & CORE LAYOUT
// ========================================== */
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
body, html { width: 100%; height: 100%; overflow: hidden; background-color: var(--bg-color); color: var(--text-main); font-family: 'Segoe UI', sans-serif; transition: background-color 0.3s ease, color 0.3s ease; }

/* 3-Panel Layout Construction */
#app-container { display: flex; flex-direction: row; width: 100vw; height: 100vh; padding: 10px 0 10px 10px; gap: 15px; position: relative; }

/* ==========================================
// SECTION 3: LEFT COLUMN (WEIGHT ANALYTICS)
// ========================================== */
#left-info-column { width: 300px; height: 100%; background-color: var(--panel-bg); border: 2px solid var(--border-color); border-radius: 6px; display: flex; flex-direction: column; padding: 15px; overflow-y: auto; }
#topbar-weights { display: flex; flex-direction: column; gap: 12px; width: 100%; }

.weight-block { background-color: var(--weight-bg); border: 1px solid var(--weight-border); border-radius: 4px; padding: 10px; font-size: 0.95rem; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); }
.weight-block-title { font-weight: bold; color: var(--text-main); } 
.weight-block-value { font-size: 1rem; color: var(--text-main); font-weight: bold; }

.total-weight-block { border: 2px solid var(--active-yellow) !important; background-color: #1f1a14; padding: 14px; }
.total-weight-block .weight-block-title { color: var(--active-yellow); font-size: 1.1rem; } 
.total-weight-block .weight-block-value { font-size: 1.2rem; }

/* ==========================================
// SECTION 4: CENTER CANVAS (VIEWPORT & FLAGS)
// ========================================== */
#display-canvas-area {
    flex: 1;
    height: 100%;
    min-height: 0;
    background-color: var(--display-bg);
    border: 2px solid var(--active-yellow);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#viewport-image-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: pan-y;
}

#main-view-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
}

#bedroll-overlay {
    position: absolute;
    max-width: 25%;
    height: auto;
    display: none;
    pointer-events: auto;
    z-index: 20;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.7);
    cursor: move;
    transform-origin: top right;
}

#flag-interaction-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

.map-flag {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: #ff4757;
    border: 2px solid #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    z-index: 6;
    touch-action: manipulation;
}

.map-flag::after {
    content: attr(data-label);
    position: absolute;
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 3px;
    white-space: nowrap;
}

#pocket-bottom-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    display: none;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    width: 90%;
}

#pocket-bottom-controls .ui-btn {
    width: auto;
    justify-content: center;
    gap: 8px;
}



/* ==========================================
// SECTION 5: RIGHT COLUMN (SIDEBAR CONTROLS)
// ========================================== */
#sidebar-controls { width: 340px; height: 100%; background-color: var(--panel-bg); border: 2px solid var(--border-color); border-radius: 6px; display: flex; flex-direction: column; padding: 15px; overflow-y: auto; gap: 20px; }

.brand-header { text-align: center; border-bottom: 2px solid rgba(255, 255, 255, 0.2); padding-bottom: 12px; }
.brand-main { font-size: 2.2rem; font-weight: 800; letter-spacing: 1px; color: var(--text-main); display: block; }
.brand-sub { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); display: block; margin-top: -2px; }
.brand-author { font-size: 1.2rem; font-style: italic; color: var(--text-muted); margin-top: 2px; display: block; }

.control-group { display: flex; flex-direction: column; gap: 8px; }
.group-title { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); border-bottom: 1px solid var(--active-yellow); padding-bottom: 4px; margin-bottom: 2px; font-weight: bold; }

/* ==========================================
// SECTION 6: UI COMPONENTS (BUTTONS & INPUTS)
// ========================================== */
.ui-btn { background-color: var(--accent-green); color: var(--text-main); border: none; padding: 10px 14px; border-radius: 4px; font-size: 0.9rem; font-weight: 600; cursor: pointer; width: 100%; text-align: left; transition: background 0.2s, transform 0.1s; display: flex; justify-content: space-between; align-items: center; }
.ui-btn:hover { background-color: var(--active-green); filter: brightness(1.1); } 
.ui-btn:active { transform: scale(0.98); }

.active-yellow { background-color: var(--active-yellow) !important; color: #111 !important; box-shadow: 0 0 8px rgba(241,196,15,0.6); }
.active-green-btn { background-color: #2ed573 !important; color: #111 !important; box-shadow: 0 0 8px rgba(46, 213, 115, 0.6); }
.status-text-large { font-size: 1rem; background: rgba(0,0,0,0.3); padding: 3px 8px; border-radius: 6px; font-weight: bold; }

.form-item { display: flex; flex-direction: column; gap: 5px; } 
.form-item label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.form-input, .ui-select { background-color: var(--bg-color); color: var(--text-main); border: 1px solid var(--border-color); padding: 8px 10px; border-radius: 4px; font-size: 0.9rem; outline: none; width: 100%; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } 
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* NEW UI COMPONENT: Search Mode Cards */
.search-card {
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.2s ease;
    font-size: 0.9rem;
    line-height: 1.4;
}
.search-card:hover {
    border-color: var(--active-green);
}
.search-card.active-card {
    border-color: var(--active-yellow);
    box-shadow: 0 0 8px rgba(241,196,15,0.4);
}

/* ==========================================
// SECTION 7: STANDARD MODALS & FORM GRIDS
// ========================================== */
.floating-window { position: fixed; top: 10%; left: 25%; width: 550px; max-height: 80vh; background-color: var(--panel-bg); border: 2px solid var(--border-color); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); z-index: 100; display: none; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.window-header { background-color: var(--bg-color); padding: 12px 16px; cursor: move; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); font-weight: bold; font-size: 1rem; }
.window-body { padding: 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.window-footer { padding: 12px 16px; background-color: rgba(44,37,30,0.5); border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }
.window-close-x { cursor: pointer; font-size: 1.2rem; color: var(--text-muted); } 
.window-close-x:hover { color: #ff4757; }

.photo-upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-slot { background: var(--bg-color); border: 1px dashed var(--border-color); border-radius: 4px; padding: 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.75rem; }
.thumb-preview { width: 60px; height: 60px; background: #111; border-radius: 4px; object-fit: cover; display: none; }
.file-input-hidden { display: none; }
.upload-trigger-btn { background: var(--panel-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 4px 8px; font-size: 0.7rem; border-radius: 3px; cursor: pointer; font-weight: bold; }
.upload-trigger-btn:hover { filter: brightness(1.2); }




/* ==========================================
// ACTION DROPDOWN MENU (Clipboard System)
// ========================================== */
.action-dropdown { position: relative; display: inline-block; }
.action-dropdown-btn { 
    background: var(--active-green); color: #111; border: none; border-radius: 4px; cursor: pointer; font-weight: bold;
    display: flex; align-items: center; justify-content: center; 
    padding: 8px 14px; /* UPGRADE: Larger touch target for thumbs */
    font-size: 0.85rem;
}
.action-dropdown-content { 
    display: none; position: absolute; right: 0; top: 100%; background-color: var(--panel-bg); 
    min-width: 150px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.8); z-index: 10000; 
    border: 1px solid var(--border-color); border-radius: 4px; overflow: hidden; margin-top: 5px;
}
.action-dropdown-content.show { display: block; } /* NEW: Click toggle class */

.action-dropdown-content button { 
    color: var(--text-main); 
    padding: 12px 16px; /* UPGRADE: Taller buttons for thumbs */
    text-decoration: none; display: block; 
    background: none; border: none; width: 100%; text-align: left; cursor: pointer; font-size: 0.85rem; 
    border-bottom: 1px solid var(--border-color); font-family: inherit;
}
.action-dropdown-content button:hover, .action-dropdown-content button:active { background-color: var(--bg-color); color: var(--active-yellow); }
.action-dropdown-content button:last-child { border-bottom: none; }

/* ==========================================
// SECTION 8: INVENTORY & DYNAMIC LISTS
// ========================================== */
.inventory-scroll-container { flex: 1; overflow-y: auto; border: 1px solid var(--border-color); background: var(--bg-color); padding: 8px; border-radius: 4px; display: flex; flex-direction: column; gap: 8px; }
.inventory-item-row { display: flex; align-items: center; gap: 12px; background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 4px; padding: 6px; cursor: pointer; }
.large-thumb { width: 70px; height: 70px; object-fit: cover; background: #000; border-radius: 4px; cursor: pointer; border: 1px solid var(--border-color); }

.bedroll-item-row { display: flex; align-items: center; gap: 8px; background: var(--bg-color); border: 1px solid var(--border-color); border-radius: 4px; padding: 6px; }
.bedroll-item-thumb { width: 50px; height: 50px; object-fit: cover; background: #000; border-radius: 4px; cursor: pointer; border: 1px solid var(--border-color); }
.bedroll-item-fields { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.track-row { display: flex; gap: 15px; font-size: 0.8rem; margin-top: 4px; }

/* 3-Panel Landscape Layout for Item Modals */
.modal-3-panel { display: flex; flex-direction: row; gap: 15px; height: 350px; }
.modal-left-col { flex: 0 0 240px; display: flex; flex-direction: column; gap: 10px; }
.modal-center-col { flex: 1; display: flex; justify-content: center; align-items: center; background: #000; border-radius: 4px; overflow: hidden; position: relative; border: 2px solid var(--border-color); }
.modal-right-col { flex: 0 0 130px; display: flex; flex-direction: column; gap: 10px; justify-content: flex-end; }

/* ==========================================
// SECTION 9: PACTRACK SPECIFIC WORKSPACES
// ========================================== */
/* Workspace Overlay Modal (Main Editing) */
.pactrack-workspace-overlay {
    position: absolute; top: 10px; bottom: 10px; left: 325px; /* 300px Left Column + 10px Padding + 15px Gap */
    right: 10px; background-color: var(--bg-color); border: 2px solid var(--active-yellow); border-radius: 6px;
    z-index: 300; display: none; flex-direction: row; padding: 15px; gap: 20px; box-shadow: -5px 0 25px rgba(0,0,0,0.8);
}
.pactrack-workspace-left { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.pactrack-workspace-right { flex: 0 0 310px; display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--border-color); padding-left: 20px; }

/* Full-Screen 3-Column Workspace (Item Specs) */
.pactrack-fullscreen-workspace {
    position: absolute; top: 10px; bottom: 10px; left: 10px; right: 10px;
    background-color: var(--bg-color); border: 2px solid var(--active-yellow); border-radius: 6px;
    z-index: 350; display: none; flex-direction: row; padding: 15px; gap: 15px; box-shadow: -5px 0 35px rgba(0,0,0,0.95);
}
.pt-fs-left { flex: 0 0 270px; display: flex; flex-direction: column; gap: 10px; }
.pt-fs-center { flex: 1; display: flex; flex-direction: column; background: var(--display-bg); border: 1px solid var(--active-yellow); border-radius: 4px; overflow: hidden; padding: 10px; position: relative; }
.pt-fs-right { flex: 0 0 310px; display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--border-color); padding-left: 15px; }

/* Sidebar Workspace (Settings) */
.pactrack-sidebar-workspace {
    position: absolute; top: 10px; bottom: 10px; right: 10px; width: 340px;
    background-color: var(--bg-color); border: 2px solid var(--active-yellow); border-radius: 6px;
    z-index: 300; display: none; flex-direction: column; padding: 15px; box-shadow: -5px 0 25px rgba(0,0,0,0.8);
}

/* ==========================================
// SECTION 10: SEARCH ENGINE & ANIMATIONS
// ========================================== */
.sidebar-search-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #000000; z-index: 100; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 15px; padding: 20px; border-radius: 4px;
}

/* Original Search Pulse (Used only for Map Flags) */
.search-match-pulse { animation: searchPulse 1.5s infinite; background-color: #2ed573 !important; z-index: 20 !important; }
@keyframes searchPulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7); transform: translate(-50%, -50%) scale(1); }
    70% { box-shadow: 0 0 0 15px rgba(46, 213, 115, 0); transform: translate(-50%, -50%) scale(1.3); }
    100% { box-shadow: 0 0 0 0 rgba(46, 213, 115, 0); transform: translate(-50%, -50%) scale(1); }
}

/* UPGRADE: Special Centered Pulse for the Main Backpack Image */
img#main-view-image.search-match-pulse {
    animation: packPulse 1.5s infinite !important;
    background-color: transparent !important;
}
@keyframes packPulse {
    0% { filter: drop-shadow(0 0 2px rgba(46, 213, 115, 0.5)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 15px rgba(46, 213, 115, 1)); transform: scale(1.03); }
    100% { filter: drop-shadow(0 0 2px rgba(46, 213, 115, 0.5)); transform: scale(1); }
}

/* UPGRADE: Fix for Bedroll Search Bounce (Zero Translation, Respects Custom Scale) */
#bedroll-overlay.search-match-pulse { animation: bedrollGlowPulse 1.5s infinite !important; background-color: transparent !important; }
@keyframes bedrollGlowPulse {
    0% { filter: drop-shadow(0 0 0px #2ed573) brightness(1); transform: scale(var(--br-scale, 1)); }
    50% { filter: drop-shadow(0 0 25px #2ed573) brightness(1.3); transform: scale(calc(var(--br-scale, 1) + 0.05)); }
    100% { filter: drop-shadow(0 0 0px #2ed573) brightness(1); transform: scale(var(--br-scale, 1)); }
}

/* Search Options Slider & Modal Constraints */
.vertical-slider {
    writing-mode: vertical-lr; direction: rtl; -webkit-appearance: none; appearance: none;
    width: 12px; height: 100%; min-height: 250px; background: var(--weight-bg); outline: none; cursor: pointer;
}
.vertical-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 24px; height: 24px;
    background: var(--active-yellow); border-radius: 50%; cursor: pointer;
}
.search-desc-block {
    font-size: 0.9rem; color: var(--text-muted); padding: 10px; background: var(--bg-color);
    border: 1px solid var(--border-color); border-radius: 4px; height: 22%; display: flex;
    flex-direction: column; justify-content: center;
}
.search-desc-block strong { color: var(--active-yellow); display: block; margin-bottom: 4px; font-size: 1rem; }

/* Pin Search Options Modal over Right Sidebar */
#win-search-options {
    left: auto !important; right: 10px !important; top: 10px !important;
    width: 340px !important; height: auto !important; max-height: calc(100vh - 20px) !important;
}