/**
 * AI Chat Widget - Frontend Styles
 */

/* Widget Container */
.acw-chat-button {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Position Variants */
.acw-chat-button[data-position="right"] {
    right: 20px;
    bottom: 20px;
}

.acw-chat-button[data-position="left"] {
    left: 20px;
    bottom: 20px;
}

.acw-chat-button[data-position="center-right"] {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.acw-chat-button[data-position="center-left"] {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

/* Button Styles */
.acw-chat-button-inner {
    display: block;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    transition: transform 0.2s ease;
}

.acw-chat-button-inner:hover {
    transform: scale(1.05);
}

.acw-chat-button-inner:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.acw-button-fill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0073aa;
    color: #fff;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s ease;
}

.acw-button-fill:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.acw-ai-icon {
    width: 20px;
    height: 20px;
}

/* Popup Styles */
.acw-chat-popup {
    position: fixed;
    z-index: 999998;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 320px;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    visibility: hidden;
    overflow: hidden;
}

.acw-chat-popup.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
}

/* Popup Position Variants */
.acw-chat-popup[data-position="right"] {
    right: 20px;
    bottom: 80px;
    transform-origin: bottom right;
}

.acw-chat-popup[data-position="left"] {
    left: 20px;
    bottom: 80px;
    transform-origin: bottom left;
}

.acw-chat-popup[data-position="center-right"] {
    right: 80px;
    top: 50%;
    transform-origin: right center;
    transform: scale(0.9) translateY(-50%);
}

.acw-chat-popup[data-position="center-right"].active {
    transform: scale(1) translateY(-50%);
}

.acw-chat-popup[data-position="center-left"] {
    left: 80px;
    top: 50%;
    transform-origin: left center;
    transform: scale(0.9) translateY(-50%);
}

.acw-chat-popup[data-position="center-left"].active {
    transform: scale(1) translateY(-50%);
}

/* Popup Header */
.acw-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 16px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.acw-chat-heading {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.acw-close-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.acw-close-button:hover {
    background: #eee;
}

.acw-close-button svg {
    width: 16px;
    height: 16px;
    color: #666;
}

/* AI Platforms List */
.acw-ai-platforms {
    padding: 8px 0;
}

.acw-ai-model {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.acw-ai-model:hover {
    background: #f5f7fa;
}

.acw-ai-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 0 8px;
    border-radius: 8px;
}

.acw-ai-logo {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: contain;
}

.acw-ai-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.acw-external-icon {
    width: 14px;
    height: 14px;
    color: #999;
    flex-shrink: 0;
}

/* Watermark */
.acw-watermark {
    text-align: center;
    padding: 12px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.acw-watermark a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #999;
    text-decoration: none;
    transition: color 0.2s ease;
}

.acw-watermark a:hover {
    color: #666;
}

.acw-watermark svg {
    opacity: 0.6;
}

/* Mobile Responsiveness */
@media screen and (max-width: 480px) {
    .acw-chat-popup {
        left: 10px !important;
        right: 10px !important;
        bottom: 80px !important;
        min-width: auto;
        max-width: none;
        transform-origin: bottom center;
    }
    
    .acw-chat-popup[data-position="center-right"],
    .acw-chat-popup[data-position="center-left"] {
        left: 10px !important;
        right: 10px !important;
        top: auto !important;
        transform: scale(0.9) translateY(10px);
        transform-origin: bottom center;
    }
    
    .acw-chat-popup[data-position="center-right"].active,
    .acw-chat-popup[data-position="center-left"].active {
        transform: scale(1) translateY(0);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .acw-chat-button-inner,
    .acw-chat-popup,
    .acw-button-fill,
    .acw-ai-model,
    .acw-close-button,
    .acw-watermark a {
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .acw-button-fill {
        border: 2px solid currentColor;
    }
    
    .acw-chat-popup {
        border: 2px solid #000;
    }
    
    .acw-close-button:hover {
        outline: 2px solid currentColor;
    }
}
