/**
 * SiteChat — Chat Widget Styles
 */

/* Widget container */
#sitechat-widget {
    position: fixed;
    bottom: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

#sitechat-widget.sitechat-position-right {
    right: 24px;
}

#sitechat-widget.sitechat-position-left {
    left: 24px;
}

/* Toggle button */
#sitechat-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    color: #fff;
    padding: 14px 22px 14px 18px;
    border-radius: 24px 24px 6px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    font-family: inherit;
}
.sitechat-position-left #sitechat-toggle {
    border-radius: 24px 24px 24px 6px;
}

/* ── Chat Images ── */
.sitechat-chat-img {
    max-width: 200px;
    border-radius: 8px;
    margin: 4px 0;
    cursor: pointer;
    display: block;
    border: 1px solid rgba(0,0,0,0.1);
}
.sitechat-chat-img:hover {
    opacity: 0.9;
}

/* ── Rich Cards ── */
.sitechat-card {
    border: 1px solid #e8e8eb;
    border-radius: 12px;
    overflow: hidden;
    margin: 4px 0;
    background: #fff;
    max-width: 280px;
}
.sitechat-card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.sitechat-card-body {
    padding: 12px;
}
.sitechat-card-title {
    font-weight: 700;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 4px;
}
.sitechat-card-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 10px;
}
.sitechat-card-btn {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 6px;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 600;
    transition: opacity 0.2s;
}
.sitechat-card-btn:hover {
    opacity: 0.85;
}
.sitechat-card-price {
    font-size: 16px;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 8px;
}
.sitechat-card-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: #ecfdf5;
    color: #059669;
    margin-bottom: 6px;
}

/* ── Entrance Animations ── */
.sitechat-anim-bounce #sitechat-toggle {
    animation: sc-bounce 2s ease infinite;
}
.sitechat-anim-pulse #sitechat-toggle {
    animation: sc-pulse 2s ease-in-out infinite;
}
.sitechat-anim-slide #sitechat-toggle {
    animation: sc-slide 0.6s ease-out forwards;
}
.sitechat-anim-fade #sitechat-toggle {
    animation: sc-fade 1s ease-out forwards;
}
.sitechat-anim-jiggle #sitechat-toggle {
    animation: sc-jiggle 0.6s ease 3s 3;
}
.sitechat-anim-heartbeat #sitechat-toggle {
    animation: sc-heartbeat 1.5s ease-in-out infinite;
}

@keyframes sc-bounce {
    0%, 100% { transform: translateY(0); }
    20% { transform: translateY(-12px); }
    40% { transform: translateY(-6px); }
}
@keyframes sc-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
    50% { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0,0,0,0.3); }
}
@keyframes sc-slide {
    from { transform: translateY(80px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes sc-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes sc-jiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
    75% { transform: rotate(-3deg); }
}
@keyframes sc-heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.12); }
    30% { transform: scale(1); }
    45% { transform: scale(1.08); }
    60% { transform: scale(1); }
}

#sitechat-toggle:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.sitechat-toggle-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.sitechat-toggle-icon {
    width: 22px;
    height: 22px;
    color: #fff;
}

.sitechat-toggle-label {
    white-space: nowrap;
}

/* Badge */
.sitechat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Chat window */
#sitechat-chat {
    position: absolute;
    bottom: 60px;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sitechat-position-right #sitechat-chat {
    right: 0;
}

.sitechat-position-left #sitechat-chat {
    left: 0;
}

#sitechat-chat.sitechat-closed {
    display: none;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
}

#sitechat-chat.sitechat-open {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Header */
.sitechat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: #fff;
    flex-shrink: 0;
}

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

.sitechat-avatar-default {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.sitechat-avatar-default svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.sitechat-header-info {
    flex: 1;
}

.sitechat-header-info strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.sitechat-header-info span {
    font-size: 12px;
    opacity: 0.85;
}

#sitechat-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#sitechat-close:hover {
    opacity: 1;
}

#sitechat-close svg {
    width: 18px;
    height: 18px;
}

/* Messages */
.sitechat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    min-height: 200px;
    max-height: 300px;
}

.sitechat-msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    animation: sitechat-fadeIn 0.2s ease;
}

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

.sitechat-msg-bot {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    margin-right: auto;
}

.sitechat-msg-user {
    background: #667eea;
    color: #fff;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.sitechat-msg a {
    color: inherit;
    text-decoration: underline;
}

.sitechat-msg-bot a {
    color: #667eea;
}

/* Thumbs up/down */
.sitechat-thumbs {
    margin-top: 6px;
    font-size: 13px;
}

.sitechat-thumb {
    cursor: pointer;
    margin-right: 6px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.sitechat-thumb:hover {
    opacity: 1;
}

/* Typing indicator */
.sitechat-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #f3f4f6;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin-bottom: 12px;
}

.sitechat-typing span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: sitechat-dot 1.4s infinite ease-in-out;
}

.sitechat-typing span:nth-child(1) { animation-delay: 0s; }
.sitechat-typing span:nth-child(2) { animation-delay: 0.2s; }
.sitechat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sitechat-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Quick replies */
.sitechat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 12px;
}

.sitechat-qr {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.sitechat-qr:hover {
    background: #f9fafb;
    border-color: #667eea;
    color: #667eea;
}

/* Input row */
.sitechat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
}

#sitechat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#sitechat-input:focus {
    border-color: #667eea;
}

#sitechat-send {
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

#sitechat-send:hover {
    opacity: 0.85;
}

#sitechat-send svg {
    width: 18px;
    height: 18px;
}

/* Footer */
.sitechat-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid #f3f4f6;
}

#sitechat-start-over {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    transition: color 0.2s;
}

#sitechat-start-over:hover {
    color: #374151;
}

.sitechat-powered {
    font-size: 11px;
    color: #9ca3af;
}

.sitechat-powered a {
    color: #667eea;
    text-decoration: none;
}

.sitechat-powered a:hover {
    text-decoration: underline;
}

/* Rating modal */
.sitechat-rating-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    z-index: 100;
}

.sitechat-rating-wrap {
    text-align: center;
    padding: 16px 20px;
}

.sitechat-rating-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px;
}

.sitechat-stars {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 8px;
}

.sitechat-star {
    font-size: 28px;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.15s, transform 0.15s;
}

.sitechat-star:hover,
.sitechat-star.sitechat-star-hover {
    color: #fbbf24;
    transform: scale(1.15);
}

.sitechat-star.sitechat-star-selected {
    color: #fbbf24;
}

.sitechat-rating-skip {
    margin-top: 4px;
}

.sitechat-rating-skip a {
    color: #9ca3af;
    font-size: 13px;
    text-decoration: none;
}

.sitechat-rating-skip a:hover {
    color: #374151;
}

/* Responsive */
@media (max-width: 480px) {
    #sitechat-chat {
        width: calc(100vw - 32px);
        bottom: 56px;
        max-height: 70vh;
    }

    #sitechat-widget {
        bottom: 16px;
    }

    #sitechat-widget.sitechat-position-right {
        right: 16px;
    }

    #sitechat-widget.sitechat-position-left {
        left: 16px;
    }

    .sitechat-toggle-label {
        display: none;
    }

    #sitechat-toggle {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
    }
}
