/* ============================================================
   Bifrost Licensing — style.css v0.4.0
   ============================================================ */

/* --- Zmienne ------------------------------------------------ */
:root,
.bifrost-catalog,
.bifrost-product-page,
.bifrost-order-box,
.bifrost-form-wrap {
    --bf-accent:        #0057b8;
    --bf-accent-dark:   #003e8a;
    --bf-accent-light:  #e8f0fb;
    --bf-text:          #1a1a2e;
    --bf-text-muted:    #6b7280;
    --bf-border:        #d1d5db;
    --bf-border-focus:  #0057b8;
    --bf-bg:            #ffffff;
    --bf-bg-alt:        #f8f9fc;
    --bf-error:         #b91c1c;
    --bf-error-bg:      #fef2f2;
    --bf-radius:        8px;
    --bf-shadow:        0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --bf-shadow-md:     0 4px 12px rgba(0,0,0,.10);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--bf-text);
}

/* ============================================================
   KATALOG produktów [bifrost_catalog]
   ============================================================ */

.bifrost-catalog { max-width: 1100px; }

/* Filtry */
.bifrost-catalog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1.5rem;
}

.bifrost-filter-btn {
    background: var(--bf-bg);
    border: 1px solid var(--bf-border);
    border-radius: 20px;
    padding: .35rem .9rem;
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    color: var(--bf-text-muted);
}

.bifrost-filter-btn:hover,
.bifrost-filter-btn.is-active {
    background: var(--bf-accent);
    border-color: var(--bf-accent);
    color: #fff;
}

/* Siatka kart */
.bifrost-catalog-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) { .bifrost-catalog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .bifrost-catalog-grid { grid-template-columns: 1fr; } }

/* Karta */
.bifrost-catalog-card {
    background: var(--bf-bg);
    border: 1px solid var(--bf-border);
    border-radius: var(--bf-radius);
    overflow: hidden;
    box-shadow: var(--bf-shadow);
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .2s;
}

.bifrost-catalog-card:hover {
    box-shadow: var(--bf-shadow-md);
    transform: translateY(-2px);
}

.bifrost-card-image {
    background: var(--bf-bg-alt);
    border-bottom: 1px solid var(--bf-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    min-height: 140px;
}

.bifrost-card-image img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.bifrost-card-body {
    padding: 1rem 1.1rem .5rem;
    flex: 1;
}

.bifrost-card-subtitle {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bf-accent);
    margin: 0 0 .3rem;
}

.bifrost-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .5rem;
    line-height: 1.3;
}

.bifrost-card-title a {
    color: inherit;
    text-decoration: none;
}
.bifrost-card-title a:hover { color: var(--bf-accent); }

.bifrost-card-excerpt {
    font-size: .82rem;
    color: var(--bf-text-muted);
    margin: 0 0 .5rem;
    line-height: 1.5;
}

.bifrost-card-price {
    font-size: .85rem;
    color: var(--bf-text-muted);
    margin: 0 0 .5rem;
}

.bifrost-card-price strong {
    color: var(--bf-accent);
    font-weight: 700;
}

.bifrost-card-actions {
    padding: .75rem 1.1rem 1rem;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* ============================================================
   STRONA PRODUKTU [bifrost_product]
   ============================================================ */

.bifrost-product-page { max-width: 860px; }

/* Nagłówek produktu */
.bifrost-product-header {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--bf-border);
}

@media (max-width: 600px) {
    .bifrost-product-header { flex-direction: column; gap: 1rem; }
}

.bifrost-product-hero-image {
    flex: 0 0 160px;
}

.bifrost-product-hero-image img {
    max-width: 160px;
    max-height: 160px;
    object-fit: contain;
    border-radius: var(--bf-radius);
}

.bifrost-product-hero-info { flex: 1; }

.bifrost-product-subtitle {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bf-accent);
    margin: 0 0 .4rem;
}

.bifrost-product-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 .6rem;
    line-height: 1.2;
}

.bifrost-product-lead {
    color: var(--bf-text-muted);
    font-size: .95rem;
    margin: 0;
    line-height: 1.5;
}

/* Ramka zamówienia */
.bifrost-order-box {
    background: var(--bf-bg);
    border: 1px solid var(--bf-border);
    border-radius: var(--bf-radius);
    box-shadow: var(--bf-shadow);
    overflow: hidden;
    margin-bottom: 2.5rem;
}

/* Zakładki */
.bifrost-tabs {
    display: flex;
    border-bottom: 1px solid var(--bf-border);
    background: var(--bf-bg-alt);
}

.bifrost-tab {
    flex: 1;
    padding: .9rem 1.2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: .92rem;
    font-weight: 600;
    color: var(--bf-text-muted);
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
    text-align: center;
}

