/* CSV Upload Button: match .btn-search */
.btn-upload-csv {
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5em 1.2em;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-block;
}
.btn-upload-csv:hover {
    background: #0056b3;
}
.dark .btn-upload-csv {
    background: #1e293b;
    color: #E5E7EB;
    border: 1px solid #334155;
}

/* Card Style for List Section */
.inventory-list-section {
    background: white;
    padding: 1rem; /* Compact padding */
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    /* Reduced margin-top to bring content up */
    margin-top: 1.5rem;
    /* Reset left alignment and widths */
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 2rem;
    
    width: 100%;
    max-width: 100%; /* Ensure it takes full available width */
    box-sizing: border-box;
}
.dark .inventory-list-section {
    background: #1e293b;
    color: #E5E7EB;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

/* Inventory search bar styles */
.inventory-search-form {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 1em;
}
.inventory-search-input {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.5em 1em;
    font-size: 1em;
    width: 250px;
    transition: border 0.2s;
    background: white;
    color: #222;
}

.dark .inventory-search-input {
    background: #0b1220;
    color: #E5E7EB;
    border-color: #334155;
}
.inventory-search-input:focus {
    border: 1.5px solid #007bff;
    outline: none;
}
.btn-search {
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5em 1.2em;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-search:hover {
    background: #0056b3;
}
/* Force left alignment for all inventory-table headers except the image column */
.inventory-list-section .inventory-table thead th:not(.image-col) {
    text-align: left !important;
}
/* Force left alignment for all headers except the image column */
.inventory-list-section .inventory-table th {
    text-align: left !important;
}
.inventory-list-section .inventory-table th.image-col {
    text-align: center !important;
}

.inventory-list-section .inventory-table-container {
    overflow-x: auto;
    margin: 10px 0;
}
.inventory-list-section .inventory-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto; /* let columns size to content so spacing spreads */
}

/* Table styling for new card look */
.inventory-table th, 
.inventory-table td {
    padding: 0.6rem 0.5rem; /* Compressed padding */
    border-bottom: 1px solid #e2e8f0;
    white-space: normal; /* Allow wrapping so columns can expand */
}
.dark .inventory-table th, 
.dark .inventory-table td {
    border-color: #334155;
}

.inventory-table tr:hover {
    background-color: #f8fafc;
}
.dark .inventory-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.inventory-table th {
    font-weight: 600;
    color: #64748b;
    font-size: 0.9rem;
}
.dark .inventory-table th {
    color: #94a3b8;
}

.inventory-list-section .inventory-table {
    width: 100%;
}

#items-table th:not(.image-col),
#items-table td:not(.image-col) {
    text-align: left !important;
}

#items-table th.image-col,
#items-table td.image-col {
    text-align: center !important;
}

/* --- FORCE TABLE COLUMN WIDTHS TO PREVENT LAYOUT SHIFT --- */
/* utilities used by inventory templates */
.inventory-table { table-layout: fixed; width:100%; }
.sortable { cursor: pointer; }
.image-col { position: relative; overflow: visible; text-align:center; }
.qr-col { text-align:center; min-width:140px; vertical-align: middle; }

.item-qr { width:40px; height:40px; display:inline-block; vertical-align:middle; object-fit:contain; border-radius:4px; }
.radio-margin { margin-right:2px; }
.inline-flex-col-mid { display:inline-flex; flex-direction:column; gap:2px; vertical-align:middle; flex-shrink:0; margin-left:6px; align-items:flex-start; }

/* container to place qr image and radio stack side-by-side */
.qr-container {
    display: inline-flex;
    flex-direction: row; /* place radios to right of image */
    align-items: center;
    gap: 0.25rem;
}
/* keep the image and radio block on one line; allow emoji inside labels to wrap */
.qr-container { white-space: nowrap; }

#items-table th,
#items-table td {
    min-width: 90px;
    box-sizing: border-box;
}

