/* B2B Portal Styles */
:root {
    --b2b-primary: #1a5276;
    --b2b-primary-hover: #154360;
    --b2b-accent: #1a7a4a;
    --b2b-bg: #f4f6f8;
    --b2b-card: #ffffff;
    --b2b-border: #d5d8dc;
    --b2b-text: #1c2833;
    --b2b-muted: #5d6d7e;
    --b2b-success: #1e8449;
    --b2b-danger: #c0392b;
    --b2b-warning: #b7950b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--b2b-bg);
    color: var(--b2b-text);
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────── */
.b2b-header {
    background: var(--b2b-primary);
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.b2b-header__logo {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.b2b-header__badge {
    background: rgba(255,255,255,0.2);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.b2b-header__nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.b2b-header__nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.b2b-header__nav a:hover { color: #fff; }

.b2b-header__user {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
}

/* ── Auth Pages ─────────────────────────────────────────────────── */
.b2b-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #1a5276 0%, #1a7a4a 100%);
}

.b2b-auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.b2b-auth-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--b2b-primary);
    margin-bottom: 6px;
}

.b2b-auth-card .subtitle {
    color: var(--b2b-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

.b2b-auth-card .logo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.b2b-auth-card .logo-row img {
    height: 36px;
}

/* ── Form Elements ──────────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--b2b-text);
    margin-bottom: 6px;
}

.form-group label .required { color: var(--b2b-danger); margin-left: 2px; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--b2b-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--b2b-text);
    background: #fff;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--b2b-primary);
    box-shadow: 0 0 0 3px rgba(26,82,118,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--b2b-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 24px 0 14px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--b2b-border);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: var(--b2b-primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--b2b-primary-hover); }

.btn-success {
    background: var(--b2b-success);
    color: #fff;
}
.btn-success:hover:not(:disabled) { background: #176638; }

.btn-secondary {
    background: #eaecf0;
    color: var(--b2b-text);
}
.btn-secondary:hover:not(:disabled) { background: #d5d8dc; }

.btn-danger {
    background: var(--b2b-danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #a93226; }

.btn-full { width: 100%; }

/* ── Alert Messages ─────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 18px;
    display: none;
}
.alert.show { display: block; }
.alert-error { background: #fdf2f2; border: 1px solid #f5c6cb; color: #721c24; }
.alert-success { background: #f0fdf4; border: 1px solid #b2dfdb; color: #1e4d2b; }
.alert-info { background: #ebf5fb; border: 1px solid #bee3f8; color: #154360; }
.alert-warning { background: #fefce8; border: 1px solid #fde68a; color: #7c6a00; }

/* ── B2B Shop Layout ─────────────────────────────────────────────── */
.b2b-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 60px);
}

.b2b-sidebar {
    background: #fff;
    border-right: 1px solid var(--b2b-border);
    padding: 24px 0;
}

.b2b-sidebar__section {
    padding: 0 16px;
    margin-bottom: 24px;
}

.b2b-sidebar__title {
    font-size: 11px;
    font-weight: 700;
    color: var(--b2b-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 8px;
    margin-bottom: 8px;
}

.b2b-sidebar__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--b2b-text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.b2b-sidebar__link:hover { background: var(--b2b-bg); }
.b2b-sidebar__link.active { background: #dbeafe; color: var(--b2b-primary); font-weight: 600; }

.b2b-sidebar__sublink {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 32px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--b2b-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}
.b2b-sidebar__sublink:hover { background: var(--b2b-bg); color: var(--b2b-text); }

.b2b-main {
    padding: 28px;
    overflow-y: auto;
}
.b2b-main--has-cart {
    padding-right: 380px; /* 340px Warenkorb + 40px Abstand */
}

.b2b-main__title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--b2b-text);
}

/* ── Product Grid ────────────────────────────────────────────────── */
.b2b-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.b2b-search-bar input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid var(--b2b-border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.b2b-search-bar input:focus { border-color: var(--b2b-primary); }

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

.b2b-product-card {
    background: #fff;
    border: 1px solid var(--b2b-border);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.b2b-product-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.b2b-product-card__img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background: #f8f9fa;
    padding: 12px;
}

.b2b-product-card__body {
    padding: 14px;
}

.b2b-product-card__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--b2b-text);
    margin-bottom: 4px;
    line-height: 1.4;
}

.b2b-product-card__category {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--b2b-primary);
    margin-bottom: 3px;
}

.b2b-product-card__manufacturer {
    font-size: 12px;
    color: var(--b2b-muted);
    margin-bottom: 6px;
}