.bifrost-tab:hover { color: var(--bf-accent); background: var(--bf-accent-light); }
.bifrost-tab.is-active {
    color: var(--bf-accent);
    border-bottom-color: var(--bf-accent);
    background: var(--bf-bg);
}

/* Panele zakładek */
.bifrost-tab-panel { display: none; padding: 1.5rem; }
.bifrost-tab-panel.is-active { display: block; }

/* Wiersz formularza zamówienia */
.bifrost-order-row {
    margin-bottom: 1.1rem;
}

.bifrost-order-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bf-text-muted);
    margin-bottom: .45rem;
}

.bifrost-label-optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-style: italic;
}

.bifrost-order-hint {
    font-size: .78rem;
    color: var(--bf-text-muted);
    margin: .3rem 0 0;
    line-height: 1.5;
}

/* Kontrolka ilości */
.bifrost-qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--bf-border);
    border-radius: var(--bf-radius);
    overflow: hidden;
    background: var(--bf-bg-alt);
}

.bifrost-qty-btn {
    width: 36px;
    height: 38px;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bf-text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
    line-height: 1;
}

.bifrost-qty-btn:hover { background: var(--bf-accent-light); color: var(--bf-accent); }

.bifrost-qty-input {
    width: 64px;
    height: 38px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--bf-border);
    border-right: 1px solid var(--bf-border);
    background: var(--bf-bg);
    font-size: .95rem;
    font-weight: 600;
    color: var(--bf-text);
    -moz-appearance: textfield;
}
.bifrost-qty-input::-webkit-inner-spin-button,
.bifrost-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.bifrost-qty-input:focus { outline: 2px solid var(--bf-accent); outline-offset: -1px; }

/* Select */
.bifrost-select {
    width: 100%;
    max-width: 380px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bf-bg-alt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right .85rem center;
    border: 1px solid var(--bf-border);
    border-radius: var(--bf-radius);
    padding: .6rem 2.4rem .6rem .85rem;
    font-size: .95rem;
    color: var(--bf-text);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.bifrost-select:focus {
    outline: none;
    border-color: var(--bf-border-focus);
    box-shadow: 0 0 0 3px rgba(0,87,184,.15);
}

/* Input */
.bifrost-input {
    width: 100%;
    max-width: 420px;
    background: var(--bf-bg-alt);
    border: 1px solid var(--bf-border);
    border-radius: var(--bf-radius);
    padding: .6rem .85rem;
    font-size: .95rem;
    color: var(--bf-text);
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
.bifrost-input:focus {
    outline: none;
    border-color: var(--bf-border-focus);
    box-shadow: 0 0 0 3px rgba(0,87,184,.15);
}

/* Tabela cen */
.bifrost-price-table { border-top: 1px solid var(--bf-border); }
.bifrost-price-table--locked { opacity: .7; pointer-events: none; }

.bifrost-renew-hint {
    padding: .75rem 1rem;
    font-size: .85rem;
    color: var(--bf-text-muted);
    background: var(--bf-bg-alt);
    margin: 0;
}

.bifrost-price-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--bf-bg-alt);
    transition: background .12s;
}
.bifrost-price-row:last-child { border-bottom: none; }
.bifrost-price-row:hover { background: var(--bf-bg-alt); }

.bifrost-price-period {
    flex: 1;
    font-size: .92rem;
    font-weight: 600;
}

.bifrost-price-value {
    flex: 0 0 auto;
    min-width: 120px;
    text-align: right;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bf-accent);
}

.bifrost-price-action { flex: 0 0 auto; }

/* Spinner */
.bifrost-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--bf-border);
    border-top-color: var(--bf-accent);
    border-radius: 50%;
    animation: bifrost-spin .7s linear infinite;
    vertical-align: middle;
}
@keyframes bifrost-spin { to { transform: rotate(360deg); } }

/* Opis produktu pod zamówieniem */
.bifrost-product-description {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--bf-border);
}

.bifrost-product-description h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

.bifrost-product-content p { font-size: .95rem; line-height: 1.65; margin: 0 0 .75rem; }
.bifrost-product-content ul,
.bifrost-product-content ol { padding-left: 1.4rem; font-size: .95rem; line-height: 1.65; margin: 0 0 .75rem; }
.bifrost-product-content li { margin-bottom: .3rem; }
.bifrost-product-content h2,
.bifrost-product-content h3 { font-size: 1rem; font-weight: 700; margin: 1.2rem 0 .4rem; }

/* ============================================================
   PRZYCISKI
   ============================================================ */

.bifrost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border: 2px solid transparent;
    border-radius: var(--bf-radius);
    padding: .6rem 1.25rem;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s, border-color .18s, color .18s, box-shadow .18s, transform .1s;
    white-space: nowrap;
    line-height: 1.3;
}

