/* ============================================================================
   B2B Trade Ordering Portal - main stylesheet
   ============================================================================ */

:root {
    --c-primary: #1f4e79;
    --c-primary-dark: #15406b;
    --c-accent: #e8a33d;
    --c-bg: #f6f7f9;
    --c-surface: #ffffff;
    --c-text: #1f2933;
    --c-muted: #6b7280;
    --c-border: #e2e5ea;
    --c-success: #2e8b57;
    --c-error: #c0392b;
    --c-warning: #d68910;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 6px 20px rgba(0,0,0,0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.5;
    font-size: 14px;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.container-fluid { max-width: 100%; padding: 0 16px; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); margin: 12px 0; }
.alert.success { background: #e6f6ec; color: var(--c-success); border:1px solid #c5e7d1; }
.alert.error { background: #fbe9e7; color: var(--c-error); border:1px solid #f3c9c4; }
.alert.info { background: #e8f1fb; color: var(--c-primary); border:1px solid #c9def0; }

/* Buttons */
.btn {
    display: inline-block; padding: 8px 14px; border: none; border-radius: var(--radius);
    background: var(--c-primary); color: #fff; cursor: pointer; font-size: 14px;
    text-decoration: none; transition: background .15s;
}
.btn:hover { background: var(--c-primary-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--c-primary); border:1px solid var(--c-border); }
.btn.secondary:hover { background: #f0f3f8; }
.btn.danger { background: var(--c-error); }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.block { display: block; width: 100%; }

/* Forms */
label { display:block; margin: 10px 0 4px; font-weight: 600; font-size:13px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
    width: 100%; padding: 8px 10px; border:1px solid var(--c-border); border-radius: var(--radius);
    font-size: 14px; background: #fff;
}
textarea { min-height: 80px; }
.field-error { color: var(--c-error); font-size: 12px; margin-top: 3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* Topbar (customer) */
.topbar { background: var(--c-primary); color: #fff; box-shadow: var(--shadow); }
.topbar a { color: #fff; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.topbar .brand { font-weight: 700; font-size: 16px; color:#fff; }
.topnav a { margin-left: 16px; font-size: 14px; }
.topnav a:hover { color: #ffd; text-decoration: none; }

.main-content { padding: 20px 16px 60px; min-height: 70vh; }

.footer { background: #1f2933; color: #cbd2d9; padding: 16px 0; text-align: center; }
.footer a { color: #cbd2d9; }

/* Hero / banners */
.hero { border-radius: 8px; overflow: hidden; margin: 12px 0; }
.hero img { width: 100%; display: block; }

/* Section heading */
.section { margin: 24px 0; }
.section h2 { font-size: 18px; color: var(--c-primary); margin: 0 0 12px; }
.section-head { display:flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head h2 { margin: 0; }

/* Product grid */
.product-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px;
}
.product-card {
    background: var(--c-surface); border:1px solid var(--c-border); border-radius: var(--radius);
    padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.product-card img { width: 100%; height: 140px; object-fit: cover; background:#f0f3f8; border-radius:4px; }
.product-card h3 { font-size: 14px; margin: 8px 0 4px; }
.product-card .sku { color: var(--c-muted); font-size: 12px; }
.product-card .price { font-weight: 700; color: var(--c-primary); margin-top: 6px; }
.product-card .price-strike { color: var(--c-muted); text-decoration: line-through; margin-right:6px; font-weight: 400; }
.product-card .stock-in { color: var(--c-success); font-size: 12px; }
.product-card .stock-out { color: var(--c-error); font-size: 12px; }
.product-card .special-badge {
    background: var(--c-accent); color:#fff; font-size:10px; padding:2px 6px; border-radius:3px;
    display: inline-block; margin-bottom: 4px;
}
.product-card form { margin-top: auto; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; background: #fff; box-shadow: var(--shadow); border-radius: var(--radius); overflow:hidden; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom:1px solid var(--c-border); font-size: 13px; }
table.data th { background: #f0f3f8; font-weight: 600; color: var(--c-primary); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbfc; }

/* Badges */
.badge { display:inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.draft { background:#e2e5ea; color:#444; }
.badge.published { background:#e6f6ec; color: var(--c-success); }
.badge.hidden { background:#fbe9e7; color: var(--c-error); }
.badge.archived { background:#f0e6d6; color: #8a6d3b; }
.badge.discontinued { background:#ddd; color:#555; }
.badge.pending { background:#fdf3d1; color:#8a6d3b; }
.badge.approved { background:#e6f6ec; color: var(--c-success); }
.badge.rejected { background:#fbe9e7; color: var(--c-error); }
.badge.submitted { background:#e8f1fb; color: var(--c-primary); }
.badge.approved { background:#e6f6ec; color: var(--c-success); }
.badge.picking, .badge.packed { background:#fdf3d1; color:#8a6d3b; }
.badge.dispatched { background:#e8f1fb; color: var(--c-primary); }
.badge.delivered { background:#e6f6ec; color: var(--c-success); }
.badge.on_hold { background:#fbe9e7; color: var(--c-error); }
.badge.cancelled { background:#fbe9e7; color: var(--c-error); }

/* Auth layout */
.layout-auth {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--c-primary) 0%, #15406b 100%);
}
.auth-card {
    background:#fff; padding: 28px 32px; border-radius: 8px; width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-card .brand { display:block; text-align:center; font-weight: 700; font-size: 18px; color: var(--c-primary); margin-bottom: 16px; }
.auth-card .alt-link { text-align:center; margin-top: 14px; font-size: 13px; }

/* Cards */
.card { background:#fff; border:1px solid var(--c-border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; color: var(--c-primary); }
.card.flush { padding: 0; overflow: hidden; }

.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
.grid-3 { display:grid; grid-template-columns: repeat(3, 1fr); gap:16px; }
.grid-4 { display:grid; grid-template-columns: repeat(4, 1fr); gap:16px; }
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4, .form-row { grid-template-columns: 1fr; }
}

/* KPI tiles */
.kpi { background:#fff; padding: 16px; border-radius: var(--radius); border:1px solid var(--c-border); }
.kpi .label { color: var(--c-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font-size: 26px; font-weight: 700; color: var(--c-primary); }

/* Pagination */
.pagination { margin: 16px 0; text-align: center; }
.pagination a, .pagination span { padding: 4px 10px; border:1px solid var(--c-border); border-radius: 4px; margin: 0 2px; }
.pagination .current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* Misc */
.muted { color: var(--c-muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.spacer { height: 16px; }
.flex-between { display:flex; justify-content: space-between; align-items: center; }