/* Estilos generales */
body {
    font-family: 'Roboto', sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
}

header {
    background-color: #343a40;
    color: white;
    padding: 20px;
    text-align: center;
    border-bottom: 3px solid #007bff;
}

nav a {
    color: white;
    margin: 0 15px;
    text-decoration: none;
    font-size: 16px;
}

nav a:hover {
    text-decoration: underline;
}

/* Contenedor principal */
.container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

/* Sección de estadísticas */
.statistics {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: wrap; /* Allow cards to stack on small screens */
}

.stat-card {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    width: 30%;
    min-width: 200px; /* Ensure cards don't get too small */
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 36px;
    color: #007bff;
}

/* Botones de acción rápida */
.quick-actions {
    display: flex;
    justify-content: space-around;
    width: 100%;
    flex-wrap: wrap;
}

.btn-quick-action {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    margin: 10px;
    transition: background-color 0.3s ease;
}

.btn-quick-action:hover {
    background-color: #0056b3;
}

/* Tabla de últimos productos */
.latest-products {
    width: 100%;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    overflow-x: auto;
}

.latest-products h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th, td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

th {
    background-color: #007bff;
    color: white;
}

td {
    background-color: white;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Botones mini */
.btn-mini {
    background-color: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.btn-mini:hover {
    background-color: #0056b3;
}

/* Styling for product image in table */
table td img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
}

/* Adjust padding and layout of table cells */
table td, table th {
    padding: 10px;
    text-align: center;
}

/* Search box styling */
#search-box {
    padding: 8px;
    width: 250px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* Styling for the barcode scanner video */
#scanner {
    display: none; /* Hide by default */
    margin-top: 10px;
}

#barcodeScanner {
    width: 100%; /* Make the video responsive */
    max-width: 400px;
    border: 1px solid black;
    border-radius: 5px;
}

/* For smaller screens (less than 768px wide) */
@media screen and (max-width: 768px) {
    /* Make table responsive by stacking */
    .container table,
    .container table thead,
    .container table tbody,
    .container table th,
    .container table td,
    .container table tr {
        display: block;
    }

    /* Hide the headers for small screens */
    .container table thead tr {
        display: none;
    }

    /* Style the table rows */
    .container table td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: left;
        font-size: 14px;
    }

    .container table td:before {
        position: absolute;
        top: 50%;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        content: attr(data-label); /* Dynamically show column names */
        font-weight: bold;
        transform: translateY(-50%);
    }

    #search-box {
        width: 100%;
        padding: 10px;
    }

    #scanBarcode {
        margin-top: 10px;
        width: 100%;
    }

    .quick-actions {
        flex-direction: column;
    }

    .stat-card {
        width: 100%;
        margin-bottom: 15px;
    }
}

/* Public demo refinement */
:root {
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --canvas: #f4f7fb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
}
* { box-sizing: border-box; }
body { background: var(--canvas); color: var(--ink); min-height: 100vh; }
.warehouse-header {
    background: linear-gradient(135deg, #111827, #1e3a5f);
    border: 0;
    padding: 42px clamp(20px, 5vw, 72px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 520px);
    gap: 32px;
    align-items: end;
    text-align: left;
}
.header-copy h1 { margin: 6px 0 8px; font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -.04em; }
.header-copy p { margin: 0; color: #cbd5e1; max-width: 650px; }
.eyebrow { color: #60a5fa; font-size: .72rem; letter-spacing: .16em; font-weight: 800; }
.header-tools { display: flex; align-items: end; gap: 10px; }
.search-control { flex: 1; color: #dbeafe; font-size: .78rem; font-weight: 700; }
.search-control span { display: block; margin-bottom: 7px; }
#search-box {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 9px;
    background: rgba(255,255,255,.1);
    color: #fff;
    outline: none;
}
#search-box::placeholder { color: #bfdbfe; }
#search-box:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96,165,250,.18); }
.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 9px 14px;
    font-size: .86rem;
    line-height: 1;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { color:#fff; background:var(--primary); }
.btn-primary:hover { background:var(--primary-dark); }
.btn-secondary { color:#fff; background:rgba(255,255,255,.12); border-color:rgba(255,255,255,.24); }
.btn-secondary:hover { background:rgba(255,255,255,.2); }
.container { max-width: 1380px; padding: 28px clamp(16px, 4vw, 44px) 56px; }
.inventory-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:18px; }
.inventory-stats article { background:var(--surface); border:1px solid var(--line); border-radius:12px; padding:18px 20px; box-shadow:0 8px 22px rgba(15,23,42,.04); }
.inventory-stats span { display:block; color:var(--muted); font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.07em; }
.inventory-stats strong { display:block; margin-top:6px; font-size:1.8rem; color:var(--ink); }
.inventory-panel { background:var(--surface); border:1px solid var(--line); border-radius:14px; overflow:hidden; box-shadow:0 12px 30px rgba(15,23,42,.05); }
.panel-heading { display:flex; justify-content:space-between; align-items:center; gap:18px; padding:20px 22px; border-bottom:1px solid var(--line); }
.panel-heading h2 { margin:4px 0 0; font-size:1.35rem; }
.table-wrap { width:100%; overflow-x:auto; }
.inventory-panel table { min-width:1040px; margin:0; }
.inventory-panel th { background:#f8fafc; color:#475569; border:0; border-bottom:1px solid var(--line); padding:13px 14px; font-size:.72rem; text-transform:uppercase; letter-spacing:.05em; }
.inventory-panel td { border:0; border-bottom:1px solid #eef2f7; padding:14px; color:#334155; vertical-align:middle; }
.inventory-panel tbody tr:hover td { background:#f8fbff; }
.inventory-panel code { color:#475569; background:#f1f5f9; padding:5px 7px; border-radius:6px; }
.stock-pill { display:inline-flex; min-width:50px; justify-content:center; padding:5px 9px; border-radius:999px; color:#166534; background:#dcfce7; font-weight:800; }
.row-actions { display:flex; gap:7px; justify-content:center; }
.btn-small { min-height:32px; padding:7px 10px; font-size:.76rem; }
.btn-edit { color:#1d4ed8; background:#eff6ff; border-color:#bfdbfe; }
.btn-edit:hover { background:#dbeafe; }
.btn-delete { color:#b91c1c; background:#fff1f2; border-color:#fecdd3; }
.btn-delete:hover { background:#ffe4e6; }
.empty-state { text-align:center !important; padding:48px 20px !important; color:var(--muted) !important; }
#scanner { grid-column:1 / -1; justify-self:end; }
#barcodeScanner { width:min(100%,420px); border:1px solid #60a5fa; border-radius:10px; }
@media (max-width: 820px) {
    .warehouse-header { grid-template-columns:1fr; padding-top:28px; }
    .header-tools { align-items:stretch; flex-direction:column; }
    #scanBarcode { width:100%; }
    .inventory-stats { grid-template-columns:1fr; }
    .container table, .container table thead, .container table tbody, .container table th, .container table td, .container table tr { display:revert; }
    .container table thead tr { display:table-row; }
    .container table td { padding:14px; text-align:center; }
    .container table td::before { content:none; }
}
/* Keep the wide inventory table inside its own scroll area on small screens. */
.inventory-panel { min-width: 0; max-width: 100%; }
.table-wrap { max-width: 100%; overflow-x: auto; }
@media (max-width: 600px) { .panel-heading { flex-wrap: wrap; gap: 12px; } }
