/* Minimal CSS for Inventory - No sticky positioning interference */

.INVmain-content {
    width: 85%;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;             /* enable vertical scrolling */
    scrollbar-width: thin;        /* Firefox scrollbar */
    scrollbar-color: #c2a986 transparent;
}

.inventory-box {
    padding: 20px;
    background: #fffaf2;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.inventory-box h1 {
    font-weight: bold;
}

.add-button-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.INVview-more-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #a47845;
    border-radius: 10px;
    padding: 10px 15px 10px 15px;
    gap: 8px;
    transition: all 0.3s ease;
}

.INVview-more-text {
    font-size: 14px;
    color: white;
    margin: 0;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.INVview-more-text:hover {
    background: #8c6231;
}

.INVview-more {
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    transition: color 0.2s ease;
}

.INVview-more:hover {
    background: #8c6231;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.INVview-more-wrapper:hover {
    background: #8c6231;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-add {
    background: #a47845;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add:hover {
    background: #8c6231;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Scrollable table wrapper */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 650px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    position: relative;
    bottom: 0px;
    margin-bottom: 30px;
}

/* Basic table styling */
.inventory-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

/* Removed duplicate table styling - was breaking sticky headers */

.inventory-table thead {
    background-color: #a87a47;
    position: sticky;
    top: 0;
    z-index: 10;
}

.inventory-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #f4f1ee;
    border-bottom: 2px solid #e5e7eb;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #a87a47;
}

.inventory-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    color: #704013;
    font-size: 14px;
}

.inventory-table tbody tr:hover {
    background-color: #efe0cf;
    transition: background-color 0.5s ease;
}

.inventory-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column widths */
.inventory-table th:nth-child(1),
.inventory-table td:nth-child(1) { width: 15%; }
.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) { width: 10%; }
.inventory-table th:nth-child(3),
.inventory-table td:nth-child(3) { width: 30%; }
.inventory-table th:nth-child(4),
.inventory-table td:nth-child(4) { width: 10%; }
.inventory-table th:nth-child(5),
.inventory-table td:nth-child(5) { width: 15%; }
.inventory-table th:nth-child(6),
.inventory-table td:nth-child(6) { width: 20%; }

/* Action buttons */
.btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
}

.btn-edit {
    background: #4caf50;
    color: white;
    margin-right: 6px;
}

