/* ============================================
   GLHF Streamer Troll — Panel Styles
   Fully integrated with GLHF Design System
   ============================================ */

/* --- Page wrapper --- */
.troll-page {
    padding-top: calc(var(--glhf-header-height) + 40px);
    padding-bottom: 4rem;
    min-height: 100vh;
}

.admin-bar .troll-page {
    padding-top: calc(var(--glhf-header-height) + 40px);
}

/* --- Main container --- */
.glhf-troll-container {
    max-width: 100%;
    margin: 0 auto;
    --troll-currency: #2dd4bf;
    --troll-currency-rgb: 45, 212, 191;
    container-type: inline-size;
}

/* --- Balance bar --- */
.troll-balance-bar {
    display: flex;
    align-items: stretch;
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-xl, 16px);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
}

.troll-balance-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--troll-currency), rgba(var(--troll-currency-rgb), 0.2));
}

.troll-balance-hero-desc {
    flex: 1;
    min-width: 0;
}

.troll-balance-hero-desc .troll-hero-title {
    font-family: var(--glhf-font-heading);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    margin: 0 0 0.25rem 0;
    color: var(--glhf-text-primary);
}

.troll-balance-hero-desc .troll-hero-desc {
    margin: 0;
    color: var(--glhf-text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.troll-balance-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
    flex: 1;
    width: 100%;
}

.troll-balance-title {
    font-family: var(--glhf-font-heading);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--glhf-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.troll-balance-amount {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(var(--troll-currency-rgb), 0.1);
    border: 1px solid rgba(var(--troll-currency-rgb), 0.25);
    border-radius: var(--glhf-radius-full, 50px);
    padding: 0.35rem 0.9rem;
}

.troll-balance-icon {
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.troll-balance-icon img {
    display: block;
}

.troll-balance-value {
    font-family: var(--glhf-font-heading);
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--troll-currency);
    position: relative;
    top: 0px;
}

.troll-balance-topup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 28px;
    flex-shrink: 0;
    border-radius: 10px;
    text-decoration: none;
    font-family: var(--glhf-font-heading);
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #03120a;
    background: linear-gradient(135deg, #00ff64 0%, #00e858 50%, #00ff64 100%);
    background-size: 200% 100%;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.12),
        0 4px 18px rgba(0, 255, 100, 0.28),
        0 0 0 1px rgba(0, 255, 100, 0.18) inset;
    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.5s ease,
        background-position 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.25s ease;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    animation: troll-btn-aurora 9s ease-in-out infinite;
}

@keyframes troll-btn-aurora {
    0%, 35%, 100% {
        box-shadow:
            0 1px 2px rgba(0, 0, 0, 0.12),
            0 4px 18px rgba(0, 255, 100, 0.28),
            0 0 0 1px rgba(0, 255, 100, 0.18) inset;
    }
    50%, 65% {
        box-shadow:
            0 1px 2px rgba(0, 0, 0, 0.12),
            0 8px 30px rgba(0, 255, 100, 0.48),
            0 0 0 1px rgba(0, 255, 100, 0.28) inset,
            0 0 42px rgba(0, 255, 100, 0.16);
    }
}

.troll-balance-topup-btn:hover {
    transform: translateY(-2px) scale(1.02);
    background-position: 100% 0;
    color: #03120a;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 10px 32px rgba(0, 255, 100, 0.38),
        0 0 0 1px rgba(0, 255, 100, 0.24) inset;
    animation-play-state: paused;
}

.troll-balance-topup-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.12),
        0 2px 10px rgba(0, 255, 100, 0.24),
        0 0 0 1px rgba(0, 255, 100, 0.14) inset;
    transition-duration: 0.1s;
    animation-play-state: paused;
}

.troll-balance-topup-btn.is-hidden {
    display: none;
}

.troll-balance-bar.is-zero .troll-balance-title {
    display: none;
}

