/* inventory.css: styles for the product table, form dialog and messages */

/* ----- Status badges ----- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.badge-expired {
    background: #fee2e2;
    color: #991b1b;
}

.badge-critical {
    background: #ffedd5;
    color: #9a3412;
}

.badge-warning {
    background: #fef9c3;
    color: #854d0e;
}

.badge-safe {
    background: #dcfce7;
    color: #166534;
}

.badge-invalid {
    background: #e2e8f0;
    color: #334155;
}

.priority-note {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.sub-text {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.product-name {
    font-weight: 600;
}

.result-count {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ----- Extra buttons ----- */
.btn-secondary {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn+.btn {
    margin-left: 6px;
}

/* ----- Dialog (the Add/Edit form pop-up) ----- */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop.show {
    display: flex;
}

.modal {
    background: var(--card);
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px;
}

.modal h2 {
    margin: 0 0 16px;
    font-size: 1.3rem;
}

/* ----- Form fields ----- */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group .input {
    width: 100%;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
}

.input.has-error {
    border-color: #dc2626;
}

.field-error {
    display: block;
    min-height: 1em;
    margin-top: 4px;
    font-size: 0.82rem;
    color: #b91c1c;
}

.field-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-error-box {
    display: none;
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

.form-error-box.show {
    display: block;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

/* ----- Toast message (small notice at the bottom) ----- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 300;
    display: none;
    max-width: 90vw;
}

.toast.show {
    display: block;
}

.toast.error {
    background: #b91c1c;
}

@media (max-width: 480px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}