/*assets/chat.css - OVERLAY MODE - UNIFIED BORDER RADIUS - IMPROVED RESPONSIVE*/

/* PRZYCISK TRIGGER */
.openai-chat-trigger-button {
    background: linear-gradient(135deg, #667eea 0%, #8099eb 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px; /* UNIFIED */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 44px; /* UNIFIED HEIGHT */
}

.openai-chat-trigger-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #8099eb 100%);
}

.openai-chat-trigger-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.openai-chat-trigger-button .button-icon {
    font-size: 16px;
}

.openai-chat-trigger-button .button-text {
    font-weight: 600;
}

/* BACKDROP - przyciemnione tło */
.openai-chat-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.openai-chat-backdrop.show {
    opacity: 1;
}

/* KONTENER WRAPPER - różne tryby */
.openai-chat-container-wrapper {
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: visible;
}

/* OVERLAY MODE - modal nad stroną */
.openai-chat-container-wrapper.overlay-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 9999;
    transform: scale(0.9) !important;
    transform-origin: center center !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.openai-chat-container-wrapper.overlay-mode.show {
    transform: scale(1) !important;
    opacity: 1;
    pointer-events: auto;
}

/* NORMAL MODE - zwykły kontener */
.openai-chat-container-wrapper.normal-mode {
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.openai-chat-container-wrapper.normal-mode.show {
    opacity: 1;
    transform: translateY(0);
}

/* GŁÓWNY KONTENER CZATU */
.openai-chat-container {
    background: #fff;
    border-radius: 12px; /* UNIFIED */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow-x: hidden; /* POPRAWKA - ukryj poziome scrollowanie */
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    /* NOWE - definiujemy rozmiar bezpośrednio tutaj */
    width: 90vw;
    height: 85vh;
    max-width: 95vw;
    max-height: 90vh;
    min-width: 320px;
    min-height: 400px;
    box-sizing: border-box;
}

/* HEADER z tytułem i przyciskiem zamknij */
.openai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #8099eb 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px 12px 0 0; /* UNIFIED - tylko górne rogi */
    flex-shrink: 0;
}

.openai-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    color:white;
}

/* PRZYCISK ZAMKNIJ w headerze */
.openai-chat-close-button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 12px; /* OKRĄGŁY - pozostaje bez zmian */
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 15px;
    flex-shrink: 0;
}

.openai-chat-close-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.openai-chat-close-button:active {
    transform: scale(0.95);
}

/* INPUT CONTAINER */
.openai-chat-input-container {
    padding: 15px 20px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
}

.openai-chat-form {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

#openai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 12px; /* UNIFIED */
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    height: 44px; /* UNIFIED HEIGHT */
    box-sizing: border-box;
    min-width: 0; /* DODANE - pozwala na shrinkowanie */
    width: 100%;
}

#openai-chat-input:focus {
    border-color: #8099eb;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#openai-chat-send {
    background: #8099eb;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px; /* UNIFIED */
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    flex-shrink: 0;
    height: 44px; /* UNIFIED HEIGHT - taka sama jak input */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px; /* DODANE - minimalna szerokość */
    white-space: nowrap; /* DODANE - nie łam tekstu */
}

#openai-chat-send:hover:not(:disabled) {
    background: #1565c0;
    transform: translateY(-1px);
}

#openai-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* RESPONSIVE INPUT CONTAINER */
@media (max-width: 480px) {
    .openai-chat-input-container {
        padding: 12px 15px;
    }
    
    .openai-chat-form {
        gap: 8px;
    }
    
    #openai-chat-input {
        font-size: 16px; /* Zapobiegnie zoom na iOS */
        height: 40px;
        padding: 10px 12px;
    }
    
    #openai-chat-send {
        height: 40px;
        padding: 10px 16px;
        min-width: 70px;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .openai-chat-input-container {
        padding: 10px 12px;
    }
    
    .openai-chat-form {
        gap: 6px;
    }
    
    #openai-chat-input {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    #openai-chat-send {
        padding: 8px 12px;
        min-width: 60px;
        font-size: 12px;
    }
}

