/**
 * HibNET Program Partnerski - Style frontowe
 */

/* ====== Fullscreen body ====== */
body.hibnet-pp-fullscreen {
    background: #121212;
    min-height: 100vh;
}

/* ====== Panel layout: sidebar + content ====== */
.hibnet-pp-panel {
    display: flex;
    min-height: 100vh;
    max-width: 100%;
}

/* ====== SIDEBAR ====== */
.hibnet-pp-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #fff;
    overflow-y: auto;
}

.hibnet-pp-sidebar__header {
    padding: 10px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
    text-align: center;
}

.hibnet-pp-sidebar__header .panel-logo {
    height: auto;
    width: 100%;
    margin: 0 auto;
    display: block;
}

.hibnet-pp-sidebar__back {
    padding: 12px 20px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.hibnet-pp-back-to-shop {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    transition: all 0.2s;
}

.hibnet-pp-back-to-shop:hover {
    color: #fff;
    background: rgba(255,255,255,0.2);
}

.hibnet-pp-nav .hibnet-pp-logout-nav {
    color: rgba(255,255,255,0.6);
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 4px;
    padding-top: 12px;
}

.hibnet-pp-nav .hibnet-pp-logout-nav:hover {
    color: #fff;
    background: rgba(220, 53, 69, 0.3);
}

/* ====== Nawigacja panelu (sidebar, pionowa) ====== */
.hibnet-pp-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.hibnet-pp-nav a {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    color: rgba(255,255,255,0.7);
    background: transparent;
    border-radius: 0;
    font-size: 14px;
    transition: all 0.2s;
}

.hibnet-pp-nav a:hover,
.hibnet-pp-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.hibnet-pp-nav a.active {
    border-left: 3px solid #fff;
    padding-left: 17px;
}

/* ====== CONTENT AREA ====== */
.hibnet-pp-content {
    flex: 1;
    min-width: 0;
    padding: 30px;
}

/* Hamburger toggle (mobile only, hidden on desktop) */
.hibnet-pp-sidebar-toggle {
    display: none;
}

/* Overlay (mobile only) */
.hibnet-pp-sidebar-overlay {
    display: none;
}

/* ====== Panel header (status + saldo) ====== */
.hibnet-pp-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.panel-header-status {
    text-align: left;
}

.panel-header-status .status-label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-header-status .status-value {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: #232323;
}

.panel-header-status .status-value::before {
    content: '';
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #999;
}

/* Status dot colors */
.panel-header-status .status-value.hibnet-pp-status--member::before { background: #17a2b8; }
.panel-header-status .status-value.hibnet-pp-status--ambassador::before { background: #6c757d; }
.panel-header-status .status-value.hibnet-pp-status--silver::before { background: #c0c0c0; }
.panel-header-status .status-value.hibnet-pp-status--gold::before { background: #ffd700; }
.panel-header-status .status-value.hibnet-pp-status--premium::before { background: #232323; }

.hibnet-pp-panel .panel-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.hibnet-pp-panel .panel-header-balance {
    text-align: right;
}

.hibnet-pp-panel .panel-header-balance .balance-label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hibnet-pp-panel .panel-header-balance .balance-value {
    font-size: 24px;
    font-weight: 700;
    color: #232323;
}

/* Available balance */
.panel-header-balance .balance-available {
    display: block;
    font-size: 12px;
    color: #28a745;
    margin-top: 2px;
}

/* ====== Status badge (legacy, kept for compatibility) ====== */
.hibnet-pp-status {
    display: inline-block;
    font-weight: 600;
}

/* Program type badge (SFC/MME) */
.hibnet-pp-program-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 6px;
}

.hibnet-pp-program--sfc {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}

.hibnet-pp-program--mme {
    background: rgba(255,255,255,0.1);
    color: #ffd700;
    border: 1px solid rgba(255,215,0,0.3);
}

/* ====== Upgrade CTA ====== */
.hibnet-pp-upgrade-box {
    background: linear-gradient(135deg, #C8963E 0%, #e6c068 100%);
    border: none;
}
.hibnet-pp-upgrade-box .card-body h3,
.hibnet-pp-upgrade-box .card-body p { color: #fff; }
.hibnet-pp-upgrade-box .btn { background: #fff; color: #C8963E; border: none; font-weight: 700; }
.hibnet-pp-upgrade-box .btn:hover { background: #f8f8f8; color: #a07830; }

/* SFC upgrade box */
.hibnet-pp-upgrade-box--sfc {
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
}
.hibnet-pp-upgrade-box--sfc .btn {
    background: #fff;
    color: #2e7d32;
}
.hibnet-pp-upgrade-box--sfc .btn:hover {
    background: #f8f8f8;
    color: #1b5e20;
}

/* ====== Karty statystyk ====== */
.hibnet-pp-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.hibnet-pp-stat-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.hibnet-pp-stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #232323;
}

.hibnet-pp-stat-card .stat-label {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* Canvas wykres */
#hibnetEarningsChart {
    display: block;
    max-width: 100%;
    width: 100% !important;
    height: auto;
}

/* ====== Link polecający ====== */
.hibnet-pp-referral-box {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.hibnet-pp-referral-box .referral-link {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hibnet-pp-referral-box .referral-link input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.hibnet-pp-referral-box .btn-copy {
    padding: 10px 20px;
    background: #232323;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.hibnet-pp-referral-box .btn-copy:hover {
    background: #444;
}

/* Mini statystyki referral */
.referral-mini-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.referral-mini-stat {
    font-size: 13px;
    color: #666;
}

.referral-mini-stat strong {
    color: #232323;
}

/* ====== Tabela transakcji ====== */
.hibnet-pp-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.hibnet-pp-table th,
.hibnet-pp-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
}

.hibnet-pp-table th {
    background: #f8f8f8;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hibnet-pp-table .amount-positive { color: #2ecc71; font-weight: 600; }
.hibnet-pp-table .amount-negative { color: #e74c3c; font-weight: 600; }

/* ====== Filtry transakcji ====== */
.hibnet-pp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Typ transakcji badge */
.hibnet-pp-tx-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    background: #f0f0f0;
    color: #333;
    white-space: nowrap;
}

.hibnet-pp-tx-type--cashback_own { background: #d4edda; color: #155724; }
.hibnet-pp-tx-type--cashback_referral { background: #cce5ff; color: #004085; }
.hibnet-pp-tx-type--commission_gen1 { background: #e2e3ff; color: #383d6e; }
.hibnet-pp-tx-type--commission_gen2 { background: #e2e3ff; color: #383d6e; }
.hibnet-pp-tx-type--commission_gen3 { background: #e2e3ff; color: #383d6e; }
.hibnet-pp-tx-type--bonus_referral { background: #fff3cd; color: #856404; }
.hibnet-pp-tx-type--bonus_welcome { background: #fff3cd; color: #856404; }
.hibnet-pp-tx-type--bonus_contest { background: #fff3cd; color: #856404; }
.hibnet-pp-tx-type--subscription_points { background: #d1ecf1; color: #0c5460; }
.hibnet-pp-tx-type--withdrawal { background: #f8d7da; color: #721c24; }
.hibnet-pp-tx-type--purchase_reward { background: #f8d7da; color: #721c24; }
.hibnet-pp-tx-type--adjustment { background: #e2e2e2; color: #333; }

/* ====== Drzewo generacji ====== */
.hibnet-pp-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hibnet-pp-tree-children {
    list-style: none;
    padding-left: 30px;
    margin: 0;
    border-left: 2px solid #e5e5e5;
    margin-left: 15px;
}

.hibnet-pp-tree-node {
    padding: 6px 0;
}

.tree-node-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #f8f8f8;
    border-radius: 6px;
    font-size: 13px;
}

.tree-gen-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    background: #232323;
    color: #fff;
}

.tree-node-name {
    font-weight: 600;
}

.tree-node-ref code {
    font-size: 11px;
    color: #888;
}

/* Checkbox rejestracyjny */
.hibnet-pp-registration-checkbox {
    margin-top: 10px;
}

/* ====== Baner instalacji PWA ====== */
.hibnet-pwa-install {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.hibnet-pwa-install--visible {
    transform: translateY(0);
}

.hibnet-pwa-install__content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto 16px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e5e5;
}

.hibnet-pwa-install__icon img {
    display: block;
    border-radius: 8px;
}

.hibnet-pwa-install__text {
    flex: 1;
    min-width: 0;
}

.hibnet-pwa-install__text strong {
    display: block;
    font-size: 14px;
    color: #232323;
}

.hibnet-pwa-install__text span {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.hibnet-pwa-install__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.hibnet-pwa-install__btn {
    padding: 8px 18px;
    background: #C8963E;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.hibnet-pwa-install__btn:hover {
    background: #b0832f;
}

.hibnet-pwa-install__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
    line-height: 1;
}

.hibnet-pwa-install__close:hover {
    background: #f0f0f0;
    color: #333;
}

/* ====== MOBILE: sidebar → offcanvas ====== */
@media (max-width: 768px) {
    .hibnet-pp-panel {
        flex-direction: column;
    }

    .hibnet-pp-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .hibnet-pp-sidebar--open {
        left: 0;
    }

    .hibnet-pp-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .hibnet-pp-sidebar--open ~ .hibnet-pp-sidebar-overlay {
        display: block;
    }

    /* Hamburger button */
    .hibnet-pp-sidebar-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 36px;
        height: 36px;
        padding: 6px;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 6px;
        cursor: pointer;
        margin-bottom: 15px;
    }

    .hibnet-pp-sidebar-toggle span {
        display: block;
        height: 2px;
        width: 100%;
        background: #333;
        border-radius: 1px;
    }

    .hibnet-pp-content {
        padding: 15px;
        width: 100%;
    }

    .hibnet-pp-panel .panel-header {
        flex-direction: column;
        gap: 10px;
    }

    .hibnet-pp-panel .panel-header-balance {
        text-align: left;
    }

    .hibnet-pp-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .hibnet-pp-stat-card .stat-value {
        font-size: 22px;
    }

    .hibnet-pp-referral-box .referral-link {
        flex-direction: column;
    }

    .hibnet-pp-referral-box .referral-link input {
        width: 100%;
    }

    .referral-mini-stats {
        flex-direction: column;
        gap: 5px;
    }

    .hibnet-pp-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }

    .tree-node-info {
        flex-wrap: wrap;
        gap: 5px;
    }

    .hibnet-pwa-install__content {
        margin: 0 8px 8px;
        padding: 12px 14px;
        gap: 10px;
    }
}

@media (min-width: 769px) {
    .hibnet-pp-sidebar-toggle,
    .hibnet-pp-sidebar-overlay {
        display: none !important;
    }
}
