/* ===== UNIFIED CHATBOX v2 ===== */

/* Container */
.uc-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Toggle Button */
.uc-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D70018 0%, #B71525 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(215, 0, 24, 0.4);
    transition: all 0.3s ease;
    color: #fff;
    position: relative;
}

.uc-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(215, 0, 24, 0.5);
}

.uc-toggle.open {
    transform: rotate(180deg);
}

.uc-notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #FFD700;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #000;
    border: 2px solid #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Window */
.uc-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 550px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: windowIn 0.3s ease;
}

.uc-window.active {
    display: flex;
}

@keyframes windowIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header with Tabs */
.uc-header {
    background: linear-gradient(135deg, #D70018 0%, #B71525 100%);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.uc-tabs {
    display: flex;
    gap: 8px;
    flex: 1;
}

.uc-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.uc-tab:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.uc-tab.active {
    background: #fff;
    color: #D70018;
}

.uc-tab span {
    display: none;
}

@media (min-width: 400px) {
    .uc-tab span {
        display: inline;
    }
}

.uc-minimize-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.uc-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Admin Status Bar */
.uc-admin-status {
    background: #f8fafc;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    flex-shrink: 0;
}

.uc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.uc-status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.uc-status-dot.offline {
    background: #94a3b8;
}

.uc-status-text {
    color: #64748b;
}

/* Chat Areas */
.uc-chat-area {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.uc-chat-area.active {
    display: flex;
}

/* Messages Container */
.uc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

/* Scrollbar */
.uc-messages::-webkit-scrollbar {
    width: 5px;
}

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

.uc-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Message */
.uc-msg {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: msgIn 0.2s ease;
}

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

.uc-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.uc-msg.bot {
    align-self: flex-start;
}

.uc-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.uc-avatar.admin {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.uc-msg-content {
    background: #fff;
    padding: 10px 14px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.uc-msg.user .uc-msg-content {
    background: #D70018;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.uc-msg.bot .uc-msg-content {
    border-bottom-left-radius: 4px;
}

.uc-msg-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.uc-msg-text p {
    margin: 0 0 8px 0;
}

.uc-msg-text p:last-child {
    margin-bottom: 0;
}

.uc-msg-text ul {
    margin: 8px 0;
    padding-left: 20px;
}

.uc-msg-text li {
    margin-bottom: 4px;
}

.uc-msg-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
}

.uc-msg.user .uc-msg-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Typing Indicator */
.uc-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.uc-typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

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

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Area - Redesigned v3 */
.uc-input-area {
    padding: 14px 16px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.uc-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 28px;
    padding: 6px 6px 6px 16px;
    transition: all 0.3s ease;
}

.uc-input-wrapper:focus-within {
    border-color: #D70018;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(215, 0, 24, 0.1);
}

.uc-input-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    flex-shrink: 0;
}

.uc-input-area textarea {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 24px;
    line-height: 1.5;
    color: #1e293b;
    font-weight: 500;
}

.uc-input-area textarea::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.uc-input-area textarea::-webkit-scrollbar {
    width: 4px;
}

.uc-input-area textarea::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.uc-input-area button {
    width: 46px;
    height: 46px;
    border: none;
    background: linear-gradient(135deg, #D70018 0%, #ff1744 100%);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(215, 0, 24, 0.3);
}

.uc-input-area button:hover {
    transform: scale(1.08) rotate(-12deg);
    box-shadow: 0 6px 16px rgba(215, 0, 24, 0.45);
}

.uc-input-area button:active {
    transform: scale(0.95);
}

.uc-input-area button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Quick Questions Buttons */
.uc-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
    border-top: 1px solid #f1f5f9;
    background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
    flex-shrink: 0;
}

.uc-quick-btn {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.uc-quick-btn:hover {
    background: linear-gradient(135deg, #D70018 0%, #B71525 100%);
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 0, 24, 0.3);
}

.uc-quick-btn:active {
    transform: translateY(0);
}

.uc-quick-btn .uc-q-icon {
    font-size: 15px;
}

/* Product Cards */
.uc-product-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.uc-product-card {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.uc-product-card:hover {
    border-color: #D70018;
    box-shadow: 0 2px 8px rgba(215, 0, 24, 0.1);
}

.uc-product-card img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    background: #fff;
}

.uc-product-info {
    padding: 8px;
}

.uc-product-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    min-height: 31px;
}

.uc-product-price {
    font-size: 13px;
    font-weight: 700;
    color: #D70018;
    margin-top: 4px;
}

.uc-product-original {
    font-size: 11px;
    color: #94a3b8;
    text-decoration: line-through;
}

/* Empty State */
.uc-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.uc-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    color: #cbd5e1;
}

.uc-empty h4 {
    color: #475569;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.uc-empty p {
    margin: 0;
    font-size: 14px;
}

/* Links in messages */
.uc-msg-text a {
    color: #6366f1;
    text-decoration: underline;
}

.uc-msg.user .uc-msg-text a {
    color: #fff;
}

/* Mobile Responsive */
@media (max-width: 420px) {
    .uc-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .uc-container {
        bottom: 16px;
        right: 16px;
    }

    .uc-toggle {
        width: 56px;
        height: 56px;
    }
}
