/**
 * LFC Stock B2B — Front-end portal stylesheet
 *
 * Uses custom properties so the active WP theme can override brand colours.
 * All portal elements are namespaced with `.lfc-portal` to avoid conflicts.
 */

:root {
    --lfc-primary:       #007cba;
    --lfc-primary-dark:  #005a87;
    --lfc-danger:        #d63638;
    --lfc-success:       #388e3c;
    --lfc-warn:          #e65100;
    --lfc-muted:         #666;
    --lfc-border:        #ddd;
    --lfc-bg-alt:        #f9f9f9;
    --lfc-radius:        6px;
    --lfc-shadow:        0 2px 8px rgba(0,0,0,.08);
    --lfc-transition:    0.18s ease;
}

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

.lfc-portal {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 40px;
    font-size: 15px;
    line-height: 1.55;
    color: #1d2327;
}

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

.lfc-portal__nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--lfc-border);
    margin-bottom: 24px;
    padding: 0;
}

.lfc-portal__tab {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--lfc-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    position: relative;
    transition: color var(--lfc-transition), border-color var(--lfc-transition);
}

.lfc-portal__tab:hover { color: var(--lfc-primary); }

.lfc-portal__tab--active {
    color: var(--lfc-primary);
    border-bottom-color: var(--lfc-primary);
}

.lfc-portal__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--lfc-warn);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

.lfc-portal__badge:empty { display: none; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.lfc-portal__toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.lfc-portal__search,
.lfc-portal__filter {
    padding: 8px 12px;
    border: 1px solid var(--lfc-border);
    border-radius: var(--lfc-radius);
    font-size: 14px;
    min-width: 200px;
}

.lfc-portal__search { flex: 1; max-width: 360px; }

/* ── Notice banner ───────────────────────────────────────────────────────── */

.lfc-portal__notice {
    padding: 10px 16px;
    border-radius: var(--lfc-radius);
    margin-bottom: 20px;
    font-weight: 500;
    border-left: 4px solid var(--lfc-primary);
    background: #e7f5fd;
    color: #003a6b;
}

.lfc-portal__notice--error {
    border-left-color: var(--lfc-danger);
    background: #fdf2f2;
    color: #7b0000;
}

.lfc-portal__notice--success {
    border-left-color: var(--lfc-success);
    background: #edfaed;
    color: #1b4d1c;
}

/* ── Product grid ────────────────────────────────────────────────────────── */

.lfc-portal__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.lfc-product-card {
    background: #fff;
    border: 1px solid var(--lfc-border);
    border-radius: var(--lfc-radius);
    box-shadow: var(--lfc-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--lfc-transition);
}

.lfc-product-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }

.lfc-product-card__img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: var(--lfc-bg-alt);
}

