/* ===========================
   Inventory Page — shadcn UI
   =========================== */

/* Inventory Banner */
.inventory-banner {
    background: var(--card, #0a0a0c);
    border: 1px solid var(--border, #27272a);
    border-radius: var(--radius, 0.5rem);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary, #ed1a3b);
}

.inventory-banner h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.inventory-banner p {
    font-size: 0.8125rem;
    color: var(--muted-foreground, #a1a1aa);
}

/* Inventory Table */
.inventory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.inventory-table thead th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted-foreground, #a1a1aa);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border, #27272a);
    background: var(--muted, #27272a);
    white-space: nowrap;
}

.inventory-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border, #27272a);
    color: var(--foreground, #fafafa);
    vertical-align: middle;
}

.inventory-table tbody tr:hover {
    background: rgba(237, 26, 59, 0.04);
}

/* Editable Cells */
.editable-cell {
    cursor: pointer;
    position: relative;
    transition: var(--transition, all 0.15s ease);
    padding: 0.375rem 0.5rem;
}

.editable-cell:hover {
    background: rgba(237, 26, 59, 0.06);
    border-radius: calc(var(--radius, 0.5rem) / 2);
}

.editable-cell input {
    width: 100%;
    max-width: 100px;
    padding: 0.25rem 0.5rem;
    background: var(--background, #09090b);
    border: 1px solid var(--ring, #ed1a3b);
    border-radius: calc(var(--radius, 0.5rem) / 2);
    color: var(--foreground, #fafafa);
    font-size: 0.8125rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    box-shadow: 0 0 0 2px rgba(237, 26, 59, 0.2);
}

/* Stock Badges */
.stock-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    border-radius: calc(var(--radius, 0.5rem) * 10);
    font-size: 0.6875rem;
    font-weight: 600;
}

.stock-badge.in-stock {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.stock-badge.low-stock {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.stock-badge.out-of-stock {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

/* Inventory Stats */
.inventory-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card, #0a0a0c);
    border: 1px solid var(--border, #27272a);
    border-radius: var(--radius, 0.5rem);
    padding: 1rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground, #fafafa);
}

.stat-card .stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--muted-foreground, #a1a1aa);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
    .inventory-stats {
        grid-template-columns: 1fr 1fr;
    }

    .inventory-table {
        font-size: 0.75rem;
    }

    .inventory-table thead th,
    .inventory-table tbody td {
        padding: 0.375rem 0.5rem;
    }
}

/* ===========================
   Warning Banner — Blink & Emphasis
   =========================== */
.warning-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    border-radius: var(--radius, 0.5rem);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: #92400e;
    font-size: 0.875rem;
    text-align: center;
    animation: warningBlink 1.5s ease-in-out infinite;
}

@keyframes warningBlink {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }

    50% {
        opacity: 0.85;
        box-shadow: 0 0 12px 4px rgba(245, 158, 11, 0.4);
    }
}

/* ===========================
   Modal Centering Fix
   =========================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active,
.modal[style*="display: flex"] {
    display: flex !important;
}

.modal-content {
    background: var(--card, #ffffff);
    border: 1px solid var(--border, #e4e4e7);
    border-radius: var(--radius, 0.5rem);
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

/* ===========================
   Data Table — Proper Spacing
   =========================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.data-table thead th {
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted-foreground, #71717a);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border, #e4e4e7);
    background: var(--muted, #f4f4f5);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border, #e4e4e7);
    color: var(--foreground, #09090b);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(237, 26, 59, 0.04);
}

/* ===========================
   Actions Section — Button Layout
   =========================== */
.actions-section {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
/* Take Material: one clear, mutually exclusive purpose. */
#takeModal .modal-content { max-width: 620px; }
#takeForm { display: grid; gap: 18px; margin-top: 20px; }
#takeForm .form-group { margin: 0; }
#takeForm .form-group label { display: block; margin-bottom: 7px; }
.take-purpose { border: 0; padding: 0; margin: 0; min-width: 0; }
.take-purpose legend { font-weight: 600; margin-bottom: 10px; font-size: 14px; }
.take-purpose-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
#takeForm .take-purpose-option { display: flex; align-items: flex-start; gap: 8px; padding: 14px 10px; border: 1px solid var(--border, #27272a); border-radius: 10px; cursor: pointer; margin: 0; background: var(--background, #09090b); }
#takeForm .take-purpose-option input { width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 16px; accent-color: #ed1a3b; }
.take-purpose-option strong { display: block; font-size: 13px; }
.take-purpose-option small { display: block; font-size: 11px; line-height: 1.5; font-weight: 400; margin-top: 5px; color: var(--muted-foreground, #a1a1aa); }
#takeForm .take-purpose-option:has(input:checked) { border-color: #ed1a3b; background: rgba(237,26,59,.09); box-shadow: 0 0 0 1px #ed1a3b; }
.take-purpose-option:focus-within { outline: 2px solid var(--foreground, #fafafa); outline-offset: 3px; }
.take-purpose-help { color: var(--muted-foreground, #a1a1aa); font-size: 12px; line-height: 1.6; margin: 0; }
#collectionFields { grid-template-columns: 1fr 1fr; gap: 14px; }
#takeForm .take-confirm { width: 100%; padding: 14px; background: #ed1a3b; color: white; border: 0; font-weight: 600; }
#collectionFilter { background: var(--background, #09090b); color: var(--foreground, #fafafa); border: 1px solid var(--border, #27272a); border-radius: 6px; padding: 9px 12px; margin: 12px 8px 16px 0; }
@media (max-width: 480px) {
    .take-purpose-options { grid-template-columns: 1fr; }
    #takeForm .take-purpose-option { padding: 12px; }
    .take-purpose-option span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
    .take-purpose-option small { margin: 0; }
    #collectionFields { grid-template-columns: 1fr; }
}
