/* ===========================
   AI CHATBOT - APPLE MINIMAL STYLE
   WITH DARK/LIGHT MODE SWITCHING
   =========================== */

/* ===========================
   FLOATING CHAT BUTTON
   =========================== */

/* Default (Dark Mode) - White button, black icon */
.chat-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease, background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-fab-icon {
    width: 24px;
    height: 24px;
    fill: #000;
    transition: fill 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.chat-fab.active {
    transform: rotate(90deg);
}

/* White Mode - Black button, white icon */
:root.white-mode .chat-fab {
    background: #000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

:root.white-mode .chat-fab-icon {
    fill: #fff;
}

:root.white-mode .chat-fab:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* ===========================
   CHAT WINDOW
   =========================== */

/* Default (Dark Mode) - Dark window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: #1a1a1a;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* White Mode - Light window */
:root.white-mode .chat-window {
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ===========================
   CHAT HEADER
   =========================== */

/* Default (Dark Mode) - White header */
.chat-header {
    background: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chat-header-name {
    font-size: 16px;
    font-weight: 600;
    color: #000;
    transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-header-status {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #34c759;
    border-radius: 50%;
}

.chat-close {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #000;
    cursor: pointer;
    font-size: 24px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* White Mode - Black header */
:root.white-mode .chat-header {
    background: #000;
}

:root.white-mode .chat-avatar {
    background: #fff;
    color: #000;
}

:root.white-mode .chat-header-name {
    color: #fff;
}

:root.white-mode .chat-header-status {
    color: rgba(255, 255, 255, 0.7);
}

:root.white-mode .chat-close {
    color: #fff;
}

:root.white-mode .chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===========================
   CHAT MESSAGES
   =========================== */

/* Default (Dark Mode) */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #1a1a1a;
    scroll-behavior: smooth;
    transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-messages::-webkit-scrollbar {
    width: 0;
    display: none;
}

/* White Mode */
:root.white-mode .chat-messages {
    background: #fff;
}

/* ===========================
   MESSAGE BUBBLES
   =========================== */

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    animation: messageIn 0.3s ease;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Default (Dark Mode) - Bot: dark gray, User: white */
.message.bot {
    background: #2a2a2a;
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

.message.user {
    background: #fff;
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

/* White Mode - Bot: light gray, User: black */
:root.white-mode .message.bot {
    background: #f1f1f1;
    color: #000;
}

:root.white-mode .message.user {
    background: #000;
    color: #fff;
}

/* Links inside bot messages */
.message.bot a {
    color: #007aff;
    text-decoration: none;
    word-break: break-all;
}

.message.bot a:hover {
    text-decoration: underline;
}

.message.bot strong {
    font-weight: 600;
}

/* ===========================
   TYPING INDICATOR
   =========================== */

/* Default (Dark Mode) */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #2a2a2a;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    max-width: 60px;
    transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* White Mode */
:root.white-mode .typing-indicator {
    background: #f1f1f1;
}

:root.white-mode .typing-indicator span {
    background: #999;
}

/* ===========================
   QUICK REPLIES
   =========================== */

/* Default (Dark Mode) */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 15px;
    background: #1a1a1a;
    transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-reply {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
}

/* White Mode */
:root.white-mode .quick-replies {
    background: #fff;
}

:root.white-mode .quick-reply {
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #000;
}

:root.white-mode .quick-reply:hover {
    background: #f5f5f5;
    border-color: #000;
}

/* ===========================
   CHAT INPUT
   =========================== */

/* Default (Dark Mode) */
.chat-input-container {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    align-items: center;
    background: #1a1a1a;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-input {
    flex: 1;
    background: #2a2a2a;
    border: none;
    border-radius: 20px;
    padding: 12px 18px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input::placeholder {
    color: #666;
}

.chat-input:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-send svg {
    width: 18px;
    height: 18px;
    fill: #000;
}

.chat-send:hover {
    transform: scale(1.05);
}

.chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* White Mode */
:root.white-mode .chat-input-container {
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

:root.white-mode .chat-input {
    background: #f5f5f5;
    color: #000;
}

:root.white-mode .chat-input::placeholder {
    color: #999;
}

:root.white-mode .chat-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

:root.white-mode .chat-send {
    background: #000;
}

:root.white-mode .chat-send svg {
    fill: #fff;
}

/* ===========================
   MOBILE RESPONSIVE
   =========================== */

@media (max-width: 480px) {
    .chat-window {
        width: calc(100% - 20px);
        height: calc(100% - 120px);
        right: 10px;
        bottom: 80px;
        border-radius: 12px;
    }
    
    .chat-fab {
        right: 20px;
        bottom: 20px;
        width: 50px;
        height: 50px;
    }
    
    .chat-fab-icon {
        width: 22px;
        height: 22px;
    }
}