.btn-edit:hover {
    background: #3d8b40;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Modal styles */
.stock-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.stock-modal {
    background: #fffaf2;
    width: 600px;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    animation: fadeIn 0.3s ease;
    text-align: center;
    overflow-y: auto;
    overflow-x: hidden;
}

.stock-modal h2 {
    margin-bottom: 10px;
    color: #3b2a18;
    font-size: 1.4rem;
}

.edit-form {
    text-align: left;
    margin: 20px 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group {
    margin-bottom: 0;
    text-align: left;
}

/* Make certain fields span full width */
.form-group:has(#addProductNameInput),
.form-group:has(#addImageInput),
.form-group:has(#addDescriptionInput),
.form-group:has(#descriptionInput) {
    grid-column: span 2;
}

/* Radio group styling */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
}

.radio-group input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

/* Size checkboxes styling */
.size-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.size-checkboxes label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
    padding: 5px 10px;
    border: 1px solid #d9cbb5;
    border-radius: 6px;
    background: #fff;
    transition: all 0.2s ease;
}

.size-checkboxes label:hover {
    background: #f8f5f0;
    border-color: #a47845;
}

.size-checkboxes input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.size-checkboxes input[type="checkbox"]:checked + span {
    color: #a47845;
    font-weight: 600;
}

/* Enhanced modal width for new features */
.stock-modal {
    width: 600px;
    max-width: 90vw;
}

/* Textarea styling */
textarea.form-input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    line-height: 1.4;
}

/* Image preview styling */
.image-preview {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-preview img {
    border-radius: 8px;
    border: 1px solid #ddd;
    object-fit: cover;
}

/* Small text styling */
small {
    color: #666;
    font-size: 12px;
    display: block;
    margin-top: 5px;
    font-style: italic;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #3b2a18;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #d9cbb5;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: #a47845;
    outline: none;
    box-shadow: 0 0 0 3px rgba(164,120,69,0.2);
}

.stock-modal input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d9cbb5;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 0;
    box-sizing: border-box;
}

.stock-modal input:focus {
    border-color: #a47845;
    outline: none;
    box-shadow: 0 0 0 3px rgba(164,120,69,0.2);
}

.stock-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}

.btn-circle {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #a47845;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-circle:hover {
    background: #8c6231;
}

.modal-actions {
    margin: auto;
    gap: 10px;
}

.modal-actions button{
    margin: 5px;
}

.btn-save {
    background: #a47845;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

.btn-save:hover {
    background: #8c6231;
}

.btn-cancel {
    background: #e0d2c3;
    color: #3b2a18;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

.btn-cancel:hover {
    background: #d0c0ae;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Message styling */
.message {
    padding: 10px 15px;
    border-radius: 5px;
    margin: 10px 0;
    font-weight: bold;
    text-align: center;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .INVmain-content{
        width: 100%;
    }
}

@media (max-width: 1200px) {
    .inventory-table th, 
    .inventory-table td {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ===== TABLET STYLES (≤1024px) ===== */
@media (max-width: 1024px) {
    .INVmain-content {
        width: 100%;
        padding: 0 15px;
    }

    .inventory-box {
        padding: 15px;
        border-radius: 8px;
    }

    .inventory-box h1 {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }

    .add-button-container {
        margin-bottom: 8px;
    }

    .btn-add {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .table-wrapper {
        max-height: 500px;
        margin-bottom: 20px;
        border-radius: 15px;
    }

    .inventory-table th,
    .inventory-table td {
        padding: 12px 15px;
        font-size: 13px;
    }

    .inventory-table th {
        font-size: 12px;
        letter-spacing: 0.3px;
    }

    .btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .btn-edit {
        margin-right: 4px;
    }

    /* Modal adjustments for tablet */
    .stock-modal {
        width: 500px;
        padding: 18px;
    }

    /* Radio group adjustments for tablet */
    .radio-group {
        gap: 15px;
    }

    /* Size checkboxes adjustments for tablet */
    .size-checkboxes {
        gap: 8px;
    }

    .size-checkboxes label {
        padding: 4px 8px;
        font-size: 0.85rem;
    }

    .stock-modal h2 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    .edit-form {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .form-group {
        margin-bottom: 0;
    }

    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }

    .form-input,
    .stock-modal input {
        padding: 10px;
        font-size: 0.85rem;
    }

    .btn-circle {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .stock-controls {
        gap: 8px;
        margin-bottom: 12px;
    }

    .btn-save,
    .btn-cancel {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* ===== MOBILE STYLES (≤768px) ===== */
@media (max-width: 768px) {
    .INVmain-content {
        width: 100%;
        padding: 0 8px;
    }

    .inventory-box {
        padding: 12px;
        border-radius: 6px;
    }

    .inventory-box h1 {
        font-size: 1.2rem;
        margin-bottom: 6px;
    }

    .add-button-container {
        margin-bottom: 6px;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .INVview-more-wrapper {
        width: 100%;
        justify-content: center;
    }

    .btn-add {
        padding: 10px 16px;
        font-size: 0.85rem;
        width: 100%;
        max-width: 200px;
    }

    .table-wrapper {
        overflow-x: auto;
        overflow-y: auto;
        max-height: 400px;
        margin: 0 -5px 15px -5px;
        border-radius: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .inventory-table {
        min-width: 600px;
    }

    .inventory-table th,
    .inventory-table td {
        padding: 8px 10px;
        font-size: 11px;
    }

    .inventory-table th {
        font-size: 10px;
        letter-spacing: 0.2px;
        padding: 10px 10px;
    }

    .btn {
        padding: 4px 8px;
        font-size: 0.7rem;
        min-height: 32px;
        min-width: 44px;
        touch-action: manipulation;
    }

    .btn-edit {
        margin-right: 3px;
    }

    /* Modal adjustments for mobile */
    .stock-modal-overlay {
        padding: 10px;
    }

    .stock-modal {
        width: 100%;
        max-width: 95%;
        padding: 15px;
        border-radius: 10px;
    }

    .stock-modal h2 {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }

    .edit-form {
        margin: 15px 0;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Radio group adjustments for mobile */
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    /* Size checkboxes adjustments for mobile */
    .size-checkboxes {
        gap: 6px;
    }

    .size-checkboxes label {
        padding: 3px 6px;
        font-size: 0.8rem;
    }

    .form-group {
        margin-bottom: 0;
    }
    
    .form-group:has(#addProductNameInput),
    .form-group:has(#addImageInput) {
        grid-column: span 1;
    }

    .form-group label {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .form-input,
    .stock-modal input {
        padding: 8px;
        font-size: 0.8rem;
        min-height: 40px;
        touch-action: manipulation;
    }

    .btn-circle {
        width: 30px;
        height: 30px;
        font-size: 1rem;
        touch-action: manipulation;
    }

    .stock-controls {
        gap: 6px;
        margin-bottom: 10px;
    }

    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    .modal-actions button {
        margin: 2px 0;
        width: 100%;
        min-height: 40px;
        touch-action: manipulation;
    }

    .btn-save,
    .btn-cancel {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .message {
        padding: 8px 12px;
        font-size: 0.8rem;
        margin: 8px 0;
    }
}

/* ===== SMALL MOBILE STYLES (≤480px) ===== */
@media (max-width: 480px) {
    .INVmain-content {
        padding: 0 5px;
    }

    .inventory-box {
        padding: 10px;
        border-radius: 4px;
    }

    .inventory-box h1 {
        font-size: 1.1rem;
        margin-bottom: 5px;
    }

    .add-button-container {
        margin-bottom: 5px;
    }

    .btn-add {
        padding: 6px 12px;
        font-size: 0.8rem;
        max-width: 180px;
    }

    .table-wrapper {
        max-height: 350px;
        margin: 0 -3px 12px -3px;
        border-radius: 8px;
    }

    .inventory-table {
        min-width: 550px;
    }

    .inventory-table th,
    .inventory-table td {
        padding: 6px 8px;
        font-size: 10px;
    }

    .inventory-table th {
        font-size: 9px;
        letter-spacing: 0.1px;
        padding: 8px 8px;
    }

    .btn {
        padding: 3px 6px;
        font-size: 0.65rem;
        min-height: 28px;
        min-width: 40px;
    }

    .btn-edit {
        margin-right: 2px;
    }

    /* Modal adjustments for small mobile */
    .stock-modal-overlay {
        padding: 5px;
    }

    .stock-modal {
        padding: 12px;
        border-radius: 8px;
    }

    .stock-modal h2 {
        font-size: 1rem;
        margin-bottom: 5px;
    }

    .edit-form {
        margin: 12px 0;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .form-group label {
        font-size: 0.75rem;
        margin-bottom: 3px;
    }

    .form-input,
    .stock-modal input {
        padding: 6px;
        font-size: 0.75rem;
        min-height: 36px;
    }

    .btn-circle {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .stock-controls {
        gap: 4px;
        margin-bottom: 8px;
    }

    .modal-actions {
        gap: 6px;
    }

    .modal-actions button {
        margin: 1px 0;
        min-height: 36px;
    }

    .btn-save,
    .btn-cancel {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .message {
        padding: 6px 10px;
        font-size: 0.75rem;
        margin: 6px 0;
    }
}

/* ===== EXTRA SMALL MOBILE (≤360px) ===== */
@media (max-width: 360px) {
    .INVmain-content {
        padding: 0 3px;
    }

    .inventory-box {
        padding: 8px;
        border-radius: 3px;
    }

    .inventory-box h1 {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .btn-add {
        padding: 5px 10px;
        font-size: 0.75rem;
        max-width: 160px;
    }

    .table-wrapper {
        max-height: 300px;
        margin: 0 -2px 10px -2px;
        border-radius: 6px;
    }

    .inventory-table {
        min-width: 500px;
    }

    .inventory-table th,
    .inventory-table td {
        padding: 4px 6px;
        font-size: 9px;
    }

    .inventory-table th {
        font-size: 8px;
        padding: 6px 6px;
    }

    .btn {
        padding: 2px 4px;
        font-size: 0.6rem;
        min-height: 24px;
        min-width: 36px;
    }

    .stock-modal {
        padding: 10px;
    }

    .stock-modal h2 {
        font-size: 0.9rem;
    }

    .form-input,
    .stock-modal input {
        padding: 5px;
        font-size: 0.7rem;
        min-height: 32px;
    }

    .btn-circle {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }

    .btn-save,
    .btn-cancel {
        padding: 5px 10px;
        font-size: 0.7rem;
        min-height: 32px;
    }
}