/*
 * Copyright (c) Evan Webb, Australia - WebbMTS Modular Tech Systems.
 * Proprietary software. Unauthorized distribution, tampering, reverse engineering, or unlicensed use is prohibited.
 * Use is subject to WebbMTS commercial license and EULA terms.
 */

/* =========================================
WEBBMTS - INVENTORY MANAGER STYLES
   Updated: March 2026 
   Supports: Nested Batch Views, Floating Menus & Strict Alignment
   ========================================= */

/* 1. SUB-TABS (Inventory Admin)
   ========================================= */
.sub-tab-container { 
    margin-bottom: 20px; 
    background: #1c2833; 
    border-radius: 6px; 
    display: inline-block; 
    padding: 5px; 
    border: 1px solid #34495e; 
}

.sub-tab { 
    background: transparent; 
    border: none; 
    padding: 8px 18px; 
    cursor: pointer; 
    color: #bdc3c7; 
    font-size: 12px; 
    font-weight: bold; 
    border-radius: 4px; 
    display: inline-block; 
    transition: 0.2s; 
}

.sub-tab:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sub-tab.active { background: #3498db; color: white; }

/* 2. TOOLBAR & FILTERS (Input Grid)
   ========================================= */
.toolbar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    align-items: flex-end; 
}

#inv-toolbar {
    justify-content: flex-start;
    align-items: center;
}

#inv-toolbar .inv-add-asset-item {
    align-items: flex-start;
}

.grid-item { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
}

.grid-item[style*="flex: 1.2"] { flex: 1.2; min-width: 180px; }
.grid-item[style*="flex: 0.8"] { flex: 0.8; min-width: 120px; }
.grid-item[style*="flex: 0.4"] { flex: 0.4; min-width: 70px; }
.grid-item[style*="flex: 1"]   { flex: 1; min-width: 150px; }
.grid-item[style*="flex: 0.6"] { flex: 0.6; min-width: 100px; }

.grid-item label { 
    font-size: 11px; 
    text-transform: uppercase; 
    color: #95a5a6; 
    font-weight: bold; 
}

/* 3. FILTER BAR (The Fix)
   ========================================= */
.filter-bar {
    background: rgba(0,0,0,0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-container-inner {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap; /* Prevent accidental wrapping on desktop */
}

/* Ensure search wrapper takes remaining space but doesn't force a wrap */
.filter-bar .search-wrapper {
    flex: 1; 
    min-width: 200px;
}

/* 4. STYLED IMAGE UPLOADER
   ========================================= */
.file-upload-wrapper {
    position: relative;
    width: 100%;
}

.btn-file-trigger {
    width: 100%;
    height: 38px;
    background: #34495e;
    border: 1px solid #455a64;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.btn-file-trigger:hover {
    background: #455a64;
    border-color: #3498db;
}

#file-status-tick {
    font-weight: bold;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* 5. SEARCH & SUGGESTIONS
   ========================================= */
.search-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    background: #1a252f;
    border: 1px solid #455a64;
    color: white;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.search-input:focus { border-color: #3498db; }

#custom-suggestions, 
#new-item-suggestions,
.custom-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a252f;
    border: 1px solid #34495e;
    border-top: none;
    z-index: 1000;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

#custom-suggestions div,
#new-item-suggestions div,
.custom-suggestions-dropdown div {
    padding: 10px 15px;
    cursor: pointer;
    color: #ecf0f1;
    font-size: 13px;
    transition: background 0.2s;
}

#custom-suggestions div:hover,
#new-item-suggestions div:hover,
.custom-suggestions-dropdown div:hover {
    background: #3498db;
    color: white;
}

/* 6. TABLES & ALIGNMENT
   ========================================= */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-bottom: 20px; 
    table-layout: fixed; 
}

th { 
    text-align: left; 
    padding: 12px; 
    color: #95a5a6; 
    border-bottom: 2px solid #34495e; 
    font-size: 11px; 
    text-transform: uppercase; 
}

td { 
    padding: 12px; 
    border-bottom: 1px solid #2c3e50; 
    font-size: 13px; 
    word-wrap: break-word;
}

.col-name  { width: 35%; }
.col-acq   { width: 12%; }
.col-exp   { width: 12%; }
.col-qty   { width: 15%; }
.col-cat   { width: 13%; }
.col-act   { width: 13%; text-align: right; }

tr[onclick] { cursor: pointer; transition: background 0.2s; }
tr[onclick]:hover { background: rgba(52, 152, 219, 0.08); }

.asset-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 10px;
    vertical-align: middle;
    background: #2c3e50;
    border: 1px solid #455a64;
}

/* 7. FLOATING ACTION MENUS
   ========================================= */
.action-dropdown-container {
    position: relative;
    display: inline-block;
}

.action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #1c2833;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
    z-index: 1001; 
    border: 1px solid #34495e;
    border-radius: 4px;
    padding: 5px 0;
}

