/* css/style.css */
:root {
    --sky-blue: #38bdf8;
    --sky-blue-light: #e0f2fe;
    --sky-blue-dark: #0284c7;
    --sky-blue-soft: #bae6fd;
    --white: #ffffff;
    --bg: #f8fbff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --sponsored-gold: #fbbf24;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    
    min-height: 90vh;
    padding: 0px;
}

/* ===== Container ===== */
.chat-container {
    width: 100%;
    height: 92vh;
    background: var(--white);
    border-radius:0px 0px 0px 20px;
    box-shadow: 0 10px 40px rgba(56, 189, 248, 0.15),
                0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--sky-blue-light);
    animation: containerIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes containerIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== Header ===== */
.chat-header {
    background: linear-gradient(135deg, var(--sky-blue) 0%, var(--sky-blue-dark) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.chat-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    pointer-events: none;
}

.mode-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 16px;
    z-index: 1;
}

.bot-icon {
    font-size: 26px;
    animation: pulse 2.5s ease-in-out infinite;
}

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

.return-btn {
    background: rgba(255, 255, 255, 0.18);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(6px);
    transition: all 0.25s ease;
    z-index: 1;
    margin-left: -10px;
}

.return-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ===== Messages ===== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(56, 189, 248, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(56, 189, 248, 0.06) 0%, transparent 50%);
    scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--sky-blue-soft);
    border-radius: 3px;
}

.message {
    margin-bottom: 14px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    opacity: 0;
    animation: messageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Animation d'apparition */
@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Animation d'envoi utilisateur */
.user-message {
    flex-direction: row-reverse;
    animation: userMessageIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes userMessageIn {
    from {
        opacity: 0;
        transform: translateY(20px) translateX(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1);
    }
}

.bot-message .message-content {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px 14px 14px 4px;
    padding: 11px 15px;
    max-width: 82%;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(56, 189, 248, 0.06);
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--sky-blue) 0%, var(--sky-blue-dark) 100%);
    color: white;
    border-radius: 14px 14px 4px 14px;
    padding: 11px 15px;
    max-width: 82%;
    box-shadow: 0 3px 12px rgba(56, 189, 248, 0.3);
}

.message-content p {
    line-height: 1.45;
}

/* ===== Product Cards ===== */
.product-card {
    background: var(--white);
    border-radius: 14px;
    padding: 16px;
    margin: 10px 0;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.08);
    border: 1px solid var(--sky-blue-light);
    border-left: 4px solid var(--sky-blue);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.product-card.sponsored {
    border-left: 4px solid var(--sponsored-gold);
    background: linear-gradient(135deg, #fffbeb 0%, var(--white) 60%);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.18);
    border-color: var(--sky-blue-soft);
}

.product-title {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    font-size: 15px;
}

.product-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--sky-blue-dark);
    margin: 4px 0;
}

.product-seller {
    color: var(--text-light);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.online-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== Buttons ===== */
.interest-btn {
    background: linear-gradient(135deg, var(--sky-blue) 0%, var(--sky-blue-dark) 100%);
    color: white;
    border: none;
    padding: 9px 22px;
    border-radius: 22px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.interest-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.45);
}

.interest-btn:active {
    transform: translateY(0) scale(0.97);
}

/* ===== Quick actions ===== */
.quick-actions,
.suggestions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.quick-btn {
    background: var(--white);
    color: var(--sky-blue-dark);
    border: 1.5px solid var(--sky-blue-soft);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.25s ease;
    animation: btnIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.quick-btn:nth-child(1) { animation-delay: 0.05s; }
.quick-btn:nth-child(2) { animation-delay: 0.1s; }
.quick-btn:nth-child(3) { animation-delay: 0.15s; }
.quick-btn:nth-child(4) { animation-delay: 0.2s; }

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

.quick-btn:hover {
    background: var(--sky-blue);
    color: white;
    border-color: var(--sky-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.suggestion-btn {
    background: var(--white);
    border: 1.5px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: all 0.25s ease;
}

.suggestion-btn:hover {
    border-color: var(--sky-blue);
    color: var(--sky-blue-dark);
    background: var(--sky-blue-light);
}

/* ===== Input ===== */
.input-container {
    padding: 14px 16px;
    background: var(--white);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
}

#messageInput {
    flex: 1;
    padding: 12px 18px;
    border: 1.5px solid var(--border);
    border-radius: 26px;
    font-size: 15px;
    outline: none;
    background: var(--bg);
    color: var(--text);
    transition: all 0.25s ease;
}

#messageInput::placeholder {
    color: #94a3b8;
}

#messageInput:focus {
    border-color: var(--sky-blue);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

#sendBtn {
    background: linear-gradient(135deg, var(--sky-blue) 0%, var(--sky-blue-dark) 100%);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
    flex-shrink: 0;
}

#sendBtn:hover {
    transform: scale(1.08) rotate(-8deg);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
}

#sendBtn:active {
    transform: scale(0.94);
}

/* ===== Typing indicator ===== */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px 14px 14px 4px;
    width: fit-content;
    box-shadow: 0 1px 3px rgba(56, 189, 248, 0.06);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--sky-blue);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ===== Seller name ===== */
.seller-name {
    cursor: pointer;
    transition: color 0.2s ease;
}

.seller-name:hover {
    color: var(--sky-blue-dark);
}

/* ===== Shirtname (toast) ===== */
@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}