.b2b-product-card__pzn {
    font-size: 11px;
    color: var(--b2b-muted);
    font-family: monospace;
    margin-bottom: 8px;
}

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

.b2b-product-card__price-label {
    font-size: 11px;
    color: var(--b2b-muted);
    margin-bottom: 12px;
}

.b2b-aep-discount {
    font-size: 12px;
    font-weight: 600;
    color: #1eb674;
    background: #f0fdf4;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* ── Cart Sidebar ────────────────────────────────────────────────── */
.b2b-cart {
    position: fixed;
    top: 60px;
    right: 0;
    width: 340px;
    height: calc(100vh - 60px);
    background: #fff;
    border-left: 1px solid var(--b2b-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: -4px 0 16px rgba(0,0,0,0.06);
}

.b2b-cart__close,
.b2b-mobile-cart-toggle,
.b2b-cart-overlay {
    display: none;
}

.b2b-cart__header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--b2b-border);
    font-weight: 700;
    font-size: 16px;
}

.b2b-cart__items {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.b2b-cart__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.b2b-cart__item-name { font-size: 13px; font-weight: 600; flex: 1; }
.b2b-cart__item-details { font-size: 12px; color: var(--b2b-muted); }

.b2b-cart__item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.b2b-cart__item-qty button {
    width: 24px;
    height: 24px;
    border: 1px solid var(--b2b-border);
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.b2b-cart__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--b2b-border);
}

.b2b-cart__total {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
}

.b2b-cart__vat-note {
    font-size: 11px;
    color: var(--b2b-muted);
    margin-top: 6px;
    margin-bottom: 14px;
}

/* ── Status Badge ────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-pending  { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-suspended{ background: #e5e7eb; color: #374151; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body.b2b-cart-open {
        overflow: hidden;
    }

    .b2b-header {
        height: auto;
        min-height: 60px;
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
        align-items: flex-start;
    }

    .b2b-header__nav {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }

    .b2b-layout {
        grid-template-columns: 1fr;
    }

    .b2b-sidebar {
        display: none;
    }

    .b2b-main {
        padding: 20px 16px 96px;
        overflow: visible;
    }
    .b2b-main--has-cart {
        padding-right: 16px; /* Kein extra Platz für Cart auf Mobile */
    }


    .b2b-search-bar {
        flex-direction: column;
    }

    .b2b-products-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 16px;
    }

    .b2b-cart {
        width: 100%;
        top: auto;
        bottom: 0;
        height: min(78vh, 560px);
        border-left: none;
        border-top: 2px solid var(--b2b-border);
        border-radius: 18px 18px 0 0;
        transform: translateY(calc(100% + 16px));
        transition: transform 0.22s ease;
        z-index: 151;
    }

    .b2b-cart.is-open {
        transform: translateY(0);
    }

    .b2b-cart__header {
        padding-right: 56px;
    }

    .b2b-cart__close {
        display: inline-flex;
        position: absolute;
        top: 14px;
        right: 16px;
        width: 36px;
        height: 36px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--b2b-border);
        border-radius: 999px;
        background: #fff;
        color: var(--b2b-text);
        font-size: 20px;
        cursor: pointer;
        z-index: 1;
    }

    .b2b-cart-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(28, 40, 51, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
        z-index: 150;
    }

    .b2b-cart-overlay.is-active {
        opacity: 1;
        pointer-events: auto;
    }

    .b2b-mobile-cart-toggle {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        right: 16px;
        bottom: 16px;
        border: none;
        border-radius: 999px;
        background: var(--b2b-primary);
        color: #fff;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 700;
        box-shadow: 0 14px 28px rgba(26, 82, 118, 0.28);
        z-index: 152;
        cursor: pointer;
    }

    .b2b-mobile-cart-toggle__count {
        min-width: 24px;
        height: 24px;
        padding: 0 8px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.16);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    .b2b-auth-card {
        padding: 28px 20px;
    }
}

/* ── Account page ────────────────────────────────────────────────── */
.b2b-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.b2b-info-card {
    background: #fff;
    border: 1px solid var(--b2b-border);
    border-radius: 10px;
    padding: 20px;
}

.b2b-info-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--b2b-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 12px;
}

.b2b-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.b2b-info-row:last-child { border-bottom: none; }
.b2b-info-row span:first-child { color: var(--b2b-muted); }
.b2b-info-row span:last-child { font-weight: 500; }

@media (max-width: 600px) {
    .b2b-info-grid { grid-template-columns: 1fr; }
}

/* ── Account Edit Inline Forms ───────────────────────────────────── */
.b2b-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.b2b-card-header h3 { margin-bottom: 0; }

