/**
 * Relaxo Chat Widget Styles
 *
 * @package HB_Produktberater
 */

/* CSS Variables - overridden by PHP */
:root {
    --hbp-primary: #2c5530;
    --hbp-primary-dark: #1e3d22;
    --hbp-primary-light: #4a7a4f;
    --hbp-white: #ffffff;
    --hbp-gray-50: #f9fafb;
    --hbp-gray-100: #f3f4f6;
    --hbp-gray-200: #e5e7eb;
    --hbp-gray-300: #d1d5db;
    --hbp-gray-400: #9ca3af;
    --hbp-gray-500: #6b7280;
    --hbp-gray-600: #4b5563;
    --hbp-gray-700: #374151;
    --hbp-gray-800: #1f2937;
    --hbp-gray-900: #111827;
    --hbp-red: #ef4444;
    --hbp-green: #22c55e;
    --hbp-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    --hbp-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.2);
    --hbp-radius: 16px;
    --hbp-radius-sm: 8px;
    --hbp-transition: all 0.3s ease;
}

/* Base Widget Container */
.hbp-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.hbp-chat-widget * {
    box-sizing: border-box;
}

/* Positioning */
.hbp-position-bottom-right {
    right: 20px;
    bottom: 20px;
}

.hbp-position-bottom-left {
    left: 20px;
    bottom: 20px;
}

/* Toggle Button */
.hbp-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--hbp-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hbp-white);
    box-shadow: var(--hbp-shadow);
    transition: var(--hbp-transition);
    position: relative;
    overflow: visible;
}

.hbp-chat-toggle:hover {
    background: var(--hbp-primary-dark);
    transform: scale(1.05);
}

.hbp-chat-toggle:active {
    transform: scale(0.95);
}

.hbp-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hbp-toggle-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--hbp-primary);
    animation: hbp-pulse 2s infinite;
    z-index: -1;
}

@keyframes hbp-pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Chat Window */
.hbp-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: var(--hbp-white);
    border-radius: var(--hbp-radius);
    box-shadow: var(--hbp-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: hbp-slideUp 0.3s ease;
}

.hbp-position-bottom-right .hbp-chat-window {
    right: 0;
}

.hbp-position-bottom-left .hbp-chat-window {
    left: 0;
}

@keyframes hbp-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.hbp-chat-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--hbp-primary);
    color: var(--hbp-white);
    flex-shrink: 0;
}

.hbp-header-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.hbp-header-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.hbp-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.hbp-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--hbp-green);
    border: 2px solid var(--hbp-primary);
    border-radius: 50%;
}

.hbp-header-info {
    flex: 1;
    margin-left: 12px;
}

.hbp-header-name {
    display: block;
    font-weight: 600;
    font-size: 16px;
}

.hbp-header-status {
    display: block;
    font-size: 12px;
    opacity: 0.85;
}

.hbp-header-actions {
    display: flex;
    gap: 8px;
}

.hbp-minimize-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hbp-white);
    transition: var(--hbp-transition);
}

.hbp-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Consent Screen */
.hbp-consent-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--hbp-gray-50);
}

.hbp-consent-content {
    text-align: center;
    max-width: 280px;
}

.hbp-consent-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.hbp-consent-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--hbp-gray-800);
    margin: 0 0 12px;
}

.hbp-consent-text {
    font-size: 13px;
    color: var(--hbp-gray-600);
    margin: 0 0 20px;
    line-height: 1.6;
}

.hbp-consent-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    font-size: 13px;
    color: var(--hbp-gray-700);
    cursor: pointer;
    margin-bottom: 20px;
}

.hbp-consent-checkbox input {
    margin-top: 2px;
    accent-color: var(--hbp-primary);
}

.hbp-consent-btn {
    width: 100%;
    padding: 12px 24px;
    background: var(--hbp-primary);
    color: var(--hbp-white);
    border: none;
    border-radius: var(--hbp-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--hbp-transition);
}

.hbp-consent-btn:disabled {
    background: var(--hbp-gray-300);
    cursor: not-allowed;
}

.hbp-consent-btn:not(:disabled):hover {
    background: var(--hbp-primary-dark);
}

.hbp-privacy-link {
    display: block;
    margin-top: 16px;
    font-size: 12px;
    color: var(--hbp-gray-500);
    text-decoration: none;
}

.hbp-privacy-link:hover {
    color: var(--hbp-primary);
}

/* Messages Container */
.hbp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--hbp-gray-50);
}

/* Message Bubbles */
.hbp-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: hbp-fadeIn 0.3s ease;
}

@keyframes hbp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hbp-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.hbp-message-assistant {
    align-self: flex-start;
}

.hbp-message-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.hbp-message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.hbp-avatar-small {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.hbp-message-content {
    padding: 12px 16px;
    border-radius: var(--hbp-radius);
    word-wrap: break-word;
}

.hbp-message-user .hbp-message-content {
    background: var(--hbp-primary);
    color: var(--hbp-white);
    border-bottom-right-radius: 4px;
}

.hbp-message-assistant .hbp-message-content {
    background: var(--hbp-white);
    color: var(--hbp-gray-800);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Typing Indicator */
.hbp-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 12px;
}

.hbp-typing-avatar {
    width: 32px;
    height: 32px;
}

.hbp-typing-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.hbp-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--hbp-white);
    border-radius: var(--hbp-radius);
    border-bottom-left-radius: 4px;
}