@media (max-width: 320px) {
    .openai-chat-input-container {
        padding: 8px 10px;
    }
    
    .openai-chat-form {
        gap: 4px;
    }
    
    #openai-chat-input {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    #openai-chat-send {
        padding: 6px 10px;
        min-width: 50px;
        font-size: 11px;
    }
}

/* LOADING - animowane kropki jak w Messengerze */
.openai-chat-typing-indicator {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
    opacity: 0;
    animation: fadeIn 0.3s ease-in-out forwards;
}

.openai-chat-typing-indicator .message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 12px; /* OKRĄGŁY - pozostaje bez zmian */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: #f0f0f0;
    color: #333;
}

.openai-chat-typing-indicator .typing-bubble {
    background: #f0f0f0;
    padding: 12px 14px;
    padding-left: 30px;
    border-radius: 12px; /* UNIFIED */
    border-bottom-left-radius: 4px; /* UNIFIED - mały radius dla "ogonka" */
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    min-width: 50px;
    max-width: 60px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 3px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%; /* OKRĄGŁY - pozostaje bez zmian */
    background: #999;
    animation: typingDot 1.5s infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* STARY LOADING - ukryty */
.openai-chat-loading {
    display: none !important;
}

/* MESSAGES CONTAINER */
.openai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden; /* POPRAWKA - ukryj poziome scrollowanie */
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.openai-chat-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
    position: relative;
    overflow: visible;
    align-items: center;
}

.openai-chat-message.has-products {
    overflow: visible;
    position: relative;
    z-index: 1;
}

.openai-chat-message.user {
    flex-direction: row-reverse;
}

.openai-chat-message.assistant {
    flex-direction: row;
    
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%; /* OKRĄGŁY - pozostaje bez zmian */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: #f0f0f0;
    color: #333;
}

.message-content {
    max-width: 70%;
    position: relative;
    overflow: visible;
    z-index: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: fit-content;
    display: inline-block;
}

/* Specjalny styl dla wiadomości z produktami */
.openai-chat-message.has-products .message-content {
    overflow: visible;
    max-width: 85%;
    width: fit-content;
    display: inline-block;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 12px; /* UNIFIED */
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    overflow-wrap: break-word;
    width: fit-content;
    display: inline-block;
    max-width: 100%;
}

.openai-chat-message.user .message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px; /* UNIFIED - mały radius dla "ogonka" */
    width: fit-content;
    display: inline-block;
    max-width: 100%;
}

.openai-chat-message.assistant .message-bubble {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px; /* UNIFIED - mały radius dla "ogonka" */
    width: fit-content;
    display: inline-block;
    max-width: 100%;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

.openai-chat-message.assistant .message-time {
    text-align: left;
}

.openai-chat-error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 12px; /* UNIFIED */
    margin: 10px 0;
    border: 1px solid #fcc;
    text-align: center;
}

/* NOWE STYLE - PRZENIESIONE Z JAVASCRIPT */

/* POWIADOMIENIE ADMINISTRATORA */
.openai-chat-admin-notification {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(255,215,0,0.3);
    animation: adminNotificationSlide 0.5s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid #f0c040;
}

.openai-chat-admin-notification .notification-icon {
    font-size: 16px;
    animation: adminIconSpin 2s ease-in-out;
}

.openai-chat-admin-notification .notification-content {
    flex: 1;
}