/* Ensure table cells align content vertically centered */
#items-table th,
#items-table td {
    vertical-align: middle;
}

/* Align inner elements without changing table cell display
    - keep the table structure intact and ensure items line up */
.image-col .item-image { display: inline-block; margin: 0; vertical-align: middle; }
.qr-col .qr-container { display: inline-flex; align-items: center; vertical-align: middle; gap: 0.25rem; white-space: nowrap; }
.actions-col .btn-details { display: inline-flex; align-items: center; vertical-align: middle; }

#items-table {
    table-layout: fixed !important;
    width: 100% !important;
    min-width: 1200px !important;
}

.table-responsive {
    min-width: 1200px !important;
    width: 100% !important;
    overflow-x: auto;
}

#items-table {
    min-width: 1100px;
}

@media (max-width: 1200px) {
    #items-table th,
    #items-table td {
        font-size: 14px;
        padding: 6px 8px;
    }
}

@media (max-width: 900px) {
    #items-table th,
    #items-table td {
        font-size: 13px;
        padding: 5px 6px;
    }

    #items-table {
        min-width: 700px;
    }
}

@media (max-width: 600px) {
    #items-table th,
    #items-table td {
        font-size: 12px;
        padding: 4px 4px;
    }

    #items-table {
        min-width: 600px;
    }
}

#items-table th:nth-child(1),
#items-table td:nth-child(1) {
    width: 90px;
}

#items-table th:nth-child(2),
#items-table td:nth-child(2) {
    width: 80px;
}

#items-table th:nth-child(3),
#items-table td:nth-child(3) {
    width: 110px;
}

#items-table th:nth-child(4),
#items-table td:nth-child(4) {
    width: 120px;
}

#items-table th:nth-child(5),
#items-table td:nth-child(5) {
    width: 180px;
}

#items-table th:nth-child(6),
#items-table td:nth-child(6) {
    width: 70px;
}

#items-table th:nth-child(7),
#items-table td:nth-child(7) {
    width: 90px;
}

#items-table th:nth-child(8),
#items-table td:nth-child(8) {
    width: 80px;
}

#items-table th:nth-child(9),
#items-table td:nth-child(9) {
    width: 90px;
}

#items-table th:nth-child(10),
#items-table td:nth-child(10) {
    width: 90px;
}

#items-table th.image-col,
#items-table td.image-col {
    width: 90px;
}

#items-table th.actions-col,
#items-table td.actions-col {
    width: 100px;
}

/* Actions dropdown styles used in the list header */
.actions-dropdown { position: relative; display: inline-block; }
.actions-dropdown .btn-upload-csv { display: inline-flex; align-items: center; gap: 0.4em; }
.actions-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid #e6e6e6;
    box-shadow: 0 8px 24px rgba(16,24,40,0.12);
    border-radius: 8px;
    padding: 0.25rem 0;
    min-width: 190px;
    z-index: 60;
    display: none;
}
.actions-menu .actions-menu-item { padding: 0.25rem 0.5rem; }
.actions-menu .actions-menu-item a,
.actions-menu .actions-menu-item button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.6rem;
    background: none;
    border: none;
    color: #111827;
    cursor: pointer;
    font-size: 0.95rem;
}
.actions-menu .actions-menu-item a:hover,
.actions-menu .actions-menu-item button:hover { background: #f3f4f6; }
.actions-dropdown.open .actions-menu { display: block; }

.actions-menu-item button:hover,
.actions-menu-item a:hover {
    background: #f1f5f9;
    color: #0c4a6e;
}

.dark .actions-menu-item button:hover,
.dark .actions-menu-item a:hover {
    background: #334155 !important;
    color: #bae6fd !important;
}

/* Dark mode adjustments for actions menu */
.dark .actions-menu { background: #0f1724; border-color: #222; color: #E5E7EB; }
.dark .actions-menu .actions-menu-item a,
.dark .actions-menu .actions-menu-item button { color: #E5E7EB; }