.bifrost-btn--primary {
    background: var(--bf-accent);
    border-color: var(--bf-accent);
    color: #fff;
    box-shadow: var(--bf-shadow);
}
.bifrost-btn--primary:hover {
    background: var(--bf-accent-dark);
    border-color: var(--bf-accent-dark);
    box-shadow: var(--bf-shadow-md);
    color: #fff;
}
.bifrost-btn--primary:active { transform: translateY(1px); }
.bifrost-btn--primary:disabled {
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.bifrost-btn--outline {
    background: transparent;
    border-color: var(--bf-accent);
    color: var(--bf-accent);
}
.bifrost-btn--outline:hover {
    background: var(--bf-accent-light);
    color: var(--bf-accent-dark);
    border-color: var(--bf-accent-dark);
}

.bifrost-btn--loading { opacity: .7; cursor: wait; pointer-events: none; }

/* ============================================================
   POWIADOMIENIA
   ============================================================ */

.bifrost-cart-notice,
.bifrost-product-notice {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .85rem 1.1rem;
    border-radius: var(--bf-radius);
    margin-top: 1rem;
    font-size: .9rem;
    line-height: 1.5;
}

.bifrost-cart-notice--success,
.bifrost-product-notice--success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #16803c;
}

.bifrost-cart-notice--error,
.bifrost-product-notice--error {
    background: var(--bf-error-bg);
    border: 1px solid #fca5a5;
    color: var(--bf-error);
}

.bifrost-notice__icon { flex-shrink: 0; font-size: 1rem; margin-top: .05rem; }

.bifrost-cart-notice a,
.bifrost-product-notice a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* ============================================================
   KOSZYK — zablokowana ilość, przycisk Zmień, pusty koszyk
   ============================================================ */

.bifrost-qty-locked {
    display: inline-block;
    font-weight: 600;
    padding: .3rem .6rem;
    background: var(--bf-bg-alt);
    border: 1px solid var(--bf-border);
    border-radius: 4px;
    color: var(--bf-text-muted);
    cursor: default;
    font-size: .9rem;
}

.bifrost-reconfigure-wrap { margin: 1rem 0 .5rem; }

.bifrost-reconfigure-btn {
    background: none;
    border: 1px solid var(--bf-border);
    border-radius: 6px;
    padding: .5rem 1.1rem;
    font-size: .9rem;
    color: var(--bf-accent);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.bifrost-reconfigure-btn:hover {
    background: var(--bf-accent-light);
    border-color: var(--bf-accent);
}

.bifrost-empty-cart-link { margin-top: 1.5rem; text-align: center; }

.bifrost-btn-buy {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--bf-accent) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--bf-radius) !important;
    padding: .7rem 1.6rem !important;
    font-size: .95rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: background .18s, box-shadow .18s;
    box-shadow: var(--bf-shadow);
}
.bifrost-btn-buy:hover { background: var(--bf-accent-dark) !important; box-shadow: var(--bf-shadow-md); color: #fff !important; }

/* ============================================================
   MODALE
   ============================================================ */

.bifrost-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bifrost-modal[hidden] { display: none; }

body.bifrost-modal-open { overflow: hidden; }

.bifrost-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
    animation: bifrost-fadein .2s ease;
}
@keyframes bifrost-fadein { from { opacity: 0; } to { opacity: 1; } }

.bifrost-modal__box {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 2rem;
    max-width: 440px;
    width: calc(100% - 2rem);
    animation: bifrost-slidein .22s ease;
}
@keyframes bifrost-slidein { from { opacity:0; transform:translateY(-18px) scale(.97); } to { opacity:1; transform:none; } }

.bifrost-modal__title { font-size: 1.1rem; font-weight: 700; margin: 0 0 .9rem; color: #1a1a2e; }
.bifrost-modal__body  { font-size: .92rem; line-height: 1.65; color: #374151; margin: 0 0 1.5rem; }
.bifrost-modal__body strong { color: #b91c1c; }

.bifrost-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}

.bifrost-modal__cancel {
    background: none;
    border: 1px solid var(--bf-border);
    border-radius: 8px;
    padding: .6rem 1.2rem;
    font-size: .9rem;
    color: #374151;
    cursor: pointer;
    transition: background .15s;
}
.bifrost-modal__cancel:hover { background: var(--bf-bg-alt); }

/* Modal opisu produktu */
.bifrost-modal__box--desc {
    max-width: 720px;
    padding: 0;
    overflow: hidden;
}

.bifrost-modal__close-x {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--bf-text-muted);
    cursor: pointer;
    padding: .25rem .4rem;
    border-radius: 4px;
    z-index: 1;
    transition: background .15s;
}
.bifrost-modal__close-x:hover { background: var(--bf-bg-alt); color: var(--bf-text); }

.bifrost-desc-modal-inner { display: flex; }

.bifrost-desc-modal-image {
    flex: 0 0 200px;
    background: var(--bf-bg-alt);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.5rem 1rem;
    border-right: 1px solid var(--bf-border);
}
.bifrost-desc-modal-image img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 6px;
}

