/**
 * Filterberater Chat Widget Styles
 *
 * Enhanced chat widget with GDPR consent, quick replies, and product cards.
 * Based on Haengematten Relaxo Chatbot design.
 *
 * @package MikroplastikControlCenter
 * @since 2.6.0
 */

/* CSS Variables - Kristallblau Theme */
:root {
    --mcc-chat-primary: #0EA5E9;
    --mcc-chat-primary-dark: #0284C7;
    --mcc-chat-primary-light: #38BDF8;
    --mcc-chat-primary-ultra: rgba(14, 165, 233, 0.1);
    --mcc-chat-white: #ffffff;
    --mcc-chat-cream: #FFFBF5;
    --mcc-chat-gray-50: #f8fafc;
    --mcc-chat-gray-100: #f1f5f9;
    --mcc-chat-gray-200: #e2e8f0;
    --mcc-chat-gray-300: #cbd5e1;
    --mcc-chat-gray-400: #94a3b8;
    --mcc-chat-gray-500: #64748b;
    --mcc-chat-gray-600: #475569;
    --mcc-chat-gray-700: #334155;
    --mcc-chat-gray-800: #1e293b;
    --mcc-chat-red: #ef4444;
    --mcc-chat-green: #22c55e;
    --mcc-chat-amber: #f59e0b;
    --mcc-chat-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    --mcc-chat-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.2);
    --mcc-chat-radius: 16px;
    --mcc-chat-radius-sm: 8px;
    --mcc-chat-transition: all 0.3s ease;
}

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

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

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

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

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

.mcc-chat-toggle:hover {
    background: linear-gradient(135deg, var(--mcc-chat-primary-dark) 0%, #0369a1 100%);
    transform: scale(1.05);
}

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

.mcc-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.mcc-toggle-icon svg {
    width: 28px;
    height: 28px;
    color: white;
}

.mcc-icon-chat {
    display: block;
}

.mcc-icon-close {
    display: none;
}

.mcc-chat-widget.mcc-open .mcc-icon-chat {
    display: none;
}

.mcc-chat-widget.mcc-open .mcc-icon-close {
    display: block;
}

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

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

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

.mcc-chat-widget.mcc-open .mcc-chat-window {
    display: flex;
}

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

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

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

/* Header */
.mcc-chat-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, var(--mcc-chat-primary) 0%, var(--mcc-chat-primary-dark) 100%);
    color: var(--mcc-chat-white);
    flex-shrink: 0;
}

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

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

.mcc-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;
}

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

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

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

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

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

.mcc-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(--mcc-chat-white);
    transition: var(--mcc-chat-transition);
    font-size: 18px;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.mcc-send-btn svg {
    width: 18px;
    height: 18px;
}

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

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

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

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

.mcc-product-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--mcc-chat-white);
    border: 1px solid var(--mcc-chat-gray-200);
    border-radius: var(--mcc-chat-radius-sm);
    transition: var(--mcc-chat-transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.mcc-product-card:hover {
    border-color: var(--mcc-chat-primary);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
}

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

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

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

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

.mcc-badge-top {
    background: var(--mcc-chat-amber);
    color: var(--mcc-chat-white);
}

.mcc-badge-effective {
    background: var(--mcc-chat-green);
    color: var(--mcc-chat-white);
}

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

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

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

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

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

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

.mcc-product-rating svg {
    width: 12px;
    height: 12px;
    color: #fbbf24;
    fill: #fbbf24;
}

.mcc-product-effectiveness {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: var(--mcc-chat-green);
    color: var(--mcc-chat-white);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

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

.mcc-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    transition: var(--mcc-chat-transition);
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

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

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

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

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

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

.mcc-quick-reply:hover {
    background: var(--mcc-chat-primary);
    color: var(--mcc-chat-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

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

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

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

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

.mcc-category-link a:hover {
    background: var(--mcc-chat-primary);
    color: var(--mcc-chat-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

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

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

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

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

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

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

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

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

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

    .mcc-quick-replies {
        justify-content: center;
    }
}

/* Filter Type Specific Styling */
.mcc-filter-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--mcc-chat-primary-ultra);
    color: var(--mcc-chat-primary-dark);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.mcc-filter-type-badge.umkehrosmose {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.mcc-filter-type-badge.aktivkohle {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.mcc-filter-type-badge.tischwasser {
    background: rgba(14, 165, 233, 0.1);
    color: #0284c7;
}

/* Effectiveness Indicator */
.mcc-effectiveness-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.mcc-effectiveness-label {
    font-size: 10px;
    color: var(--mcc-chat-gray-500);
}

.mcc-effectiveness-track {
    flex: 1;
    height: 4px;
    background: var(--mcc-chat-gray-200);
    border-radius: 2px;
    overflow: hidden;
}

.mcc-effectiveness-fill {
    height: 100%;
    background: var(--mcc-chat-green);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.mcc-effectiveness-fill.high {
    background: var(--mcc-chat-green);
}

.mcc-effectiveness-fill.medium {
    background: var(--mcc-chat-amber);
}

.mcc-effectiveness-fill.low {
    background: var(--mcc-chat-gray-400);
}

.mcc-effectiveness-value {
    font-size: 10px;
    font-weight: 600;
    color: var(--mcc-chat-gray-700);
    min-width: 28px;
    text-align: right;
}

/* Message Lists */
.mcc-message-content ul.mcc-list {
    margin: 8px 0;
    padding-left: 0;
    list-style: none;
}

.mcc-message-content ul.mcc-list li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 4px;
}

.mcc-message-content ul.mcc-list li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: var(--mcc-chat-primary);
    font-weight: bold;
}

.mcc-message-content strong {
    font-weight: 600;
}

.mcc-message-content a {
    color: var(--mcc-chat-primary);
    text-decoration: underline;
}

.mcc-message-user .mcc-message-content a {
    color: var(--mcc-chat-white);
}

.mcc-message-content a:hover {
    text-decoration: none;
}