/* LICZNIK WIADOMOŚCI */
.openai-chat-message-counter {
    background: linear-gradient(45deg, #4ecdc4, #45b7aa);
    color: white;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    animation: counterPulse 2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.openai-chat-message-counter.guest {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
}

.openai-chat-message-counter .counter-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.openai-chat-message-counter .counter-icon {
    font-size: 14px;
}

.openai-chat-message-counter .counter-text {
    flex: 1;
}

/* WIADOMOŚĆ O LIMICIE */
.openai-chat-message.limit-message {
    border-left: 4px solid #ffc107;
    background-color: #fff3cd;
    animation: limitMessageSlide 0.3s ease-out;
}

.openai-chat-message.limit-message .message-bubble {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.openai-chat-message.limit-message.user-limit .message-bubble {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* PRZYCISK LOGOWANIA */
.openai-chat-login-btn {
    background: linear-gradient(45deg, #007cba, #0085d1);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,123,186,0.3);
}

.openai-chat-login-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,123,186,0.4);
}

.openai-chat-login-btn:active {
    transform: scale(0.95);
}

/* KARTY PRODUKTÓW - DODATKOWE STYLE */
.product-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e1e8ed;
    border-radius: 12px; /* UNIFIED */
    padding: 12px; /* POPRAWKA - mniejszy padding */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    aspect-ratio: 0.8;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    min-height: 160px; /* POPRAWKA - mniejsza wysokość */
    width: 100%;
    max-width: 100%; /* POPRAWKA - maksymalna szerokość */
    outline: none;
    opacity: 0;
    transform: translateY(4px) scale(0.9);
    box-sizing: border-box; /* DODANE - uwzględnij padding */
}

.product-card:hover:not(:active):not(:focus) {
    transform: translateY(-4px) scale(0.99);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
    background: linear-gradient(145deg, #ffffff 0%, #f0f4ff 100%);
}

.product-card.found-in-db {
    border-color: #8099eb;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0fd 100%);
}

.product-card.found-in-db:hover:not(:active):not(:focus) {
    border-color: #667eea;
    background: linear-gradient(145deg, #ffffff 0%, #dfdfff 100%);
    box-shadow: 0 8px 25px rgba(16, 83, 185, 0.2);
}

/* PRODUKTY - RESPONSYWNE USTAWIENIA */
.openai-chat-products {
    margin-top: 15px;
    padding: 20px;
    padding-bottom: 45px;
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px; /* UNIFIED */
    border: 2px solid #5f82f3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 100%; /* POPRAWKA - responsywna szerokość */
    max-width: 100%; /* POPRAWKA - nie przekraczaj szerokości kontenera */
    margin-left: 0;
    margin-right: 0;
    overflow-x: hidden; /* POPRAWKA - ukryj poziome scrollowanie */
    box-sizing: border-box; /* DODANE - uwzględnij padding w szerokości */
}

.openai-chat-message.assistant .openai-chat-products {
    background: linear-gradient(145deg, #ffffff 0%, #f1f3f4 100%);
    border: 2px solid #c3c9f0;
    box-shadow: 0 3px 10px rgba(0, 123, 255, 0.1);
}

.openai-chat-message.user .openai-chat-products {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 100%);
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 3px 10px rgba(255, 255, 255, 0.2);
}

.products-header {
    font-weight: 700;
    margin-bottom: 16px;
    color: #2c3e50;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.products-header .products-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.products-header .products-title::before {
    content: "🛍️";
    font-size: 18px;
}

.products-count {
    background: linear-gradient(135deg, #667eea 0%, #8099eb 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 12px; /* UNIFIED */
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.products-loading {
    text-align: center;
    padding: 32px;
    color: #6c757d;
    font-style: italic;
    font-size: 14px;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-radius: 12px; /* UNIFIED */
    border: 1px dashed #dee2e6;
}

.products-error {
    text-align: center;
    padding: 32px;
    color: #dc3545;
    font-style: italic;
    font-size: 14px;
    background: linear-gradient(45deg, #fff5f5, #fed7d7);
    border-radius: 12px; /* UNIFIED */
    border: 1px solid #fbb6ce;
}

.product-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* POPRAWKA - mniejszy minmax */
    gap: 12px; /* POPRAWKA - mniejszy gap */
    margin-top: 12px;
    padding: 0; /* POPRAWKA - usuń padding */
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    opacity: 0;
    transform: translateY(10px);
    overflow-x: hidden; /* POPRAWKA - ukryj poziome scrollowanie */
    box-sizing: border-box; /* DODANE - uwzględnij padding w szerokości */
}

/* BREAKPOINTY DLA GRID - RESPONSIVE COLUMNS */
@media (max-width: 320px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 4px;
    }
}

@media (min-width: 321px) and (max-width: 480px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: 6px;
    }
}

@media (min-width: 481px) and (max-width: 600px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 8px;
    }
}

@media (min-width: 601px) and (max-width: 768px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }
}

@media (min-width: 1025px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 14px;
    }
}

/* BREAKPOINTY DLA GRID - RESPONSIVE COLUMNS */
@media (max-width: 480px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
}

@media (min-width: 481px) and (max-width: 600px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
}

@media (min-width: 601px) and (max-width: 768px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 12px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 14px;
    }
}

