/* static/style.css */
:root {
    --primary-color: #0056b3;
    --primary-hover: #0056b3;
    --background-color: #f4f7f6;
    --form-background: #ffffff;
    --border-color: #ddd;
    --text-color: #333;
    --success-color: #28a745;
    --error-color: #dc3545;
    --info-color: #17a2b8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.form-container, .app-container {
    background: var(--form-background);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.app-container {
    max-width: 800px;
}

h1 {
    color: var(--text-color);
    text-align: center;
    margin-bottom: 0.5rem;
}

p {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

/* === UNIFIED HEADER AND BUTTON STYLES === */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.header-buttons {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    align-items: center;
}

.header-buttons a {
    white-space: nowrap;
    flex-shrink: 0;
}

/* === UNIFIED BUTTON STYLES === */
.btn, .btn-view-product, .btn-logout {
    padding: 0.4em 1em;
    font-size: 0.95rem;
    border-radius: 4px;
    border: none;
    color: #fff;
    cursor: pointer;
    min-width: 110px;
    max-width: 160px;
    text-align: center;
    transition: background 0.2s;
    display: inline-block;
    white-space: nowrap;
    text-decoration: none;
    font-weight: 500;
}

/* Primary buttons (Add Product, Back to Dashboard, View Product) */
.btn, .btn-view-product {
    background: #007bff;
}

.btn:hover, .btn-view-product:hover {
    background: #0056b3;
}

/* Logout button */
.btn-logout {
    background: #6c757d;
}

.btn-logout:hover {
    background: #a71d2a;
}

/* Form submit button override */
.btn[type="submit"], button.btn[type="submit"] {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.1rem;
    font-weight: 600;
    min-width: auto;
    max-width: none;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input[type="text"], input[type="password"], select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    text-align: center;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
}

.alert.success {
    background-color: #d4edda;
    color: #155724;
}

.alert.info {
    background-color: #d1ecf1;
    color: #0c5460;
}

input[list] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s;
    background-color: #fff;
    background-image: url("data:image/svg+xml;utf8,<svg fill='gray' height='18' viewBox='0 0 24 24' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

input[list]:focus {
    outline: none;
    border-color: var(--primary-color);
}

input[list]::placeholder {
    color: #aaa;
    font-style: italic;
}

/* === SCANNER AND FILE INPUT STYLES === */
#scanner-preview {
    width: 100%;
    margin-top: 0.5rem;
    border-radius: 6px;
    display: none;
}

.sku-scan-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.sku-scan-group input {
    flex: 1;
}

.scan-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    background-color: #17a2b8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.scan-btn:hover {
    background-color: #117a8b;
}

  
.custom-dropdown {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-height: 8.5em;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-top: 2px;
}

.custom-dropdown-option {
    padding: 0.5em 1em;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-dropdown-option:hover,
.custom-dropdown-option.active {
    background: #f0f8ff;
}

.custom-file-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    background: #f8f9fa;
    border: 1px solid #007bff;
    border-radius: 4px;
    padding: 0.4em 1em;
    cursor: pointer;
    color: #007bff;
    font-weight: 500;
    transition: background 0.2s, border 0.2s;
    margin-top: 0.5em;
}

.custom-file-label:hover {
    background: #e6f0ff;
    border-color: #0056b3;
}

.custom-file-label input[type="file"] {
    display: none;
}

.custom-file-label span {
    font-size: 0.95em;
    color: #333;
}

/* === BUTTON GROUP STYLES (for success messages) === */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 1em;
}

.btn-group .btn {
    min-width: auto;
    padding: 0.3em 0.8em;
    font-size: 0.9rem;
}

/* === PRODUCT GRID STYLES === */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #f0f0f0;
}

.product-card-content {
    padding: 1rem;
    flex-grow: 1;
}

.product-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.product-card p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: #555;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 600px) {
    .header-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-buttons {
        flex-wrap: wrap;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}