/**
 * AI Assistant Styles
 * Minimal modern design for the chat interface
 * 
 * @package White_Mark_Media
 */

/* Container Styles */
.wmm-ai-assistant-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Intro Header (Hero) */
.wmm-ai-hero {
    max-width: 800px;
    margin: 0 auto 16px auto;
    text-align: center;
}
.wmm-ai-hero-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.3px;
}
.wmm-ai-hero-overline {
    margin-top: 8px;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.wmm-ai-hero-headline {
    margin: 8px 0 8px 0;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.wmm-ai-hero-subheadline {
    color: #4b5563;
    font-size: 15px;
}

.wmm-ai-assistant-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.wmm-ai-assistant-container:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12);
}

/* Header Styles */
.wmm-ai-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
    color: white;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

.wmm-ai-assistant-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none;
}

.wmm-ai-assistant-header > * {
    position: relative;
    z-index: 2;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.wmm-ai-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Chatbot header logo */
.wmm-ai-header-logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.wmm-ai-assistant-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.wmm-ai-assistant-avatar::before {
    content: '🤖';
    filter: grayscale(0);
}

.wmm-ai-assistant-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.8px;
    margin: 0;
    background: linear-gradient(45deg, #ffffff, #f0f9ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-assistant-subtitle {
    font-size: 14px;
    opacity: 0.85;
    margin: 2px 0 0 0;
    font-weight: 400;
    letter-spacing: 0.2px;
}

.wmm-ai-clear-button {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;           /* prevent label wrapping */
    flex: 0 0 auto;                /* do not stretch or shrink in form flex row */
    box-sizing: border-box;
}

/* Prevent SVG from collapsing when space is tight */
.wmm-ai-clear-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;               /* keep icon visible */
    display: inline-block;
}

.wmm-ai-clear-button span {
    display: inline-block;
    line-height: 1;               /* consistent vertical alignment */
}

.wmm-ai-clear-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.wmm-ai-clear-button:active {
    transform: translateY(0);
}

/* Messages Container */
.wmm-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
}

.wmm-ai-messages::-webkit-scrollbar {
    width: 6px;
}

.wmm-ai-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.wmm-ai-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.wmm-ai-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Message Styles */
.wmm-ai-message {
    display: flex;
    margin-bottom: 20px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wmm-ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
    font-size: 16px;
}

.wmm-ai-message-user .wmm-ai-message-avatar {
    background: #667eea;
    color: white;
}

.wmm-ai-message-assistant .wmm-ai-message-avatar {
    background: #f0f0f0;
    color: #667eea;
}

.wmm-ai-message-content {
    flex: 1;
    max-width: 70%;
}

.wmm-ai-message-user .wmm-ai-message-content {
    margin-left: auto;
    margin-right: 0;
}

.wmm-ai-message-user {
    flex-direction: row-reverse;
}

.wmm-ai-message-user .wmm-ai-message-avatar {
    margin-right: 0;
    margin-left: 12px;
}

.wmm-ai-message-bubble {
    background: #f5f5f5;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 15px;
    color: #333;
    word-wrap: break-word;
}

.wmm-ai-message-user .wmm-ai-message-bubble {
    background: #667eea;
    color: white;
}

.wmm-ai-message-bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
}

.wmm-ai-message-user .wmm-ai-message-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.wmm-ai-message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 0 4px;
}

.wmm-ai-message-time {
    font-size: 12px;
    color: #999;
}

.wmm-ai-copy-button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    font-size: 12px;
    transition: color 0.2s ease;
}

.wmm-ai-copy-button:hover {
    color: #667eea;
}

/* Typing Indicator */
.wmm-ai-typing-indicator {
    display: none;
    align-items: center;
    padding: 0 24px 20px;
}

.wmm-ai-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 12px;
    margin-left: 48px;
}

.wmm-ai-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.wmm-ai-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.wmm-ai-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Input Form */
.wmm-ai-input-wrapper {
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.wmm-ai-input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

/* Full-width End button when offered below the input */
button.wmm-ai-clear-button.wmm-ai-end-button {
    width: 100%;
    justify-content: center;
    margin-top: 12px;
    padding: 14px 18px;
    border-radius: 12px;
}

.wmm-ai-input-field {
    flex: 1;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    resize: none;
    min-height: 48px;
    max-height: 120px;
    line-height: 1.5;
    transition: all 0.2s ease;
    font-family: inherit;
}

.wmm-ai-input-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.wmm-ai-input-field::placeholder {
    color: #999;
}

.wmm-ai-send-button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wmm-ai-send-button:hover:not(:disabled) {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.wmm-ai-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wmm-ai-assistant-container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    .wmm-ai-message-content {
        max-width: 85%;
    }
    
    .wmm-ai-assistant-header {
        padding: 16px 20px;
    }
    
    .wmm-ai-messages {
        padding: 16px;
    }
    
    .wmm-ai-input-wrapper {
        padding: 16px;
    }
}

/* Widget Mode (Floating) */
.wmm-ai-assistant-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.wmm-ai-assistant-widget .wmm-ai-assistant-container {
    height: 500px;
}

.wmm-ai-widget-toggle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.wmm-ai-widget-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.5);
}

.wmm-ai-assistant-widget.collapsed .wmm-ai-assistant-container {
    display: none;
}

/* Error States */
.wmm-ai-message.wmm-ai-error .wmm-ai-message-bubble {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

/* Loading States */
.wmm-ai-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Fade In Animation */
.wmm-ai-fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Rating System */
.wmm-ai-response-rating {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(0, 123, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.wmm-ai-rating-text {
    color: #666;
}

.wmm-ai-rate-up,
.wmm-ai-rate-down {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 4px 8px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wmm-ai-rate-up:hover {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.wmm-ai-rate-up:hover svg {
    stroke: white;
}

.wmm-ai-rate-down:hover {
    background: #f44336;
    border-color: #f44336;
    color: white;
}

.wmm-ai-rate-down:hover svg {
    stroke: white;
}

.wmm-ai-rated .wmm-ai-rate-up,
.wmm-ai-rated .wmm-ai-rate-down {
    opacity: 0.5;
    cursor: not-allowed;
}

.wmm-ai-rating-selected {
    background: #007bff !important;
    border-color: #007bff !important;
    color: white !important;
}

.wmm-ai-rating-selected svg {
    stroke: white !important;
}

.wmm-ai-rating-thanks {
    color: #4CAF50;
    font-weight: 500;
} 
button.wmm-ai-clear-button.wmm-ai-end-button {
    color: green;
    background: #fff;
    border: 1px solid green;
}
button.wmm-ai-clear-button.wmm-ai-end-button svg {
    width: 26px;
    height: 26px;
    fill: green;
}