/*
 * B2B Portal styles.
 *
 * Goals:
 *   - Theme-agnostic but visually coherent. The host theme provides the
 *     page chrome; this file styles only elements inside our shortcodes.
 *   - Plain CSS — no preprocessors, no build step (Wedos hosting).
 *   - System font stack so the portal looks native on every OS.
 *
 * Naming: BEM-ish (.b2bp-portal, .b2bp-card, .b2bp-card__title).
 */

.b2bp-portal {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 16px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #1f2937;
    line-height: 1.5;
}

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

.b2bp-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    margin: 0 0 24px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.b2bp-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.b2bp-nav__item a {
    display: inline-block;
    padding: 6px 12px;
    color: #1d4ed8;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.12s ease;
}
.b2bp-nav__item a:hover { background: #eff6ff; }
.b2bp-nav__item.is-current a {
    background: #1d4ed8;
    color: #fff;
}
.b2bp-nav__actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.b2bp-nav__cart,
.b2bp-nav__logout {
    color: #4b5563;
    text-decoration: none;
    font-size: 14px;
}
.b2bp-nav__cart { font-weight: 600; color: #047857; }
.b2bp-nav__logout:hover,
.b2bp-nav__cart:hover { text-decoration: underline; }

/* ── Page headers / notices ─────────────────────────────────── */

.b2bp-page-header {
    margin: 0 0 24px;
}
.b2bp-page-title {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    color: #111827;
}
.b2bp-page-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 15px;
}

.b2bp-notice {
    margin: 0 0 20px;
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 4px solid;
    font-size: 14px;
}
.b2bp-notice--success { background: #ecfdf5; border-color: #10b981; color: #065f46; }
.b2bp-notice--error   { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.b2bp-notice--info    { background: #eff6ff; border-color: #3b82f6; color: #1e3a8a; }
.b2bp-notice ul { margin: 8px 0 0 20px; padding: 0; }
.b2bp-notice li { margin: 2px 0; }

.b2bp-empty {
    padding: 32px;
    text-align: center;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
    margin: 0;
}

/* ── Landing cards ──────────────────────────────────────────── */

.b2bp-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.b2bp-card {
    display: block;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.b2bp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    border-color: #cbd5e1;
}
.b2bp-card__icon {
    font-size: 28px;
    margin: 0 0 8px;
}
.b2bp-card__title {
    margin: 0 0 6px;
    font-size: 17px;
    color: #1d4ed8;
}
.b2bp-card__desc {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
}

/* ── Tables (catalog / history / invoices) ──────────────────── */

.b2bp-table-wrap {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.b2bp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.b2bp-table th,
.b2bp-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.b2bp-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}
.b2bp-table tbody tr:hover { background: #fafafa; }
.b2bp-table .b2bp-col-num { text-align: right; white-space: nowrap; }
.b2bp-table .b2bp-col-image img {
    max-width: 60px;
    height: auto;
    display: block;
    border-radius: 4px;
}
.b2bp-table .b2bp-col-sku code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.b2bp-table .b2bp-col-qty { width: 90px; }
.b2bp-table .b2bp-col-action { white-space: nowrap; text-align: right; }
.b2bp-row--oos      td { color: #9ca3af; }
.b2bp-row--overdue  td { background: #fef2f2; }

.b2bp-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.b2bp-pill--ok       { background: #d1fae5; color: #065f46; }
.b2bp-pill--oos      { background: #fee2e2; color: #991b1b; }
.b2bp-pill--status   { background: #e0e7ff; color: #3730a3; }
.b2bp-pill--paid     { background: #d1fae5; color: #065f46; }
.b2bp-pill--issued   { background: #e0e7ff; color: #3730a3; }
.b2bp-pill--overdue  { background: #fee2e2; color: #991b1b; }
.b2bp-pill--pending  { background: #fef3c7; color: #92400e; }

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

.b2bp-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 14px;
}
.b2bp-form-row label,
.b2bp-label {
    font-weight: 600;
    color: #374151;
    font-size: 13px;
}
.b2bp-input,
.b2bp-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.b2bp-input:focus,
.b2bp-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.b2bp-input--qty { width: 80px; padding: 4px 6px; text-align: center; }
.b2bp-textarea { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; }

.b2bp-fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 0 0 20px;
}
.b2bp-fieldset legend {
    padding: 0 6px;
    font-weight: 600;
    color: #374151;
}
.b2bp-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.b2bp-catalog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
}
.b2bp-catalog-filters input,
.b2bp-catalog-filters select { flex: 1 1 200px; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; }

.b2bp-help {
    margin-top: 16px;
    font-size: 13px;
    color: #6b7280;
}
.b2bp-help summary { cursor: pointer; font-weight: 600; color: #374151; }
.b2bp-help ul { margin: 8px 0 0 20px; padding: 0; }

.b2bp-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
}
.b2bp-pagination__pages { color: #6b7280; font-size: 14px; }

/* ── Buttons (theme-agnostic shim) ──────────────────────────── */

.b2bp-portal .button {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}
.b2bp-portal .button:hover { background: #f9fafb; border-color: #9ca3af; }
.b2bp-portal .button-primary {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}
.b2bp-portal .button-primary:hover { background: #1e40af; border-color: #1e40af; }

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

@media (max-width: 640px) {
    .b2bp-page-title { font-size: 22px; }
    .b2bp-nav { flex-direction: column; align-items: stretch; }
    .b2bp-table .b2bp-col-image { display: none; }
    .b2bp-cards { grid-template-columns: 1fr; }
}
