/* --- Office Theme Variables (Ensure these match your main style) --- */
:root {
    --color-primary-accent: #3498db;   /* Calm Office Blue */
    --color-secondary-accent: #2980b9; /* Slightly darker blue */
    --color-bg-light: #f4f7f9;         /* Very Light Grey Background */
    --color-card-bg: #ffffff;          /* Pure White for card/form/table */
    --color-text-dark: #2c3e50;        /* Deep Navy main text */
    --color-text-light: #7f8c8d;       /* Secondary text */
    --color-input-border: #e0e6ec;     /* Subtle border */
    
    --font-family-body: 'Inter', sans-serif;
    --font-family-heading: 'Montserrat', sans-serif;
    --border-radius-sm: 6px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
}

body {
    background-color: var(--color-bg-light);
    font-family: var(--font-family-body);
    color: var(--color-text-dark);
    padding: var(--spacing-lg);
}

/* --- Main Heading --- */
h2 {
    font-family: var(--font-family-heading);
    color: var(--color-primary-accent);
    font-size: 2em;
    font-weight: 800;
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--color-input-border);
    padding-bottom: var(--spacing-sm);
    display: inline-block;
}

/* --- Add Product Form (Fixed Layout + Button Inside Container) --- */
form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: var(--spacing-lg);
    max-width: 900px;
    box-sizing: border-box;
    margin: 0 auto; /* Center the form horizontally */
}

input[type="text"],
select {
    padding: var(--spacing-sm);
    border: 1px solid var(--color-input-border);
    border-radius: var(--border-radius-sm);
    font-size: 1em;
    background-color: #fcfcfc;
    flex: 1 1 160px;
    min-width: 140px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[name="name"] {
    flex: 2 1 200px; /* Product name takes more width */
}

input[type="text"]:focus,
select:focus {
    border-color: var(--color-primary-accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    background-color: var(--color-card-bg);
}

button[type="submit"] {
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--color-primary-accent);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    flex: 0 0 auto;
    height: 42px;
}

button[type="submit"]:hover {
    background-color: var(--color-secondary-accent);
    transform: translateY(-1px);
}

/* --- Products Table --- */
table {
    width: 100%;
    max-width: 900px;
    margin: 0 auto; /* Center the table */
    border-collapse: collapse;
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius-sm);
    overflow: hidden; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

table th, table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid #f0f0f0; /* Light row separator */
}

/* Table Headers */
table th {
    background-color: var(--color-primary-accent);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

/* Table Rows */
table tr:nth-child(even) {
    background-color: #fcfcfc; 
}

table tr:hover {
    background-color: #eff5ff; /* Soft blue hover for focus */
}

/* Specific Column Styling */
table tr td:nth-child(1) { /* PRO-ID column */
    font-family: 'Courier New', monospace;
    font-weight: 500;
    color: var(--color-primary-accent);
    width: 15%;
}

table tr td:nth-child(3) { /* Category column */
    font-style: italic;
    color: var(--color-text-light);
    width: 20%;
}

/* --- Responsive Fix --- */
@media (max-width: 768px) {
    body {
        padding: var(--spacing-md);
    }
    
    form {
        flex-direction: column;
        align-items: stretch;
        max-width: 100%;
        padding: var(--spacing-sm);
    }

    input[type="text"], 
    select,
    button[type="submit"] {
        width: 100%;
        margin-bottom: var(--spacing-xs);
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        max-width: 100%;
    }
}
