/**
 * CinergiAssist Chatbot Styles
 * Modern, accessible floating chat widget
 */

/* === CHAT BUTTON === */
.chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0066FF 0%, #00D9FF 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 102, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    color: white;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(0, 102, 255, 0.4);
}

.chat-button.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.chat-button svg {
    width: 28px;
    height: 28px;
}

.chat-button__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #FF6B35;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

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

/* === CHAT WINDOW === */
.chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    overflow: hidden;
}

.chat-window.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* === CHAT HEADER === */
.chat-header {
    background: linear-gradient(135deg, #0066FF 0%, #00D9FF 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.chat-header__info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header__avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.chat-header__text h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    font-family: var(--font-display, 'Outfit', sans-serif);
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin: 4px 0 0 0;
    opacity: 0.9;
}

.chat-status__dot {
    width: 8px;
    height: 8px;
    background: #00FF88;
    border-radius: 50%;
    animation: blink 2s infinite;
}

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

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

.chat-header__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* === CHAT MESSAGES === */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #F7FAFC;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #CBD5E0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #A0AEC0;
}

/* === CHAT MESSAGE === */
.chat-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    animation: slideIn 0.3s ease-out;
}

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

.chat-message--user {
    align-items: flex-end;
}

.chat-message__content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message--bot .chat-message__content {
    background: white;
    color: #1A1F36;
    border: 1px solid #E2E8F0;
    border-radius: 12px 12px 12px 4px;
}

.chat-message--user .chat-message__content {
    background: linear-gradient(135deg, #0066FF 0%, #00D9FF 100%);
    color: white;
    border-radius: 12px 12px 4px 12px;
}

.chat-message__time {
    font-size: 11px;
    color: #A0AEC0;
    padding: 0 4px;
}

/* Welcome message styling */
.welcome-message h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #0066FF;
}

.welcome-message p {
    margin: 0 0 12px 0;
}

.welcome-message ul {
    margin: 8px 0 12px 20px;
    padding: 0;
}

.welcome-message li {
    margin: 4px 0;
}

/* Chat links */
.chat-link {
    color: #0066FF;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.chat-link:hover {
    border-bottom-color: #0066FF;
}

/* === TYPING INDICATOR === */
.typing-indicator .chat-message__content {
    padding: 12px 20px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

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

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

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

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

/* === QUICK ACTIONS === */
.chat-quick-actions {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: white;
    border-top: 1px solid #E2E8F0;
}

.quick-action {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-weight: 500;
    color: #2D3748;
}

.quick-action:hover {
    background: #F7FAFC;
    border-color: #0066FF;
    color: #0066FF;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.1);
}

/* === CHAT INPUT === */
.chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #E2E8F0;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--font-primary, 'Plus Jakarta Sans', sans-serif);
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    max-height: 120px;
    line-height: 1.5;
}

.chat-input:focus {
    border-color: #0066FF;
}

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

.chat-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #0066FF 0%, #00D9FF 100%);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.chat-send:active {
    transform: scale(0.95);
}

/* === CHAT FOOTER === */
.chat-footer {
    padding: 12px 20px;
    background: #F7FAFC;
    border-top: 1px solid #E2E8F0;
    text-align: center;
}

.chat-footer small {
    font-size: 11px;
    color: #A0AEC0;
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
    .chat-button {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .chat-button svg {
        width: 24px;
        height: 24px;
    }

    .chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chat-header {
        border-radius: 0;
    }

    .chat-quick-actions {
        grid-template-columns: 1fr;
    }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
    .chat-button,
    .chat-window,
    .chat-message,
    .quick-action,
    .chat-send {
        animation: none;
        transition: none;
    }

    .typing-dots span {
        animation: none;
    }

    .chat-status__dot {
        animation: none;
    }

    .chat-button__badge {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .chat-button {
        border: 2px solid currentColor;
    }

    .chat-message__content {
        border-width: 2px;
    }

    .quick-action {
        border-width: 2px;
    }
}
