/* ===========================
   ChainMind Assistant - Chat Styles
   =========================== */

:root {
    --color-primary: #4aa0ff;
    --color-primary-dark: #2980d9;
    --color-secondary: #c0c0c0;
    --color-background: #0a0a0a;
    --color-surface: #1a1a1a;
    --color-surface-light: #2a2a2a;
    --color-text: #ffffff;
    --color-text-secondary: #a0a0a0;
    --color-border: #333333;
    --color-success: #4caf50;
    --color-error: #f44336;
    --color-warning: #ff9800;

    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--color-background);
    color: var(--color-text);
    height: 100vh;
    overflow: hidden;
}

/* Chat Container */
.chat-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    background: var(--color-surface);
}

/* Header */
.chat-header {
    background: var(--color-surface-light);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.logo-image {
    height: 100px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 600;
}

.close-button {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.close-button:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

/* Progress Bar */
.progress-bar {
    height: 4px;
    background: var(--color-surface);
    margin-top: 1rem;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
    width: 0%;
    transition: width 0.5s ease;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: var(--color-surface);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    animation: fadeInUp 0.3s ease;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: rgba(74, 160, 255, 0.1);
}

.message.user .message-avatar {
    background: var(--color-surface-light);
}

.message-content {
    max-width: 70%;
}

.message-text {
    background: var(--color-surface-light);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user .message-text {
    background: var(--color-primary);
}

.message-time {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
    padding: 0 0.5rem;
}

/* Typing Indicator */
.typing-indicator {
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
    background: var(--color-surface-light);
    border-radius: 12px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--color-text-secondary);
    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.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Area */
.chat-input-container {
    padding: 1rem;
    background: var(--color-surface-light);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.chat-form {
    display: flex;
    gap: 0.75rem;
}

.input-wrapper {
    flex: 1;
    display: flex;
    background: var(--color-surface);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    padding: 0.5rem;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74, 160, 255, 0.1);
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--color-text);
    font-size: 1rem;
    padding: 0.5rem;
    resize: none;
    outline: none;
    min-height: 40px;
    max-height: 120px;
    font-family: inherit;
}

.message-input::placeholder {
    color: var(--color-text-secondary);
}

.send-button {
    background: var(--color-primary);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
}

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

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

/* Input Footer */
.input-footer {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.5rem 0;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.status {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success);
}

.status.disconnected::before {
    background: var(--color-error);
}

/* Quick Actions */
.quick-actions {
    padding: 1rem;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-action {
    padding: 0.5rem 1rem;
    background: var(--color-surface-light);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.quick-action:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    margin-top: 1rem;
    color: var(--color-text-secondary);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Modern Floating Action Button
   =========================== */
.contact-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
}

.fab-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, #6366f1 100%);
    border: none;
    border-radius: 50px;
    padding: 1rem 1.5rem;
    color: white;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(74, 160, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.fab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.fab-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255,255,255,0.1) 50%,
        transparent 70%
    );
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.fab-button:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 32px rgba(74, 160, 255, 0.5);
}

.fab-button:active {
    transform: translateY(-2px) scale(0.98);
}

.fab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-menu {
    position: absolute;
    bottom: calc(100% + 1rem);
    right: 0;
    background: var(--color-surface);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    min-width: 280px;
    overflow: hidden;
    animation: menuSlideUp 0.3s ease;
}

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

.fab-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 1px solid var(--color-border);
}

.fab-option:last-child {
    border-bottom: none;
}

.fab-option:hover {
    background: rgba(74, 160, 255, 0.1);
}

.fab-option-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 160, 255, 0.1);
    border-radius: 10px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.fab-option-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.fab-option-text strong {
    font-weight: 600;
    font-size: 0.9375rem;
}

.fab-option-text small {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* ===========================
   Assessment Complete Panel
   =========================== */
.assessment-complete-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-light) 100%);
    border-top: 1px solid var(--color-border);
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
    animation: slideUp 0.5s ease;
    z-index: 50;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.completion-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.completion-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2) 0%, rgba(74, 160, 255, 0.2) 100%);
    border-radius: 50%;
    margin: 0 auto 1rem;
    color: var(--color-success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px 10px rgba(76, 175, 80, 0); }
}

.completion-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.completion-header p {
    color: var(--color-text-secondary);
}

.user-report {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    line-height: 1.7;
    max-width: 700px;
    margin: 0 auto;
}

.user-report ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.user-report li {
    margin: 0.5rem 0;
}

/* ===========================
   Enhanced Quick Actions
   =========================== */
.quick-actions {
    padding: 1rem;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-surface-light);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-action.glass-button {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-action.glass-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.quick-action.primary-action {
    background: linear-gradient(135deg, var(--color-primary) 0%, #6366f1 100%);
    border: none;
    box-shadow: 0 4px 16px rgba(74, 160, 255, 0.3);
}

.quick-action.primary-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(74, 160, 255, 0.4);
}

/* ===========================
   Progress Steps Indicator
   =========================== */
.progress-steps {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.progress-step {
    flex: 1;
    height: 4px;
    background: var(--color-surface);
    border-radius: 2px;
    overflow: hidden;
    transition: background 0.5s ease;
}

.progress-step.active {
    background: linear-gradient(90deg, var(--color-primary), #6366f1);
}

.progress-step.completed {
    background: var(--color-success);
}

/* ===========================
   Interaction Counter
   =========================== */
.interaction-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    padding: 0.25rem 0;
}

.interaction-dots {
    display: flex;
    gap: 3px;
}

.interaction-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-surface-light);
    transition: all 0.3s ease;
}

.interaction-dot.filled {
    background: var(--color-primary);
    box-shadow: 0 0 6px rgba(74, 160, 255, 0.5);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-container {
        max-width: 100%;
    }

    .chat-messages {
        padding: 1rem;
    }

    .message-content {
        max-width: 85%;
    }

    .chat-header {
        padding: 0.75rem;
    }

    .logo-text {
        font-size: 1rem;
    }

    .contact-fab {
        bottom: 1rem;
        right: 1rem;
    }

    .fab-button {
        padding: 0.875rem 1.25rem;
    }

    .fab-text {
        display: none;
    }

    .fab-menu {
        right: -1rem;
        min-width: 260px;
    }

    .assessment-complete-panel {
        padding: 1.5rem;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-action {
        width: 100%;
        justify-content: center;
    }
}