/* Management container */
#management-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #333;
    color: white;
    padding: 12px 10px;
    border: 1px solid #6f42c1;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Product management section */
.product-management-section {
    margin-top: 12px;
    padding: 15px;
    background-color: #444;
    border-radius: 8px;
}

.product-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 auto;
}

/* Close button */
#close-management {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: #ff4444;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.3s ease;
}

#close-management:hover {
    color: #ff0000;
}

/* Flex container for vendor and category sections */
.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 12px 0;
}

.flex-item {
    flex: 1 1 200px;
    background-color: #444;
    padding: 15px;
    border-radius: 8px;
}

/* Input-button groups */
.input-button-group {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 5px 0;
}

.input-button-group input {
    flex: 1;
    min-width: 0;
}

.input-button-group button {
    white-space: nowrap;
    padding: 8px 15px;
    height: 35px;
    min-width: 80px;
}

/* Form inputs */
#new-vendor-name,
#new-category-name,
#new-product-name,
#new-product-barcode,
#category-select {
    width: 100%;
    padding: 8px 12px;
    margin: 2px 0;
    background-color: #555;
    border: 1px solid #6f42c1;
    border-radius: 6px;
    color: white;
    text-align: center;
    font-size: 14px;
    height: 35px;
}

/* Headings */
#management-container h2 {
    color: white;
    margin: 0 0 12px 0;
    border-bottom: 2px solid #6f42c1;
    padding-bottom: 8px;
    font-size: 1.3em;
}

#management-container h3 {
    color: white;
    margin: 0 0 10px 0;
    border-bottom: 2px solid #6f42c1;
    padding-bottom: 6px;
    font-size: 1.1em;
}

/* Existing barcodes */
.existing-barcodes {
    margin-top: 5px;
    padding: 8px;
    background-color: #444;
    border-radius: 6px;
    max-height: 120px;
    overflow-y: auto;
}

/* Product save button */
#save-product-button {
    align-self: center;
    max-width: 200px;
    margin-top: 5px;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    #management-container {
        width: 92%;
        padding: 10px 8px;
        margin: 0;
    }

    .flex-item {
        flex: 1 1 100%;
        padding: 10px 8px;
        margin: 0;
    }

    .product-management-section {
        padding: 10px 8px;
        margin-top: 10px;
    }

    .input-button-group {
        gap: 4px;
    }

    .input-button-group button {
        padding: 8px 10px;
        min-width: 70px;
    }

    #new-vendor-name,
    #new-category-name,
    #new-product-name,
    #new-product-barcode,
    #category-select {
        padding: 8px 6px;
    }

    /* Make product save button smaller on mobile */
    #save-product-button {
        max-width: 140px;
    }
}

/* iPhone SE and smaller devices */
@media (max-width: 375px) {
    #management-container {
        width: 90%;
        padding: 8px 6px;
    }

    .flex-item {
        padding: 8px 6px;
    }

    .product-management-section {
        padding: 8px 6px;
    }

    .input-button-group button {
        padding: 8px 8px;
        min-width: 65px;
    }
}
