/* Socialudo Stock Management System — Base Styles
   Lightweight, mobile-first. Uses system fonts and minimal custom CSS.
   Pico-inspired approach: semantic HTML, minimal classes. */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

/* ── Layout ─────────────────────────────────────────────────────── */

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.container-narrow {
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
}

/* ── Cards ──────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ── Breadcrumb ─────────────────────────────────────────────────── */

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    margin: 0 0.25rem;
}

/* ── Buttons ────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ── Forms ──────────────────────────────────────────────────────── */

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text);
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ── Tables ─────────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg);
}

tr:hover {
    background: #f1f5f9;
}

/* ── Stock-specific ─────────────────────────────────────────────── */

.stock-qty {
    font-weight: 700;
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
}

.stock-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.quick-adjust {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.quick-adjust .btn {
    min-width: 2rem;
    padding: 0.3rem;
    font-size: 1rem;
    font-weight: 700;
}

/* ── Preset note buttons ────────────────────────────────────────── */

.note-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.note-preset {
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    font-size: 0.8rem;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.15s;
}

.note-preset:hover,
.note-preset.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ── Alerts / Badges ────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #f1f5f9; color: #475569; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Activity feed ──────────────────────────────────────────────── */

.activity-feed {
    list-style: none;
}

.activity-feed li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.activity-feed li:last-child {
    border-bottom: none;
}

.activity-feed .timestamp {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ── Tree view (location hierarchy) ─────────────────────────────── */

.tree {
    list-style: none;
    padding-left: 0;
}

.tree .tree {
    padding-left: 1.25rem;
    border-left: 2px solid var(--border);
    margin-left: 0.5rem;
}

.tree li {
    padding: 0.35rem 0;
}

.tree .node-name {
    font-weight: 500;
}

.tree .stock-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 0.35rem;
}

/* ── Navigation / Header ────────────────────────────────────────── */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar .logo {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
}

.topbar nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
}

.topbar nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
}

.topbar nav a:hover,
.topbar nav a.active {
    color: var(--primary);
    background: #eff6ff;
}

/* ── Admin sidebar (desktop) ────────────────────────────────────── */

.admin-layout {
    display: flex;
    min-height: calc(100vh - 49px);
}

.admin-sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
    flex-shrink: 0;
}

.admin-sidebar a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: #eff6ff;
    color: var(--primary);
}

.admin-sidebar .section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.75rem 1rem 0.25rem;
    font-weight: 600;
}

.admin-content {
    flex: 1;
    padding: 1.5rem;
    min-width: 0;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .admin-sidebar {
        display: none;
    }

    .admin-content {
        padding: 1rem;
    }

    .topbar {
        flex-wrap: wrap;
    }

    .btn {
        padding: 0.6rem 1rem;
    }

    th, td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* ── Utility ────────────────────────────────────────────────────── */

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.hidden { display: none; }