.lfc-product-card__body {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lfc-product-card__name {
    font-weight: 700;
    font-size: 14px;
    margin: 0;
}

.lfc-product-card__sku {
    font-size: 12px;
    color: var(--lfc-muted);
}

.lfc-product-card__attrs {
    font-size: 12px;
    color: var(--lfc-muted);
    margin: 0;
}

.lfc-product-card__prices {
    font-size: 13px;
    margin-top: 4px;
}

.lfc-product-card__price-b2b {
    font-weight: 700;
    color: var(--lfc-primary);
    font-size: 16px;
}

.lfc-product-card__price-pvp {
    color: var(--lfc-muted);
    text-decoration: line-through;
    margin-left: 6px;
    font-size: 12px;
}

.lfc-product-card__stock {
    font-size: 12px;
    margin-top: 4px;
}

.lfc-product-card__stock--ok   { color: var(--lfc-success); }
.lfc-product-card__stock--warn { color: var(--lfc-warn); }
.lfc-product-card__stock--none { color: var(--lfc-muted); }

.lfc-product-card__actions {
    padding: 10px 14px;
    border-top: 1px solid var(--lfc-border);
    background: var(--lfc-bg-alt);
}

/* ── Request list ────────────────────────────────────────────────────────── */

.lfc-portal__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lfc-request-row {
    background: #fff;
    border: 1px solid var(--lfc-border);
    border-radius: var(--lfc-radius);
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
    align-items: start;
}

.lfc-request-row__info { grid-column: 1; }
.lfc-request-row__actions { grid-column: 2; display: flex; gap: 8px; align-items: center; }

.lfc-request-row__product {
    font-weight: 700;
    margin: 0 0 4px;
}

.lfc-request-row__meta {
    font-size: 13px;
    color: var(--lfc-muted);
    margin: 0;
}

/* ── Status badges ───────────────────────────────────────────────────────── */

.lfc-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* request statuses */
.lfc-badge--pending   { background: #fff3cd; color: #856404; }
.lfc-badge--partial   { background: #d1ecf1; color: #0c5460; }
.lfc-badge--fulfilled { background: #d4edda; color: #155724; }
.lfc-badge--cancelled { background: #e2e3e5; color: #383d41; }
.lfc-badge--delivered { background: #cfe2ff; color: #084298; }
.lfc-badge--received  { background: #d1e7dd; color: #0a3622; }
.lfc-badge--returned  { background: #f8d7da; color: #842029; }
.lfc-badge--rejected  { background: #e2e3e5; color: #383d41; }

/* sale report statuses */
.lfc-badge--reviewed  { background: #cfe2ff; color: #084298; }
.lfc-badge--invoiced  { background: #d1e7dd; color: #0a3622; }

/* invoice statuses */
.lfc-badge--draft     { background: #e2e3e5; color: #383d41; }
.lfc-badge--sent      { background: #d1ecf1; color: #0c5460; }
.lfc-badge--paid      { background: #d4edda; color: #155724; }

/* retire badge */
.lfc-badge--retire    { background: #fff3e0; color: #e65100; }

/* ── Submitted reports card list ─────────────────────────────────────────── */

.lfc-report-card__header { margin: 0 0 10px; }

.lfc-report-card__items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lfc-report-card__item {
    font-size: 14px;
    line-height: 1.5;
}

.lfc-report-card__item-name { font-weight: 600; }

.lfc-report-card__note {
    color: var(--lfc-muted);
    font-style: italic;
}

.lfc-report-card__overall-note {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--lfc-muted);
    font-style: italic;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */

.lfc-portal__pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.lfc-portal__pagination button {
    padding: 6px 12px;
    border: 1px solid var(--lfc-border);
    border-radius: var(--lfc-radius);
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: background var(--lfc-transition);
}

.lfc-portal__pagination button:hover   { background: var(--lfc-bg-alt); }
.lfc-portal__pagination button.active  { background: var(--lfc-primary); color: #fff; border-color: var(--lfc-primary); }
.lfc-portal__pagination button:disabled { opacity: 0.4; cursor: default; }

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

.lfc-portal__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--lfc-radius);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--lfc-transition), opacity var(--lfc-transition);
}

.lfc-portal__btn--primary  { background: var(--lfc-primary); color: #fff; }
.lfc-portal__btn--primary:hover { background: var(--lfc-primary-dark); color: #fff; }

.lfc-portal__btn--danger   { background: var(--lfc-danger);  color: #fff; }
.lfc-portal__btn--danger:hover { opacity: 0.85; }

.lfc-portal__btn--ghost    { background: transparent; color: var(--lfc-muted); border: 1px solid var(--lfc-border); }
.lfc-portal__btn--ghost:hover  { background: var(--lfc-bg-alt); }

.lfc-portal__btn--sm { padding: 5px 10px; font-size: 13px; }

.lfc-portal__btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Modal ───────────────────────────────────────────────────────────────── */

.lfc-portal__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9998;
}

.lfc-portal__modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: #fff;
    border-radius: var(--lfc-radius);
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    width: min(520px, 96vw);
    max-height: 90vh;
    overflow-y: auto;
}

.lfc-portal__modal-inner {
    padding: 28px 32px;
    position: relative;
}

.lfc-portal__modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--lfc-muted);
    line-height: 1;
}

.lfc-portal__modal-title {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 700;
}

/* ── Form ────────────────────────────────────────────────────────────────── */

.lfc-portal__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lfc-portal__field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}

.lfc-portal__field input,
.lfc-portal__field select,
.lfc-portal__field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--lfc-border);
    border-radius: var(--lfc-radius);
    font-size: 14px;
    box-sizing: border-box;
}

.lfc-portal__field input:focus,
.lfc-portal__field select:focus,
.lfc-portal__field textarea:focus {
    outline: 2px solid var(--lfc-primary);
    outline-offset: 1px;
    border-color: var(--lfc-primary);
}

.lfc-portal__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.lfc-portal__price-preview {
    font-size: 13px;
    color: var(--lfc-muted);
    margin: 0;
}

.lfc-portal__form-error {
    background: #fdf2f2;
    border-left: 3px solid var(--lfc-danger);
    padding: 8px 12px;
    border-radius: var(--lfc-radius);
    font-size: 13px;
    color: #7b0000;
}

/* ── States ──────────────────────────────────────────────────────────────── */

.lfc-portal__loading {
    color: var(--lfc-muted);
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}

.lfc-portal__empty {
    text-align: center;
    padding: 40px 0;
    color: var(--lfc-muted);
}

/* ── Login form ──────────────────────────────────────────────────────────── */

.lfc-portal--login {
    max-width: 400px;
}

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

@media (max-width: 640px) {
    .lfc-portal__grid {
        grid-template-columns: 1fr 1fr;
    }

    .lfc-request-row {
        grid-template-columns: 1fr;
    }

    .lfc-request-row__actions {
        grid-column: 1;
    }

    .lfc-portal__modal-inner {
        padding: 20px 16px;
    }
}

@media (max-width: 420px) {
    .lfc-portal__grid { grid-template-columns: 1fr; }
}