@container (min-width: 500px) {
    .troll-balance-bar {
        background: linear-gradient(145deg,
            rgba(var(--glhf-accent-rgb), .10) 0%,
            rgba(120, 80, 220, .08) 50%,
            rgba(15, 20, 25, .95) 100%
        );
        border: 1px solid rgba(var(--glhf-accent-rgb), .15);
        border-radius: var(--glhf-radius-xl, 16px);
        padding: 2rem 2rem 1.8rem;
        position: relative;
        overflow: hidden;
    }
    .troll-balance-bar::before {
        display: none;
    }
    .troll-balance-bar::after {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 50%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,.03), transparent);
        animation: psCardShine 6s ease-in-out infinite;
        pointer-events: none;
    }
    .troll-balance-hero-desc {
        display: block;
        flex: 1;
        min-width: 0;
        position: relative;
        z-index: 2;
    }
    .troll-balance-hero-desc .troll-hero-title {
        font-size: 1.6rem;
        margin: 0 0 0.5rem 0;
    }
    .troll-balance-hero-desc .troll-hero-desc {
        display: block;
        color: var(--glhf-text-secondary);
        font-size: 0.95rem;
        line-height: 1.6;
        margin: 0;
    }
    .troll-balance-top-row {
        flex-direction: column;
        justify-content: center;
        align-items: flex-end;
        flex: 0 0 auto;
        gap: 0.5rem;
        position: relative;
        z-index: 2;
        width: auto;
        padding: 0;
        background: transparent;
        border: none;
        min-width: 0;
    }
    .troll-balance-title {
        font-size: 0.9rem;
        color: var(--glhf-text-muted);
    }
    .troll-balance-amount {
        background: linear-gradient(135deg, rgba(var(--glhf-accent-rgb), .18), rgba(var(--glhf-accent-rgb), .06));
        border: 1px solid rgba(var(--glhf-accent-rgb), .25);
        border-radius: var(--glhf-radius-full, 50px);
        padding: 0.6rem 1.4rem;
        gap: 8px;
    }
    .troll-balance-value {
        font-size: 1.5rem;
        color: var(--glhf-text-primary);
    }
    .troll-balance-icon img {
        height: 25px;
        width: auto;
    }
    .troll-balance-topup-btn {
        padding: 0 20px;
        min-height: 38px;
        font-size: 0.75rem;
    }
}

/* --- Offline overlay --- */
.troll-offline-notice {
    background: var(--glhf-bg-card);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--glhf-radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.troll-offline-notice::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.troll-offline-icon {
    font-size: 3rem;
    opacity: 0.7;
    margin-bottom: 1rem;
}

.troll-offline-notice h3 {
    font-family: var(--glhf-font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--glhf-text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.troll-offline-notice p {
    color: var(--glhf-text-muted);
    font-size: 0.95rem;
    max-width: 400px;
    margin: 0 auto;
}

/* --- Actions grid --- */
.troll-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Container-query fallback: when the troll container is too narrow (e.g. on
   /stream/ where the right panel is 430-540 px wide between 769-1023 px
   viewport), drop to a single column and stack card contents vertically. */
@container (max-width: 560px) {
    .troll-actions {
        grid-template-columns: 1fr;
    }
    .troll-action-card {
        flex-direction: column;
        text-align: center;
    }
    .troll-action-info {
        text-align: center;
    }
}

/* --- Action card --- */
.troll-action-card {
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--glhf-transition);
    position: relative;
    overflow: hidden;
}

.troll-action-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--glhf-radius-lg);
    background: linear-gradient(135deg, rgba(var(--glhf-accent-rgb), 0.2), transparent 50%);
    opacity: 0;
    transition: opacity var(--glhf-transition);
    z-index: 0;
    pointer-events: none;
}

.troll-action-card:hover {
    border-color: var(--glhf-border-bright);
    transform: translateY(-3px);
    box-shadow: var(--glhf-shadow-glow);
}

.troll-action-card:hover::before {
    opacity: 1;
}

.troll-action-card.premium {
    border-color: rgba(var(--troll-currency-rgb), 0.3);
}

.troll-action-card.premium:hover {
    border-color: var(--troll-currency);
    box-shadow: 0 0 30px rgba(var(--troll-currency-rgb), 0.25);
}

.troll-action-card.premium::before {
    background: linear-gradient(135deg, rgba(var(--troll-currency-rgb), 0.15), transparent 50%);
}

.troll-action-emoji {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.troll-action-info {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.troll-action-info h3 {
    font-family: var(--glhf-font-heading);
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--glhf-text-primary);
    margin: 0 0 0.25rem 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.troll-action-info p {
    font-size: 0.8rem;
    color: var(--glhf-text-muted);
    margin: 0;
    line-height: 1.4;
}

/* --- Buy button --- */
.troll-buy-btn {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--glhf-font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 10px 20px;
    border: 2px solid var(--glhf-accent);
    border-radius: var(--glhf-radius-md);
    background: rgba(var(--glhf-accent-rgb), 0.1);
    color: var(--glhf-accent);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all var(--glhf-transition);
    white-space: nowrap;
}

.troll-buy-btn:hover:not(:disabled) {
    background: var(--glhf-accent);
    color: var(--glhf-bg-primary);
    box-shadow: 0 0 25px rgba(var(--glhf-accent-rgb), 0.4);
    transform: translateY(-1px);
}

.troll-buy-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.troll-buy-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: var(--glhf-border);
    background: transparent;
    color: var(--glhf-text-muted);
}

.troll-buy-btn .troll-cost-icon {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.troll-buy-btn .troll-cost-icon img {
    display: block;
}

.troll-buy-btn .btn-text {
    position: relative;
    top: 1px;
    /* Компенсація зсуву шрифта Enerhodar */
}

/* --- Premium card button override --- */
.premium .troll-buy-btn {
    border-color: var(--troll-currency);
    background: rgba(var(--troll-currency-rgb), 0.1);
    color: var(--troll-currency);
}

.premium .troll-buy-btn:hover:not(:disabled) {
    background: var(--troll-currency);
    color: var(--glhf-bg-primary);
    box-shadow: 0 0 25px rgba(var(--troll-currency-rgb), 0.4);
}

/* --- Message container --- */
#troll-message-container {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 10020;
    min-width: min(92vw, 360px);
    max-width: min(92vw, 560px);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem 1rem 1rem;
    border-radius: 22px;
    text-align: left;
    font-family: var(--glhf-font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transform: translate(-50%, calc(-50% + 18px)) scale(0.96);
    filter: blur(8px);
    transition:
        opacity 0.28s ease,
        transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.34s ease;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

#troll-message-container::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    opacity: 0.95;
}

#troll-message-container::after {
    content: '';
    position: absolute;
    width: 180px;
    height: 180px;
    right: -40px;
    top: -55px;
    border-radius: 50%;
    opacity: 0.22;
    filter: blur(18px);
    pointer-events: none;
}

#troll-message-container.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
}

