/* Chat Widget CSS - InkMyBook Brand Style */
:root {
    --chat-primary: #f20091;
    /* Website Primary (Pink) */
    --chat-secondary: #007fed;
    /* Website Secondary (Blue) */
    --chat-bg: #ffffff;
    --chat-text: #333333;
    --chat-border: #e0e0e0;
    --chat-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    --chat-width: 320px;
    --chat-height: 450px;
    --chat-header-height: 120px;
}

/* Floating Button */
.chat-widget-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--chat-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--chat-shadow);
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-widget-btn:hover {
    transform: scale(1.1);
}

.chat-widget-btn i {
    font-size: 28px;
}

/* Chat Window */
.chat-widget-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: var(--chat-width);
    height: var(--chat-height);
    background-color: var(--chat-bg);
    border-radius: 12px;
    box-shadow: var(--chat-shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-widget-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chat-header {
    background-color: var(--chat-primary);
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
    color: white;
    padding: 20px;
    height: var(--chat-header-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.chat-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.chat-close-btn:hover {
    opacity: 1;
}

/* Toggle Tabs (Pill) */
.chat-toggle {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 4px;
    display: flex;
    margin-bottom: 20px;
}

.chat-toggle-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 6px 20px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-toggle-btn.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-toggle-btn:hover:not(.active) {
    color: white;
}

/* Avatars */
.chat-avatars {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--chat-primary);
    margin-left: -10px;
    background-color: #eee;
    background-size: cover;
    background-position: center;
}

.chat-avatar:first-child {
    margin-left: 0;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.chat-header-status {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #4cd137;
    border-radius: 50%;
}

/* Body */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Welcome Message Block */
.welcome-block {
    background-color: var(--chat-primary);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(242, 0, 145, 0.2);
}

.welcome-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.welcome-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.welcome-list li {
    margin-bottom: 8px;
    font-size: 14px;
    opacity: 0.95;
    position: relative;
    padding-left: 15px;
}

.welcome-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
}

.welcome-footer {
    margin-top: 15px;
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
}

.welcome-footer a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
}

/* Messages */
.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.chat-message.ai,
.chat-message.received {
    background-color: #f1f3f5;
    color: var(--chat-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.user,
.chat-message.sent {
    background-color: var(--chat-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-timestamp {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* Search Tab */
.search-container {
    padding: 10px 0;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.search-input-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
}

.search-input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--chat-primary);
}

.frequent-searches h6 {
    font-size: 12px;
    font-weight: 700;
    color: #adb5bd;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    cursor: pointer;
}

.search-item:hover {
    color: var(--chat-primary);
}

.search-item i {
    font-size: 12px;
    color: #adb5bd;
}

/* Footer / Input */
.chat-footer {
    padding: 15px;
    background-color: white;
    border-top: 1px solid #f1f3f5;
}

.chat-input-wrapper {
    position: relative;
}

.chat-input-field {
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    color: #495057;
    padding-bottom: 40px;
    /* Space for icons */
}

.chat-input-field::placeholder {
    color: #adb5bd;
}

.chat-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex;
    gap: 15px;
}

.chat-action-icon {
    color: #adb5bd;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
}

.chat-action-icon:hover {
    color: var(--chat-primary);
}

.chat-send-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    color: var(--chat-primary);
    font-size: 18px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-send-icon:hover {
    opacity: 1;
}

/* Emoji Picker Override */
emoji-picker {
    position: absolute;
    bottom: 70px;
    left: 20px;
    z-index: 1001;
    --num-columns: 6;
    --emoji-size: 24px;
    height: 300px;
    width: 300px;
    display: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

emoji-picker.active {
    display: block;
}

/* Audio Recording State */
.recording-indicator {
    display: none;
    align-items: center;
    gap: 5px;
    color: #dc3545;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
}

.recording-indicator.active {
    display: flex;
}

.recording-dot {
    width: 8px;
    height: 8px;
    background-color: #dc3545;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .chat-widget-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-widget-btn {
        bottom: 20px;
        right: 20px;
    }
}