/* Vape Forest Stock Manager — mobile-first, no framework */

:root {
    --bg: #f5f7fa;
    --card: #ffffff;
    --ink: #0f172a;
    --ink-soft: #475569;
    --ink-faint: #94a3b8;
    --line: #e2e8f0;
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --danger: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --shadow: 0 1px 2px rgba(15,23,42,0.06), 0 4px 12px rgba(15,23,42,0.04);
    --radius: 14px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Top bar */
.topbar {
    background: #0f172a;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
}
.brand span {
    color: #38bdf8;
    font-weight: 500;
    margin-left: 4px;
}
.topbar nav {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}
.topbar .who { color: #cbd5e1; }
.topbar .logout {
    color: #fff;
    text-decoration: none;
    background: rgba(255,255,255,0.08);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    transition: background 0.15s;
}
.topbar .logout:active { background: rgba(255,255,255,0.18); }

main {
    flex: 1;
    padding: 16px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

footer.footer {
    text-align: center;
    color: var(--ink-faint);
    padding: 24px 16px;
    font-size: 12px;
}

/* Headings */
h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
.muted { color: var(--ink-soft); margin: 0 0 18px; }
.small { font-size: 13px; }

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin: 0 auto;
    max-width: 420px;
}
.auth-card { margin-top: 32px; }
.auth-card h1 { margin-bottom: 4px; }

/* Form */
form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin: 14px 0 6px;
}
form input[type=text],
form input[type=password],
form input[type=number] {
    -webkit-appearance: none;
    width: 100%;
    padding: 14px 14px;
    font-size: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}
form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}

.btn {
    display: inline-block;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s, transform 0.05s;
    min-height: 48px;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:active { background: var(--primary-dark); transform: translateY(1px); }
.btn-primary:disabled { background: var(--ink-faint); cursor: wait; }
.btn-block { width: 100%; margin-top: 18px; }

/* Alerts */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin: 12px 0;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

/* Dashboard product list */
.dashboard h1 { margin-bottom: 4px; }
.product-list, .variation-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.product-item {
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    display: flex;
    align-items: stretch;
    overflow: hidden;
    transition: transform 0.05s;
}
.product-item:active { transform: scale(0.99); }
.product-link {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 12px;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}
.product-thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    background: #f1f5f9;
    flex: 0 0 64px;
    border: 1px solid var(--line);
}
.product-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--ink-faint);
}
.product-body { flex: 1; min-width: 0; }
.product-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 6px;
}
.product-meta {
    font-size: 13px;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.dot { color: var(--ink-faint); }
.instock { color: #047857; font-weight: 500; }
.oos { color: var(--danger); font-weight: 500; }
.status-tag {
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.chev {
    color: var(--ink-faint);
    font-size: 22px;
    align-self: center;
    padding: 0 16px;
    user-select: none;
}

/* Empty state */
.empty {
    background: #fff;
    border: 1px dashed var(--line);
    padding: 28px 18px;
    border-radius: var(--radius);
    text-align: center;
    color: var(--ink-soft);
}

/* Product detail */
.back-row { margin-bottom: 12px; }
.back {
    display: inline-block;
    padding: 6px 0;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 14px;
}
.back:active { color: var(--primary); }

.product h1 {
    font-size: 20px;
    line-height: 1.3;
    margin-bottom: 4px;
}
.product-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding: 12px;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.product-hero {
    width: 96px;
    height: 96px;
    border-radius: 10px;
    object-fit: cover;
    background: #f1f5f9;
    flex: 0 0 96px;
    border: 1px solid var(--line);
}
.product-hero--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    color: var(--ink-faint);
}
.product-header-text { flex: 1; min-width: 0; }
.product-header-text h1 { margin: 0 0 4px; }
.product-header-text .muted { margin: 0; }

.variation-item {
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 14px 16px;
}
.var-header { margin-bottom: 10px; }
.var-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
}
.var-meta {
    font-size: 12px;
    color: var(--ink-faint);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.var-meta .sku { font-family: ui-monospace, monospace; }

/* Quantity row: +/- buttons + input */
.qty-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.qty-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #f8fafc;
    font-size: 22px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    transition: background 0.1s, transform 0.05s;
}
.qty-btn:active { background: #e2e8f0; transform: scale(0.95); }
.qty-input {
    flex: 1;
    text-align: center;
    font-size: 18px !important;
    font-weight: 600;
    padding: 12px !important;
    height: 48px;
}

/* Sticky save bar */
.save-bar {
    position: sticky;
    bottom: env(safe-area-inset-bottom, 0);
    margin: 16px -16px -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(245,247,250,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
}
.save-bar .btn-block { margin-top: 0; }

/* Tablet & up */
@media (min-width: 720px) {
    main { padding: 28px; }
    h1 { font-size: 26px; }
    .product-link { padding: 14px 18px; }
    .variation-item { padding: 16px 20px; }
    .product-thumb { width: 72px; height: 72px; flex-basis: 72px; }
    .product-hero { width: 120px; height: 120px; flex-basis: 120px; }
}