.b2b-edit-btn {
    background: none;
    border: 1px solid var(--b2b-border);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--b2b-primary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.b2b-edit-btn:hover {
    background: var(--b2b-primary);
    color: #fff;
}

.b2b-edit-inline {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: var(--b2b-bg);
    border-radius: 8px;
    border: 1px solid var(--b2b-border);
}

.b2b-edit-inline.is-open { display: block; }

.btn-sm {
    padding: 6px 16px;
    font-size: 13px;
}

.b2b-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.b2b-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ── Split Login Page ────────────────────────────────────────────── */
.b2b-login-page {
    display: flex;
    min-height: 100vh;
    background: var(--b2b-bg);
}

.b2b-login-info {
    flex: 1;
    background: linear-gradient(160deg, #0f3460 0%, #1a5276 60%, #1a7a4a 100%);
    color: #fff;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.b2b-login-info__logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2.5rem;
}

.b2b-login-info__badge {
    background: rgba(255,255,255,0.18);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

.b2b-login-info__title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 10px;
}

.b2b-login-info__sub {
    font-size: 15px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.b2b-login-info__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex: 1;
}

.b2b-login-info__list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.b2b-login-info__check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-top: 1px;
}

.b2b-login-info__list li div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.b2b-login-info__list li strong {
    font-size: 14px;
    font-weight: 700;
}

.b2b-login-info__list li span {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
}

.b2b-login-info__cta {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    align-self: flex-start;
}

.b2b-login-info__cta:hover {
    background: rgba(255,255,255,0.25);
}

.b2b-login-panel {
    flex: 0 0 440px;
    display: flex;
    align-items: center;
    padding: 3rem;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}

.b2b-login-panel__inner {
    width: 100%;
}

.b2b-login-panel .logo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.b2b-login-panel .logo-row img { height: 36px; }

.b2b-login-panel h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--b2b-primary);
    margin-bottom: 6px;
}

.b2b-login-panel .subtitle {
    color: var(--b2b-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

@media (max-width: 900px) {
    .b2b-login-page { flex-direction: column; }
    .b2b-login-info { padding: 2rem 1.5rem; }
    .b2b-login-info__list { gap: 0.75rem; }
    .b2b-login-panel { flex: none; padding: 2rem 1.5rem; box-shadow: none; }
    .b2b-login-panel__inner { max-width: 480px; margin: 0 auto; }
}

/* ── Preisalarme Tabelle ──────────────────────────────────────────────────── */
.b2b-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.b2b-price-table th {
    background: #f4f6f8;
    padding: 10px 12px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--b2b-muted);
    border-bottom: 2px solid #d5d8dc;
}

.b2b-price-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef0f3;
    vertical-align: middle;
}

.b2b-price-table tr:last-child td { border-bottom: none; }

.b2b-price-table tr:hover td { background: #fafbfc; }

.price-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.price-badge--cheaper {
    background: #d5f5e3;
    color: #1a7a4a;
}

.price-badge--higher {
    background: #fdecea;
    color: #c0392b;
}

.ek-price-input.input-error {
    border-color: #c0392b;
    outline: 1px solid #c0392b;
}

/* ── Sidebar Legal Links ── */
.b2b-sidebar__legal {
    margin-top: auto;
    border-top: 1px solid var(--b2b-border);
}
.b2b-sidebar__legal .b2b-sidebar__link {
    font-size: 12px;
    color: var(--b2b-muted);
    padding: 6px 16px;
}
.b2b-sidebar__legal .b2b-sidebar__link:hover,
.b2b-sidebar__legal .b2b-sidebar__link.active {
    color: var(--b2b-text);
    background: var(--b2b-bg);
}

/* ── Pagination ── */
.b2b-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px 0 8px;
    flex-wrap: wrap;
}
.b2b-pagination__btn,
.b2b-pagination__num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid #d5d8dc;
    border-radius: 8px;
    background: #fff;
    color: #1a5276;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    padding: 0;
}
.b2b-pagination__btn:hover:not(:disabled),
.b2b-pagination__num:hover {
    border-color: #1a5276;
    background: #ebf5fb;
}
.b2b-pagination__btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}
.b2b-pagination__num.active {
    background: #1a5276;
    border-color: #1a5276;
    color: #fff;
}
.b2b-pagination__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 36px;
    color: #9ca3af;
    font-size: 14px;
    letter-spacing: 1px;
}
@media (max-width: 768px) {
    .b2b-pagination__btn,
    .b2b-pagination__num { width: 40px; height: 40px; }
}
