/* Presellia Partner Bridge — Portail */

.ppb-portal {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    color: #1a1a2e;
}

/* ---- En-tête ---- */
.ppb-portal-header {
    text-align: center;
    margin-bottom: 32px;
}
.ppb-portal-logo {
    max-height: 60px;
    margin-bottom: 12px;
}
.ppb-portal-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}

/* ---- Utilitaires ---- */
.ppb-hidden { display: none !important; }

.ppb-input {
    padding: 9px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
}
.ppb-input:focus { border-color: #0073aa; box-shadow: 0 0 0 3px rgba(0,115,170,.15); }

/* ---- Boutons ---- */
.ppb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}
.ppb-btn:disabled { opacity: .55; cursor: not-allowed; }

.ppb-btn-primary  { background: #0073aa; color: #fff; }
.ppb-btn-primary:hover:not(:disabled) { background: #005f8d; }

.ppb-btn-ghost    { background: transparent; color: #555; border: 1px solid #d0d5dd; }
.ppb-btn-ghost:hover { background: #f5f5f5; }

.ppb-btn-add      { background: #0073aa; color: #fff; padding: 6px 14px; border-radius: 6px; font-size: 13px; }
.ppb-btn-add:hover:not(:disabled) { background: #005f8d; }

.ppb-btn-remove   { background: transparent; color: #c0392b; border: none; font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.ppb-btn-remove:hover { color: #922b21; }

.ppb-btn-large    { padding: 12px 28px; font-size: 16px; }
.ppb-btn-sm       { padding: 5px 12px; font-size: 13px; }

/* ---- Modale mot de passe ---- */
.ppb-auth-modal {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}
.ppb-auth-card {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    text-align: center;
}
.ppb-auth-intro {
    color: #555;
    margin-bottom: 20px;
}
.ppb-auth-form {
    display: flex;
    gap: 8px;
}
.ppb-auth-form .ppb-input { flex: 1; }
.ppb-auth-error {
    color: #c0392b;
    font-size: 13px;
    margin-top: 10px;
}

/* ---- Toolbar ---- */
.ppb-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.ppb-search { flex: 1; min-width: 180px; }
.ppb-toolbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---- Tableau catalogue ---- */
.ppb-catalog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.ppb-catalog-table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e4e7ec;
    white-space: nowrap;
}
.ppb-catalog-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.ppb-catalog-table tr:hover td { background: #f9fbff; }

.ppb-row-parent td { background: #f4f6f8 !important; font-weight: 600; color: #333; }

.ppb-col-num    { text-align: right; white-space: nowrap; }
.ppb-col-action { text-align: center; width: 80px; }
.ppb-col-partner { color: #0073aa; font-weight: 700; white-space: nowrap; }

/* ---- Bannière prix dégressifs ---- */
.ppb-tiers-banner {
    background: #fffbea;
    border: 1px solid #f0d060;
    border-left: 4px solid #f0a500;
    border-radius: 0 6px 6px 0;
    padding: 10px 16px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #5a4200;
}

/* ---- Badges de stock ---- */
.ppb-stock-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.ppb-stock-out {
    background: #fde8e8;
    color: #922b21;
    border: 1px solid #f1b0b0;
}
.ppb-stock-backorder {
    background: #fff3cd;
    color: #7a5700;
    border: 1px solid #fce08a;
}
.ppb-stock-in {
    background: #e6f4ea;
    color: #1e6e37;
    border: 1px solid #a8d5b5;
}
.ppb-col-action { min-width: 90px; }

/* ---- Bouton paliers (portail) ---- */
.ppb-tiers-toggle {
    background: none;
    border: none;
    color: #0073aa;
    font-size: 11px;
    cursor: pointer;
    padding: 0 2px;
    vertical-align: middle;
    white-space: nowrap;
}
.ppb-tiers-toggle:hover { text-decoration: underline; }

/* ---- Ligne de détail paliers ---- */
.ppb-tiers-info-row td { background: #f0f8ff !important; padding: 8px 12px !important; }
.ppb-tiers-info-cell { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ppb-tier-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #c5dff0;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    white-space: nowrap;
}
.ppb-tier-qty { color: #555; }
.ppb-tier-price-val { color: #0073aa; font-weight: 700; }

.ppb-price-public {
    color: #aaa;
    font-weight: 400;
    font-size: 12px;
    margin-right: 4px;
    text-decoration: line-through;
}
.ppb-price-partner { color: #0073aa; font-weight: 700; }

.ppb-qty-input {
    width: 60px;
    padding: 5px 6px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
}
.ppb-no-price { color: #aaa; font-style: italic; font-size: 12px; }

/* ---- Spinner de chargement ---- */
.ppb-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px;
    color: #777;
}
.ppb-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #d0d5dd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: ppb-spin .7s linear infinite;
}
@keyframes ppb-spin { to { transform: rotate(360deg); } }

.ppb-empty-msg { color: #777; padding: 20px; text-align: center; }

/* ---- En-têtes de catégorie ---- */
.ppb-row-category td {
    background: #eef2f7 !important;
    color: #0073aa;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 10px 12px 8px !important;
    border-top: 2px solid #d5e8f3;
    border-bottom: 1px solid #d5e8f3 !important;
}
.ppb-row-category:first-child td { border-top: none; }

/* ---- Filtre catégorie (toolbar) ---- */
.ppb-cat-select {
    min-width: 180px;
    flex-shrink: 0;
    background: #fff;
}

/* ---- Miniatures catalogue ---- */
.ppb-col-thumb { width: 50px; padding: 5px 8px !important; }
.ppb-product-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 5px;
    display: block;
}

/* ---- Barre panier flottante ---- */
.ppb-cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    height: 60px;
    background: #1a1a2e;
    box-shadow: 0 -2px 16px rgba(0,0,0,.25);
}
.ppb-cart-bar.ppb-hidden { display: none !important; }

.ppb-cart-bar-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    padding: 0;
    text-align: left;
}
.ppb-cart-bar-summary:hover { opacity: .85; }
.ppb-cart-bar-icon { font-size: 1.2rem; }
.ppb-cart-bar-summary strong { font-weight: 700; }
.ppb-cart-bar-sep { opacity: .5; }
#ppb-cart-bar-total { color: #7ec8e3; font-weight: 700; }

.ppb-cart-bar #ppb-checkout-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Flash d'ajout */
@keyframes ppb-bar-flash {
    0%   { background: #005f8d; }
    50%  { background: #0073aa; }
    100% { background: #1a1a2e; }
}
.ppb-bar-flash { animation: ppb-bar-flash .4s ease; }

/* ---- Panneau détail de la sélection ---- */
.ppb-cart-panel {
    position: fixed;
    bottom: 60px; /* = hauteur de la barre */
    left: 0;
    right: 0;
    z-index: 9998;
    max-height: 50vh;
    overflow-y: auto;
    background: #fff;
    border-top: 2px solid #0073aa;
    box-shadow: 0 -4px 20px rgba(0,0,0,.18);
    transform: translateY(100%);
    transition: transform .25s ease;
    pointer-events: none;
}
.ppb-cart-panel.ppb-panel-open {
    transform: translateY(0);
    pointer-events: auto;
}

.ppb-cart-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e4e7ec;
    position: sticky;
    top: 0;
}
.ppb-cart-panel-title { font-weight: 700; font-size: 14px; }
.ppb-cart-panel-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #777;
    padding: 0 4px;
}
.ppb-cart-panel-close:hover { color: #1a1a2e; }

.ppb-cart-panel-body { padding: 0 0 4px; }

.ppb-cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.ppb-cart-table td {
    padding: 9px 20px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.ppb-cart-table tr:last-child td { border-bottom: none; }

.ppb-qty-sm {
    width: 55px;
    padding: 4px 6px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
}

/* Espace bas de page quand la barre est visible */
.ppb-has-cart-bar .ppb-portal,
.ppb-has-cart-bar #ppb-portal {
    padding-bottom: 76px;
}

/* ---- Notices ---- */
.ppb-notice {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.ppb-notice-error { background: #fde8e8; color: #922b21; border: 1px solid #f1b0b0; }

/* ---- Lien "Demander l'accès" (modale auth) ---- */
.ppb-auth-request {
    margin-top: 14px;
    font-size: 13px;
    color: #777;
}
.ppb-auth-request a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}
.ppb-auth-request a:hover { text-decoration: underline; }

/* ---- Lien nom produit ---- */
.ppb-product-link {
    color: inherit;
    text-decoration: none;
}
.ppb-product-link:hover { color: #0073aa; text-decoration: underline; }

/* ---- Indicateur de stock ---- */
.ppb-stock-qty {
    font-size: 11px;
    color: #999;
    font-weight: 400;
    white-space: nowrap;
    margin-left: 4px;
}

/* ---- Bouton tutoriel (toolbar) ---- */
.ppb-tutorial-btn { white-space: nowrap; }

/* ---- Panneau vidéo tutoriel ---- */
.ppb-tutorial-panel {
    margin-bottom: 14px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.ppb-tutorial-iframe-wrap {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}
.ppb-tutorial-iframe-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* =========================================================================
   Catalogue public [ppb_catalog]
   ========================================================================= */

.ppb-public-catalog {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    color: #1a1a2e;
}

.ppb-catalog-toolbar {
    margin-bottom: 16px;
}

/* Prix public (catalogue client) */
.ppb-pub-price {
    font-weight: 600;
    color: #1a1a2e;
}
.ppb-pub-price-sale {
    font-weight: 700;
    color: #c0392b;
}

/* ---- Responsive ---- */
@media ( max-width: 600px ) {
    .ppb-auth-form { flex-direction: column; }
    .ppb-toolbar   { flex-direction: column; align-items: stretch; }
    .ppb-toolbar-actions { margin-left: 0; }
    /* Masque la colonne miniature sur mobile (colonne 1) */
    .ppb-catalog-table th:nth-child(1),
    .ppb-catalog-table td:nth-child(1) { display: none; }
    .ppb-cart-bar { padding: 0 12px; gap: 8px; }
    .ppb-cart-bar-sep { display: none; }
    #ppb-cart-bar-total { display: none; }
    .ppb-cart-table td { padding: 8px 12px; }
}