.bifrost-desc-modal-content {
    flex: 1;
    padding: 1.75rem 1.75rem 1rem;
    overflow-y: auto;
    max-height: 60vh;
}

#bifrost-desc-modal .bifrost-modal__actions {
    padding: .75rem 1.5rem 1.25rem;
    border-top: 1px solid var(--bf-border);
    justify-content: flex-start;
}

.bifrost-desc-modal-body h1, .bifrost-desc-modal-body h2, .bifrost-desc-modal-body h3 { font-size: 1rem; font-weight: 700; margin: 1rem 0 .4rem; }
.bifrost-desc-modal-body p  { font-size: .9rem; line-height: 1.6; margin: 0 0 .75rem; color: #374151; }
.bifrost-desc-modal-body ul,
.bifrost-desc-modal-body ol { padding-left: 1.4rem; font-size: .9rem; line-height: 1.6; margin: 0 0 .75rem; color: #374151; }
.bifrost-desc-modal-body li { margin-bottom: .25rem; }
.bifrost-desc-modal-body a  { color: var(--bf-accent); }

/* Link "Opis produktu" */
.bifrost-desc-link {
    font-size: .82rem;
    color: var(--bf-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    transition: opacity .15s;
}
.bifrost-desc-link:hover { text-decoration: underline; }
.bifrost-desc-link.bifrost-loading { opacity: .6; pointer-events: none; }

/* Responsywność */
@media (max-width: 600px) {
    .bifrost-desc-modal-inner { flex-direction: column; }
    .bifrost-desc-modal-image { flex: none; border-right: none; border-bottom: 1px solid var(--bf-border); }
    .bifrost-desc-modal-content { padding: 1.25rem; }
    .bifrost-price-row { flex-wrap: wrap; }
    .bifrost-price-value { min-width: auto; }
    .bifrost-modal__actions { flex-direction: column-reverse; }
    .bifrost-modal__cancel, .bifrost-modal__confirm { width: 100%; text-align: center; }
}

/* ============================================================
   Wyszukiwanie licencji (zakładka Przedłuż)
   ============================================================ */

.bifrost-license-lookup-wrap {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    max-width: 520px;
}

.bifrost-license-lookup-wrap .bifrost-input {
    flex: 1;
    min-width: 200px;
    max-width: none;
}

.bifrost-license-info {
    margin-top: .6rem;
    font-size: .88rem;
    line-height: 1.5;
}

.bifrost-license-found {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    padding: .6rem .9rem;
    border-radius: var(--bf-radius);
}

.bifrost-license-ok {
    font-weight: 700;
    color: #16803c;
}

.bifrost-lookup-icon { margin-right: .2rem; }

/* ============================================================
   Informacja o grupach klienta (.bifrost-uwaga)
   ============================================================ */

.bifrost-uwaga {
    font-size: small;
    background-color: #d2ecf5;
    padding: .7em;
    border-radius: var(--bf-radius);
    margin-top: .5em;
    line-height: 1.55;
}

.bifrost-uwaga p {
    margin: 0 0 .4em;
    font-weight: 600;
}

.bifrost-uwaga ul {
    margin: 0;
    padding-left: 1.3em;
}

.bifrost-uwaga li {
    margin-bottom: .35em;
}

.bifrost-uwaga li:last-child { margin-bottom: 0; }

/* Przycisk danger (modal zmiana konfiguracji) */
.bifrost-btn--danger {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}
.bifrost-btn--danger:hover { background: #991b1b; border-color: #991b1b; color: #fff; }

/* ============================================================
   [bifrost_renew] — globalny formularz odnowienia
   ============================================================ */

.bifrost-renew-page { max-width: 860px; }

.bifrost-renew-step--lookup {
    padding: 1.5rem;
    border-bottom: 1px solid var(--bf-border);
}

.bifrost-renew-heading {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 .5rem;
}

.bifrost-renew-lead {
    color: var(--bf-text-muted);
    font-size: .92rem;
    margin: 0 0 1.2rem;
    line-height: 1.5;
}

.bifrost-renew-step--results { padding: 0; }

.bifrost-renew-license-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.1rem 1.5rem;
    background: var(--bf-bg-alt);
    border-bottom: 1px solid var(--bf-border);
}

.bifrost-renew-lookup-result {
    margin-top: .6rem;
    font-size: .88rem;
}

.bifrost-tabs--renew { margin-top: 0; }

.bifrost-upgrade-current-text {
    font-size: .88rem;
    color: var(--bf-text-muted);
    margin-bottom: .5rem;
}

.bifrost-error-inline {
    color: var(--bf-error);
    font-size: .88rem;
}