.hbp-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--hbp-gray-400);
    border-radius: 50%;
    animation: hbp-bounce 1.4s infinite;
}

.hbp-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.hbp-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes hbp-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* Input Area */
.hbp-input-area {
    padding: 12px 16px;
    background: var(--hbp-white);
    border-top: 1px solid var(--hbp-gray-200);
    flex-shrink: 0;
}

.hbp-chat-form {
    margin: 0;
}

.hbp-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.hbp-message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--hbp-gray-200);
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: var(--hbp-transition);
    max-height: 80px;
    min-height: 40px;
    height: 40px;
    font-family: inherit;
    line-height: 1.4;
}

.hbp-message-input:focus {
    border-color: var(--hbp-primary);
    box-shadow: 0 0 0 3px var(--hbp-primary-light);
}

.hbp-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--hbp-primary);
    color: var(--hbp-white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--hbp-transition);
    flex-shrink: 0;
}

.hbp-send-btn:disabled {
    background: var(--hbp-gray-300);
    cursor: not-allowed;
}

.hbp-send-btn:not(:disabled):hover {
    background: var(--hbp-primary-dark);
    transform: scale(1.05);
}

.hbp-powered-by {
    text-align: center;
    margin-top: 8px;
    font-size: 11px;
    color: var(--hbp-gray-400);
}

.hbp-powered-by a {
    color: var(--hbp-gray-500);
    text-decoration: none;
}

.hbp-powered-by a:hover {
    color: var(--hbp-primary);
}

/* Product Cards */
.hbp-products-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.hbp-product-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--hbp-white);
    border: 1px solid var(--hbp-gray-200);
    border-radius: var(--hbp-radius-sm);
    transition: var(--hbp-transition);
}

.hbp-product-card:hover {
    border-color: var(--hbp-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hbp-product-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    position: relative;
    border-radius: var(--hbp-radius-sm);
    overflow: hidden;
}

.hbp-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hbp-product-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.hbp-badge-sale {
    background: var(--hbp-red);
    color: var(--hbp-white);
}

.hbp-product-info {
    flex: 1;
    min-width: 0;
}

.hbp-product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--hbp-gray-800);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hbp-product-description {
    font-size: 11px;
    color: var(--hbp-gray-500);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hbp-product-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.hbp-product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--hbp-primary);
}

.hbp-product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--hbp-gray-600);
}

.hbp-product-rating svg {
    color: #fbbf24;
}

.hbp-product-actions {
    display: flex;
    gap: 8px;
}

.hbp-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    transition: var(--hbp-transition);
    cursor: pointer;
    border: none;
}

.hbp-btn-primary {
    background: var(--hbp-primary);
    color: var(--hbp-white);
}

.hbp-btn-primary:hover {
    background: var(--hbp-primary-dark);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .hbp-chat-widget {
        right: 10px !important;
        left: 10px !important;
        bottom: 10px;
    }

    .hbp-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        bottom: 70px;
        right: 0 !important;
        left: 0 !important;
        border-radius: var(--hbp-radius-sm);
    }

    .hbp-chat-toggle {
        width: 54px;
        height: 54px;
    }

    .hbp-product-card {
        flex-direction: column;
    }

    .hbp-product-image {
        width: 100%;
        height: 120px;
    }
}

/* Quick Replies */
.hbp-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 0 8px;
}

.hbp-quick-reply {
    padding: 10px 16px;
    background: var(--hbp-white);
    border: 1.5px solid var(--hbp-primary);
    border-radius: 20px;
    color: var(--hbp-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--hbp-transition);
    white-space: nowrap;
}

.hbp-quick-reply:hover {
    background: var(--hbp-primary);
    color: var(--hbp-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 85, 48, 0.25);
}

.hbp-quick-reply:active {
    transform: translateY(0);
}

.hbp-quick-reply-icon {
    margin-right: 6px;
}

/* Quick Reply Wrapper in Messages */
.hbp-message-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
}

.hbp-message-quick-replies .hbp-message-content {
    margin-bottom: 4px;
}

/* Scrollbar Styling */
.hbp-messages::-webkit-scrollbar {
    width: 6px;
}

.hbp-messages::-webkit-scrollbar-track {
    background: transparent;
}

.hbp-messages::-webkit-scrollbar-thumb {
    background: var(--hbp-gray-300);
    border-radius: 3px;
}

.hbp-messages::-webkit-scrollbar-thumb:hover {
    background: var(--hbp-gray-400);
}

/* Category Link */
.hbp-category-link {
    margin-top: 12px;
    text-align: center;
}

.hbp-category-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--hbp-gray-100);
    color: var(--hbp-primary);
    border: 1.5px solid var(--hbp-primary);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--hbp-transition);
}

.hbp-category-link a:hover {
    background: var(--hbp-primary);
    color: var(--hbp-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 85, 48, 0.25);
}

.hbp-category-icon {
    font-size: 14px;
}

.hbp-btn-secondary {
    background: var(--hbp-gray-100);
    color: var(--hbp-primary);
    border: 1.5px solid var(--hbp-primary);
}

.hbp-btn-secondary:hover {
    background: var(--hbp-primary);
    color: var(--hbp-white);
}