.troll-message-icon {
    position: relative;
    z-index: 1;
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 52px;
    border-radius: 16px;
    font-size: 1.45rem;
    line-height: 1;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 10px 30px rgba(0, 0, 0, 0.28);
}

.troll-message-body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    min-width: 0;
}

.troll-message-title {
    display: block;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    opacity: 0.78;
}

.troll-message-text {
    display: block;
    font-size: 1rem;
    line-height: 1.35;
    color: var(--glhf-text-primary);
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.06);
}

.troll-msg-success {
    background:
        linear-gradient(135deg, rgba(0, 255, 100, 0.18), rgba(0, 255, 100, 0.06) 55%, rgba(255, 255, 255, 0.03)),
        rgba(9, 16, 12, 0.82);
    color: var(--glhf-success);
    border: 1px solid rgba(0, 255, 100, 0.28);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 42px rgba(0, 255, 100, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.troll-msg-error {
    background:
        linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(239, 68, 68, 0.07) 55%, rgba(255, 255, 255, 0.03)),
        rgba(20, 10, 10, 0.84);
    color: var(--glhf-danger);
    border: 1px solid rgba(239, 68, 68, 0.28);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 40px rgba(239, 68, 68, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    animation: trollToastErrorIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.troll-msg-success::before {
    background: linear-gradient(90deg, rgba(0, 255, 100, 0.15), rgba(0, 255, 100, 0.95), rgba(0, 255, 100, 0.15));
}

.troll-msg-error::before {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.95), rgba(239, 68, 68, 0.15));
}

.troll-msg-success::after {
    background: radial-gradient(circle, rgba(0, 255, 100, 0.65), transparent 68%);
}

.troll-msg-error::after {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.62), transparent 68%);
}

.troll-msg-success .troll-message-icon {
    color: #06140d;
    background: linear-gradient(135deg, rgba(0, 255, 100, 0.96), rgba(157, 255, 198, 0.9));
}

.troll-msg-error .troll-message-icon {
    color: #fff5f5;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.96), rgba(255, 160, 160, 0.88));
}

@keyframes trollToastErrorIn {
    0% {
        transform: translate(-50%, calc(-50% + 18px)) scale(0.95);
    }
    22% {
        transform: translate(calc(-50% - 6px), -50%) scale(1);
    }
    42% {
        transform: translate(calc(-50% + 5px), -50%) scale(1);
    }
    62% {
        transform: translate(calc(-50% - 3px), -50%) scale(1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 640px) {
    #troll-message-container {
        min-width: min(92vw, 320px);
        padding: 0.95rem 1rem 0.95rem 0.9rem;
        gap: 0.85rem;
    }

    .troll-message-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        border-radius: 14px;
        font-size: 1.25rem;
    }

    .troll-message-text {
        font-size: 0.92rem;
    }
}

/* --- Streamer selector --- */
.troll-streamer-selector {
    margin-bottom: 1.25rem;
}

.troll-streamer-label {
    font-family: var(--glhf-font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--glhf-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.6rem;
}

.troll-streamer-tabs {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.troll-streamer-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.3rem;
    border-radius: var(--glhf-radius-md, 8px);
    border: 2px solid var(--glhf-border);
    background: var(--glhf-bg-card);
    color: var(--glhf-text-secondary, #adb5bd);
    font-family: var(--glhf-font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.troll-streamer-tab:hover {
    border-color: var(--glhf-border-bright);
    color: var(--glhf-text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.troll-streamer-tab.active {
    border-color: var(--glhf-accent);
    color: var(--glhf-accent);
    background: rgba(var(--glhf-accent-rgb), 0.08);
    box-shadow: 0 0 20px rgba(var(--glhf-accent-rgb), 0.15);
}

.streamer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00e676;
    box-shadow: 0 0 6px #00e676;
    flex-shrink: 0;
}

.streamer-name {
    white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .troll-header {
        flex-direction: column;
        padding: 1.25rem 1.5rem;
        gap: 1rem;
    }

    .troll-header-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .troll-header-title {
        font-size: 1.2rem;
    }

    .troll-streamer-tabs {
        flex-direction: column;
    }

    .troll-streamer-tab {
        width: 100%;
        justify-content: center;
    }
}