/* Compact form group and label for minimal row height */
.inventory-form-spreadsheet .form-table .form-group {
    margin: 0;
    padding: 0;
}
.inventory-form-spreadsheet .form-table label {
    margin: 0;
    padding: 0;
    font-size: 1.01rem;
}

/* Background Gradients (Matches Landing Page) */
.inventory-layout,
.inventory-form-layout {
    min-height: calc(100vh - 60px);
    background: linear-gradient(to bottom, #f8fafc, #edf2f7);
    padding: 1rem;
    padding-top: 0.5rem;
    box-sizing: border-box;
}

/* --- OUTER LAYOUT PATCH: Prevent shrink on sort --- */
.inventory-layout {
    min-width: 1200px !important;
    width: 100%;
    box-sizing: border-box;
}

.inventory-list-section {
    min-width: 1200px !important;
    width: 100%;
    box-sizing: border-box;
}

.dark .inventory-layout,
.dark .inventory-form-layout {
    background: linear-gradient(to bottom, #0f172a, #1e293b);
    color: #f1f5f9;
}

/* Title Styling inside layouts */
.inventory-layout h1,
.inventory-form-layout h1 {
    color: #1e293b;
    margin-bottom: 1.5rem;
    text-align: left; /* Changed to left alignment */
}
.inventory-layout h2,
.inventory-form-layout h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}
.dark .inventory-layout h1,
.dark .inventory-form-layout h1 {
    color: #f8fafc;
}

/* Out of Stock and Delete Buttons */
.btn-outofstock, .btn-delete {
    margin-top: 0.8rem;
    padding: 0.6rem 1.2rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    margin-left: 0.5rem;
}
.btn-outofstock:hover {
    background: #ffc107;
    color: #222;
}
.btn-delete {
    background: #dc3545;
}
.btn-delete:hover {
    background: #a71d2a;
}
.form-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.8rem;
}
.dark input:-webkit-autofill,
.dark input:-webkit-autofill:focus,
.dark input:-webkit-autofill:hover,
.dark input:-webkit-autofill:active {
    background: #0f1724 !important;
    color: #E5E7EB !important;
    -webkit-box-shadow: 0 0 0 30px #0f1724 inset !important;
    box-shadow: 0 0 0 30px #0f1724 inset !important;
    -webkit-text-fill-color: #E5E7EB !important;
}

/* Scrollable item grid for max 6 records */
.inventory-table tbody {
    display: block;
    max-height: 360px;
    overflow-y: auto;
    width: 100%;
}
.inventory-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* Drop Box & Image Upload Styles */
.drop-box {
    border: 2px dashed #cbd5e1;
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.drop-box:hover, .drop-box.drag-active {
    border-color: #3b82f6;
    background: #eff6ff;
}
.dark .drop-box {
    background: #0f172a;
    border-color: #334155;
}
.dark .drop-box:hover {
    background: #1e293b;
}

/* Hide the default file input but keep it functional covering the box */
.drop-box input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.drop-box-label {
    display: block;
    color: #64748b;
    font-size: 0.9em;
    pointer-events: none;
}

.drop-box img {
    display: block;
    margin: 0 auto;
    margin-top: 4px;
    max-height: 72px;
    max-width: 100%;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: relative;
    z-index: 5;
}

/* Form Container */
.inventory-form-spreadsheet {
    /* Left aligned as requested */
    max-width: 1100px; /* Slightly wider */
    margin: 0; /* Left align */
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    color: #222;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}
.dark .inventory-form-spreadsheet {
    background: #1e293b;
    color: #E5E7EB;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

.inventory-form-spreadsheet .form-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 1rem 0;
}

.inventory-form-spreadsheet .form-table td {
    vertical-align: top;
    padding: 0.1rem 0;
    text-align: left !important;
}

/* Updated input height and font size */
.inventory-form-spreadsheet input[type="text"],
.inventory-form-spreadsheet input[type="number"],
.inventory-form-spreadsheet select,
.inventory-form-spreadsheet textarea {
    width: 100%;
    padding: 0.1rem 0.5rem; /* Reduced vertical padding further */
    font-size: 0.8rem;      /* Kept font size for readability */
    line-height: normal;    /* Ensure line height doesn't force extra height */
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #1e293b;
    box-sizing: border-box;
}

.dark .inventory-form-spreadsheet input[type="text"],
.dark .inventory-form-spreadsheet input[type="number"],
.dark .inventory-form-spreadsheet select,
.dark .inventory-form-spreadsheet textarea {
    background: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

/* Checkbox fixes */
.inventory-form-spreadsheet input[type="checkbox"] {
    width: auto !important;
    margin-right: 0.5rem;
    transform: scale(1.2);
    vertical-align: middle;
}

/* price field should be left-aligned, not right-justified */
.inventory-form-spreadsheet input[name="price"],
.inventory-form-spreadsheet input[id$="_price"] {
    text-align: left !important;
    direction: ltr !important; /* ensure arrow appears at right */
}

/* also cover the quick-edit form if reused */
.quick-edit-form input[name="price"],
.quick-edit-form input[id$="_price"] {
    text-align: left !important;
    direction: ltr !important;
}
.checkbox-center label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