.action-menu a {
    color: #ecf0f1;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 13px;
    text-align: left;
    transition: background 0.2s;
}

.action-menu a:hover {
    background: #3498db;
    color: white;
}

.action-menu hr {
    border: 0;
    border-top: 1px solid #34495e;
    margin: 5px 0;
}

/* 8. NESTED BATCH STYLES
   ========================================= */
.batch-inner-table {
    width: 100%;
    border-collapse: collapse;
    background: #1c2833;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #34495e;
    margin-top: 5px;
    table-layout: fixed;
}

.batch-inner-table thead { background: #2c3e50; }
.batch-inner-table th { padding: 8px; font-size: 11px; color: #bdc3c7; border-bottom: 1px solid #34495e; }
.batch-inner-table td { padding: 8px; font-size: 13px; border-bottom: 1px solid #2c3e50; }

.low-stock-row { background-color: rgba(231, 76, 60, 0.08) !important; }
.low-stock-row td { border-left: 4px solid #e74c3c; }
.low-stock-row strong { color: #e74c3c; }

/* 9. INPUTS & SHARED COMPONENTS
   ========================================= */
.admin-input, .table-select { 
    background: #1a252f !important; 
    border: 1px solid #455a64 !important; 
    color: #ecf0f1 !important; 
    padding: 8px 12px; 
    border-radius: 6px; 
    width: 100%; 
    height: 40px; 
    outline: none;
    box-sizing: border-box; 
    font-size: 14px;
}

.admin-input:focus, .table-select:focus { border-color: #3498db !important; }

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.btn-blue {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.btn-blue:hover { background: #2980b9; }

.btn-red {
    background: #c0392b;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-red:hover { background: #e74c3c; }

.btn-logout {
    cursor: pointer;
    background: transparent;
    border: 1px solid #3498db;
    color: #3498db;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
}
.btn-logout:hover { background: #3498db; color: white; }

.btn-blue-outline {
    background: transparent;
    border: 1px solid #3498db;
    color: #3498db;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.btn-blue-outline:hover { background: #3498db; color: white; }

.required-star {
    color: #e74c3c;
    margin-left: 3px;
    font-weight: bold;
}

/* 10. MODAL EDITOR STYLES
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #1c2833;
    border: 1px solid #34495e;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #34495e;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { margin: 0; color: #3498db; font-size: 18px; }

.close-modal {
    background: transparent;
    border: none;
    color: #95a5a6;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}
.close-modal:hover { color: #fff; }

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-image-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #34495e;
}

#edit-preview-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #3498db;
    background: #2c3e50;
}

#new-preview-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #3498db;
    background: #2c3e50;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.modal-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-item.full { grid-column: span 2; }

.modal-item label {
    font-size: 11px;
    text-transform: uppercase;
    color: #95a5a6;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-item.image-picker-row {
    align-items: center;
}

.modal-item.image-picker-row label {
    text-align: center;
    width: 100%;
}

.modal-item.image-picker-row .file-upload-wrapper {
    max-width: 200px;
    margin: 0 auto;
}

#add-inventory-modal .add-inventory-actions {
    border-top: none;
    padding: 8px 0 0;
    width: 100%;
    justify-content: center;
}
