/**
 * FlexJob Chatbot Styles
 * Extracted from bot_chat.jsp
 * Version: 1.0.0
 * Created: 2025-01-15
 */

/* Import Design System */
@import url('design-system.css');

/* Override CSS Variables (legacy support) */
:root {
    --primary-orange: var(--color-primary);
    --dark-orange: var(--color-primary-dark);
    --light-orange: var(--color-primary-light);
}

/* CHAT BUBBLE STYLES */
.chat-bubble {
    position: fixed;
    bottom: var(--spacing-6);
    right: var(--spacing-6);
    width: var(--spacing-16);
    height: var(--spacing-16);
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--dark-orange) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-primary-lg);
    transition: all var(--transition-base);
    z-index: var(--z-index-notification);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.chat-bubble:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 32px rgba(255, 102, 0, 0.5);
}

.chat-bubble.active {
    transform: scale(0.9);
}

.chat-bubble-icon {
    font-size: 28px;
    transition: transform 0.3s ease;
}

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

.chat-container {
    position: fixed;
    bottom: 100px;
    right: var(--spacing-6);
    width: 420px;
    height: 650px;
    background: var(--color-white);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    z-index: calc(var(--z-index-notification) - 1);
    overflow: hidden;
    animation: slideUp var(--transition-base);
}

.chat-container.active {
    display: flex;
}

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

.chat-header {
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--dark-orange) 100%);
    color: var(--color-white);
    padding: var(--spacing-5);
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    position: relative;
    flex-shrink: 0;
}

.chat-header.offline {
    background: linear-gradient(135deg, var(--color-secondary-light) 0%, var(--color-secondary) 100%);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.chat-header-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.chat-header-status {
    font-size: 12px;
    opacity: 0.95;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.chat-new-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.1);
    font-size: 13px;
    border: none;
    color: white;
    white-space: nowrap;
    font-weight: 500;
}

.chat-new-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.chat-new-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.1);
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    position: relative;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 102, 0, 0.2);
    border-radius: 3px;
}

/* LOADING STATE */
.chat-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    flex-direction: column;
}

.chat-loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 15px;
    color: #64748b;
    font-size: 14px;
    text-align: center;
}

.chat-message {
    display: flex;
    margin-bottom: 16px;
    animation: messageSlide 0.3s ease;
}

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

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

.message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--dark-orange) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot .message-bubble {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

/* ================================================
   FEEDBACK BUTTONS STYLES
   ================================================ */

.feedback-container {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    opacity: 0;
    animation: fadeIn 0.3s ease 0.5s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.feedback-container.hidden {
    display: none;
}

.feedback-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.feedback-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: var(--primary-orange);
    color: var(--primary-orange);
    transform: translateY(-2px);
}

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

.feedback-btn.selected {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
    color: white;
    pointer-events: none;
}

.feedback-btn.selected.thumbs-up {
    background: #10b981;
    border-color: #10b981;
}

.feedback-btn.selected.thumbs-down {
    background: #ef4444;
    border-color: #ef4444;
}

.feedback-btn i {
    font-size: 14px;
}

.feedback-thanks {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
    margin-left: 8px;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 100px;
    right: 24px;
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid #10b981;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-notification.success {
    border-left-color: #10b981;
}

.toast-notification.error {
    border-left-color: #ef4444;
}

.toast-notification .toast-icon {
    font-size: 18px;
}

.toast-notification.success .toast-icon {
    color: #10b981;
}

.toast-notification.error .toast-icon {
    color: #ef4444;
}

.toast-notification .toast-message {
    font-size: 13px;
    color: #1e293b;
    font-weight: 500;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-orange);
    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.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.suggestion-btn {
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-btn:hover {
    background: var(--primary-orange);
    color: white;
    border-color: var(--primary-orange);
}

.data-summary {
    margin-top: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 12px;
}

.chat-input-container {
    padding: 16px 20px 20px;
    background: white;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
    resize: none;
    max-height: 100px;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--primary-orange);
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--dark-orange) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

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

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

.chat-send-btn.loading {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

/* MARKDOWN FORMATTING STYLES */
.md-h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-orange);
    margin: 12px 0 8px 0;
    border-bottom: 2px solid var(--primary-orange);
    padding-bottom: 6px;
}

.md-h2 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 10px 0 6px 0;
    border-left: 4px solid var(--primary-orange);
    padding-left: 8px;
}

.md-h3 {
    font-size: 16px;
    font-weight: 600;
    color: #334155;
    margin: 8px 0 4px 0;
}

.md-list {
    margin: 8px 0;
    padding-left: 0;
    list-style: none;
}

.md-ol-item {
    position: relative;
    padding-left: 28px;
    margin-bottom: 6px;
    line-height: 1.6;
}

.md-ol-item::before {
    content: attr(data-num) ".";
    position: absolute;
    left: 0;
    font-weight: 700;
    color: var(--primary-orange);
}

.md-ul-item {
    position: relative;
    padding-left: 20px;
    margin-bottom: 6px;
    line-height: 1.6;
}

.md-ul-item::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: 700;
    color: var(--primary-orange);
    font-size: 18px;
}

.md-list .md-list {
    margin-top: 4px;
    margin-left: 16px;
}

.md-list .md-list .md-ul-item::before {
    content: "◦";
    font-size: 16px;
}

.md-code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: #e65c00;
    border: 1px solid #e2e8f0;
}

.md-link {
    color: var(--primary-orange);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.md-link:hover {
    border-bottom-color: var(--primary-orange);
}

.md-quote {
    border-left: 4px solid #e2e8f0;
    padding-left: 12px;
    margin: 8px 0;
    color: #64748b;
    font-style: italic;
}

.md-code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    margin: 8px 0;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 8px;
    margin: 10px;
    text-align: center;
    font-size: 13px;
}

.chat-messages a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

.welcome-message {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.welcome-message p {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .chat-container {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        right: 16px;
    }

    .chat-bubble {
        bottom: 16px;
        right: 16px;
    }
}
