/* Chatbot Styles */
.chatbot-trigger {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    padding: 1rem;
    border-radius: 9999px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    transform: scale(1);
    border: none;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.chatbot-trigger:hover {
    transform: scale(1.05);
}

.chatbot-trigger.closed {
    background-color: #2563eb; /* blue-600 */
}

.chatbot-trigger.open {
    background-color: #ef4444; /* red-500 */
    transform: rotate(90deg);
}

.chatbot-window {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    width: 24rem;
    height: 32rem;
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 9998;
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0; /* slate-200 */
    animation: fadeInUp 0.3s ease-out;
}

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

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

/* Header */
.chatbot-header {
    background: linear-gradient(to right, #2563eb, #4f46e5); /* blue-600 to indigo-600 */
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.chatbot-title {
    font-weight: bold;
    font-size: 0.875rem;
}

.chatbot-subtitle {
    font-size: 0.75rem;
    color: #dbeafe; /* blue-100 */
    display: flex;
    align-items: center;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    background-color: #4ade80; /* green-400 */
    border-radius: 50%;
    margin-right: 0.25rem;
}

.reset-btn {
    font-size: 0.75rem;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: none;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reset-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8fafc; /* slate-50 */
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Hide scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.message {
    display: flex;
    width: 100%;
}

.message.user {
    justify-content: flex-end;
}

.message.model {
    justify-content: flex-start;
}

.message-content {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.message.user .message-content {
    background-color: #2563eb; /* blue-600 */
    color: white;
    border-bottom-right-radius: 0;
}

.message.model .message-content {
    background-color: white;
    color: #1e293b; /* slate-800 */
    border: 1px solid #f1f5f9; /* slate-100 */
    border-bottom-left-radius: 0;
}

/* Loading indicator */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
}

.typing-dot {
    width: 0.5rem;
    height: 0.5rem;
    background-color: #94a3b8; /* slate-400 */
    border-radius: 50%;
    animation: bounce 1s infinite;
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Input Area */
.chatbot-input-area {
    padding: 0.75rem;
    background-color: white;
    border-top: 1px solid #e2e8f0; /* slate-200 */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-input {
    flex: 1;
    background-color: #f1f5f9; /* slate-100 */
    border: none;
    border-radius: 9999px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #1e293b; /* slate-800 */
    outline: none;
    transition: all 0.2s;
}

/* ==========================================================================
   CHATBOT DARK MODE
   ========================================================================== */
html[data-theme="dark"] .chatbot-window {
  background-color: #1e1e32;
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .message.model .message-content {
  background-color: #1f1f35;
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .chatbot-input-area {
  background-color: #1a1a2e;
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .chatbot-input {
  background-color: #1f1f35;
  color: #f1f5f9;
}

html[data-theme="dark"] .chatbot-input:focus {
  background-color: #252545;
}

html[data-theme="dark"] .chatbot-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.chatbot-input:focus {
    background-color: white;
    box-shadow: 0 0 0 2px #3b82f6; /* blue-500 ring */
}

.chatbot-send-btn {
    background-color: #2563eb; /* blue-600 */
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.chatbot-send-btn:hover {
    background-color: #1d4ed8; /* blue-700 */
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-send-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Trigger label */
.chatbot-trigger::after {
    content: 'AI Assistant';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    background: #1e293b;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.chatbot-trigger.closed:hover::after {
    opacity: 1;
}

/* Footer note inside chat window */
.chatbot-footer-note {
    padding: 0.5rem 0.75rem 0.65rem;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.4;
    text-align: center;
}

.chatbot-footer-link {
    display: block;
    margin-top: 0.25rem;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.chatbot-footer-link:hover {
    text-decoration: underline;
}

html[data-theme="dark"] .chatbot-footer-note {
    background-color: #1a1a2e;
    border-top-color: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

html[data-theme="dark"] .chatbot-footer-link {
    color: #60a5fa;
}

/* Builder pages: hide the floating launcher to avoid colliding with the
   dedicated builder AI sidebar (added in Phase 4). */
body.resume-builder-page #chatbot-container,
body.cover-letter-builder-page #chatbot-container {
    display: none !important;
}