@media (min-width: 1025px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 16px;
    }
}

/* Fallback dla przeglądarek bez wsparcia grid */
@supports not (display: grid) {
    .product-cards-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: flex-start;
    }
    
    .product-card {
        flex: 0 1 calc(50% - 8px);
        margin-bottom: 16px;
    }
    
    @media (min-width: 768px) {
        .product-card {
            flex: 0 1 calc(33.333% - 10px);
        }
    }
    
    @media (min-width: 1200px) {
        .product-card {
            flex: 0 1 calc(25% - 12px);
        }
    }
}

.product-cards-grid::-webkit-scrollbar {
    display: none;
}

.product-cards-grid::-webkit-scrollbar-track {
    display: none;
}

.product-cards-grid::-webkit-scrollbar-thumb {
    display: none;
}

.product-cards-grid::-webkit-scrollbar-thumb:hover {
    display: none;
}

.AIproduct-image {
    width: 100%;
    height: 60%; /* POPRAWKA - mniejsza wysokość */
    margin-bottom: 8px; /* POPRAWKA - mniejszy margin */
    border-radius: 12px; /* UNIFIED */
    overflow: hidden;
    background: linear-gradient(45deg, #f1f3f4, #e8eaed);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8eaed;
    position: relative;
    flex-shrink: 0; /* DODANE - nie kurczyć się */
}

.AIproduct-image img {
    width: 100% !important;
    height: 100% !important;
    background:white;
    object-fit: contain;
    transition: transform 0.3s ease;
    border-radius: 12px; /* UNIFIED */
}

.product-card:hover:not(:active):not(:focus) .AIproduct-image img {
    transform: scale(1.05); /* POPRAWKA - mniejszy scale */
}

/* RESPONSIVE PRODUCT IMAGE */
@media (max-width: 480px) {
    .AIproduct-image {
        height: 55%;
        margin-bottom: 6px;
    }
}

@media (max-width: 320px) {
    .AIproduct-image {
        height: 50%;
        margin-bottom: 4px;
    }
}

.product-name {
    font-size: 13px; /* POPRAWKA - mniejszy font */
    font-weight: 600;
    color: #374151;
    line-height: 1.2;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 2px; /* POPRAWKA - mniejszy padding */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.4em; /* DODANE - maksymalna wysokość dla 2 linii */
}

/* RESPONSIVE PRODUCT NAME */
@media (max-width: 480px) {
    .product-name {
        font-size: 11px;
        line-height: 1.1;
        -webkit-line-clamp: 3;
        max-height: 3.3em;
    }
}

@media (max-width: 320px) {
    .product-name {
        font-size: 10px;
        line-height: 1.1;
        -webkit-line-clamp: 3;
        max-height: 3.3em;
    }
}

.product-badge {
    position: absolute;
    top: 6px; /* POPRAWKA - mniejsza pozycja */
    right: 6px; /* POPRAWKA - mniejsza pozycja */
    background: linear-gradient(135deg, #226fd4 0%, #052796 100%);
    color: white;
    width: 20px; /* POPRAWKA - mniejszy rozmiar */
    height: 20px; /* POPRAWKA - mniejszy rozmiar */
    border-radius: 50%; /* OKRĄGŁY - pozostaje bez zmian */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px; /* POPRAWKA - mniejszy font */
    font-weight: bold;
    z-index: 2;
    cursor: help;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* RESPONSIVE PRODUCT BADGE */
@media (max-width: 480px) {
    .product-badge {
        top: 4px;
        right: 4px;
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

@media (max-width: 320px) {
    .product-badge {
        top: 3px;
        right: 3px;
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
}

.AIproduct-image.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* ANIMACJE */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes counterPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes limitMessageSlide {
    0% { transform: translateX(-20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes adminNotificationSlide {
    0% { transform: translateY(-10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes adminIconSpin {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
    100% { transform: rotate(0deg); }
}

/* DISABLE SCROLL na body gdy chat jest otwarty */
body.openai-chat-open {
    overflow-x: hidden;
    overflow-y: hidden;
}

/* STARE STYLE - dla kompatybilności z [openai_chat] */
.openai-chat-init {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.openai-chat-start-button {
    background: linear-gradient(135deg, #667eea 0%, #8099eb 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px; /* UNIFIED */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px; /* UNIFIED HEIGHT */
}

.openai-chat-start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #8099eb 100%);
}

.openai-chat-main-interface {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.openai-chat-main-interface.show {
    opacity: 1;
    transform: translateY(0);
}

/* RESPONSIVE DESIGN - POPRAWIONE */

/* Bardzo duże ekrany (ponad 1400px) */
@media (min-width: 1400px) {
    .openai-chat-container {
        width: 70vw;
        height: 85vh;
        max-width: 1200px;
        max-height: 90vh;
        min-width: 800px;
    }
    
    .openai-chat-products {
        padding: 24px;
        padding-bottom: 50px;
    }
}

/* Duże ekrany (1200px - 1400px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .openai-chat-container {
        width: 80vw;
        height: 85vh;
        max-width: 1000px;
        max-height: 90vh;
        min-width: 700px;
    }
    
    .openai-chat-products {
        padding: 22px;
        padding-bottom: 45px;
    }
}

/* Średnie ekrany (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .openai-chat-container {
        width: 85vw;
        height: 85vh;
        max-width: 900px;
        max-height: 90vh;
        min-width: 600px;
    }
    
    .openai-chat-products {
        padding: 20px;
        padding-bottom: 40px;
    }
}

/* Małe ekrany (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .openai-chat-container {
        width: 90vw;
        height: 85vh;
        max-width: 800px;
        max-height: 90vh;
        min-width: 600px;
    }
    
    .openai-chat-products {
        padding: 18px;
        padding-bottom: 35px;
    }
}

/* Mobilne (do 767px) */
@media (max-width: 767px) {
    .openai-chat-trigger-button {
        padding: 10px 20px;
        font-size: 13px;
        height: 40px;
    }
    
    .openai-chat-container {
        width: 95vw;
        height: 90vh;
        max-width: 95vw;
        max-height: 90vh;
        min-width: 300px;
        border-radius: 12px;
    }
    
    .openai-chat-header {
        padding: 12px 15px;
        border-radius: 12px 12px 0 0;
    }
    
    .openai-chat-header h3 {
        font-size: 16px;
    }
    
    .openai-chat-close-button {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .openai-chat-message.has-products .message-content {
        max-width: 95%;
    }
    
    .openai-chat-products {
        padding: 16px;
        padding-bottom: 30px;
    }
    
    .product-card {
        padding: 10px;
        min-height: 130px;
        border-radius: 12px;
    }
    
    .openai-chat-messages {
        padding: 15px;
    }
}

/* Bardzo małe ekrany (do 480px) */
@media (max-width: 480px) {
    .openai-chat-container {
        width: 98vw;
        height: 95vh;
        max-width: 98vw;
        max-height: 95vh;
        min-width: 280px;
    }
    
    .openai-chat-products {
        padding: 12px;
        padding-bottom: 25px;
    }
    
    .product-card {
        padding: 8px;
        min-height: 110px;
    }
    
    .openai-chat-messages {
        padding: 10px;
    }
    
    .openai-chat-header {
        padding: 10px 12px;
    }
    
    .openai-chat-header h3 {
        font-size: 14px;
    }
}

/* Ekstra małe ekrany (do 320px) */
@media (max-width: 320px) {
    .openai-chat-container {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        min-width: 320px;
        border-radius: 0;
    }
    
    .openai-chat-header {
        border-radius: 0;
    }
    
    .openai-chat-products {
        padding: 8px;
        padding-bottom: 18px;
    }
    
    .product-card {
        padding: 6px;
        min-height: 90px;
    }
}