/* === STREFEK CHAT WIDGET === */

/* Resetki */
#strefek-bubble, #strefek-window, #strefek-window * {
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Roboto', system-ui, sans-serif;
    line-height: 1.5;
}

/* === DYMEK === */
#strefek-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #450DFF;
    box-shadow: 0 4px 20px rgba(69, 13, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: strefek-pulse 2s infinite;
}
#strefek-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(45, 106, 79, 0.55);
}
#strefek-bubble img {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    object-fit: cover;
}
#strefek-bubble .strefek-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e63946;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: strefek-badge-pop 0.3s ease;
}
/* Tooltip obok dymka */
#strefek-tooltip {
    position: fixed;
    bottom: 36px;
    right: 96px;
    z-index: 99999;
    background: #fff;
    color: #1a1a2e;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    animation: strefek-tooltip-in 0.4s ease;
    transition: opacity 0.3s;
    font-family: 'Segoe UI', 'Roboto', system-ui, sans-serif;
}
#strefek-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-right: none;
    border-left: 8px solid #fff;
}
#strefek-tooltip.hidden { display: none; }
@keyframes strefek-tooltip-in {
    0% { opacity: 0; transform: translateX(10px); }
    100% { opacity: 1; transform: translateX(0); }
}
@keyframes strefek-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(69, 13, 255, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(69, 13, 255, 0.6), 0 0 0 8px rgba(69, 13, 255, 0.1); }
}
@keyframes strefek-badge-pop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* === OKNO CZATU === */
#strefek-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 99998;
    width: 450px;
    max-height: 650px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: strefek-slide-up 0.3s ease;
}
#strefek-window.open {
    display: flex;
}
@keyframes strefek-slide-up {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Header */
.strefek-header {
    background: #450DFF !important;
    color: #fff !important;
    padding: 18px 20px !important;
    border-top-left-radius: 20px !important;
    border-top-right-radius: 20px !important;
    border: none !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
}
.strefek-header img {
    box-sizing: border-box !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    border-radius: 50% !important;
    object-fit: contain !important;
    background-color: #ffffff !important;
    padding: 6px !important;
    margin: 0 !important;
    border: 2px solid rgba(255,255,255,0.7) !important;
    box-shadow: none !important;
}
.strefek-header-info h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}
.strefek-header-info span {
    font-size: 12px;
    opacity: 0.85;
    color: #ffffff;
}
.strefek-header-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}
.strefek-action-btn {
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 18px !important;
    cursor: pointer !important;
    padding: 6px !important;
    margin: 0 !important;
    border-radius: 8px !important;
    transition: background 0.2s, transform 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    box-shadow: none !important;
    outline: none !important;
}
.strefek-action-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.05);
}
.strefek-close {
    font-size: 24px;
}

#strefek-window.strefek-expanded {
    width: 90vw;
    max-width: 600px;
    height: 85vh;
    max-height: 800px;
}
#strefek-window.strefek-expanded .strefek-messages {
    max-height: none;
}

/* Wiadomości */
.strefek-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8faf9;
    min-height: 350px;
    max-height: 480px;
}

.strefek-msg {
    display: flex;
    gap: 8px;
    max-width: 90%;
    animation: strefek-msg-in 0.25s ease;
}
@keyframes strefek-msg-in {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
.strefek-msg.bot {
    align-self: flex-start;
}
.strefek-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.strefek-msg-avatar {
    box-sizing: border-box !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 50% !important;
    object-fit: contain !important;
    background-color: transparent !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    margin-top: 2px !important;
    box-shadow: none !important;
    border: none !important;
}
.strefek-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    word-wrap: break-word;
}
.strefek-msg.bot .strefek-msg-bubble {
    background: #fff;
    color: #1a1a2e;
    border: 1px solid #e8ede9;
    border-bottom-left-radius: 4px;
}
.strefek-msg.user .strefek-msg-bubble {
    background: #450DFF;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.strefek-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-items: center;
}
.strefek-typing span {
    width: 7px;
    height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: strefek-dot 1.2s ease infinite;
}
.strefek-typing span:nth-child(2) { animation-delay: 0.2s; }
.strefek-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes strefek-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Karty produktów w czacie */
.strefek-product {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid #e0e5e2;
    border-radius: 10px;
    padding: 12px;
    margin-top: 6px;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.strefek-product:hover {
    box-shadow: 0 4px 12px rgba(69, 13, 255, 0.08);
    border-color: #c2cfff;
}
.strefek-product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f0f3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.strefek-product-thumb[data-cat="kurs"] { background: #ffe4e6; }
.strefek-product-thumb[data-cat="nagranie"] { background: #e6ffed; }
.strefek-product-thumb[data-cat="webinar"] { background: #fff3cd; }
.strefek-product-thumb[data-cat="material"] { background: #f3e8ff; }

.strefek-product-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.strefek-product-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
    line-height: 1.4;
}
.strefek-product-meta {
    font-size: 11.5px;
    color: #666;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
}
.strefek-product-price {
    color: #450DFF;
    font-weight: 700;
}
.strefek-product-cat {
    background: #eef2ff;
    color: #450DFF;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10.5px;
    text-transform: uppercase;
    font-weight: 600;
}
.strefek-product-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: #450DFF;
    text-decoration: none;
    font-weight: 600;
}
.strefek-product-link:hover {
    text-decoration: underline;
}

/* EduStrefa upsell */
.strefek-edustrefa {
    background: linear-gradient(135deg, #f3f5ff, #eef2ff);
    border: 1px solid #c2cfff;
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 8px;
    font-size: 12.5px;
}
.strefek-edustrefa strong {
    color: #450DFF;
}
.strefek-edustrefa a {
    color: #450DFF;
    font-weight: 700;
}

/* Input */
.strefek-input-wrap {
    padding: 12px 16px !important;
    border-top: 1px solid #eee !important;
    display: flex !important;
    gap: 8px !important;
    background: #fff !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
}
.strefek-input {
    flex: 1 !important;
    border: 1px solid #ddd !important;
    border-radius: 24px !important;
    padding: 10px 16px !important;
    margin: 0 !important;
    font-size: 13.5px !important;
    outline: none !important;
    transition: border-color 0.2s !important;
    background: #fff !important;
    color: #1a1a2e !important;
    box-shadow: none !important;
    width: auto !important;
    max-width: none !important;
    min-height: auto !important;
}
.strefek-input:focus {
    border-color: #450DFF !important;
}
.strefek-send {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: #450DFF !important;
    color: #fff !important;
    font-size: 18px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}
.strefek-send:hover {
    transform: scale(1.08);
}
.strefek-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobilne */
@media (max-width: 480px) {
    #strefek-window {
        width: calc(100% - 16px);
        right: 8px;
        bottom: 80px;
        max-height: 70vh;
    }
    #strefek-bubble {
        bottom: 16px;
        right: 16px;
    }
}
