/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    /* Clean animated gradient background */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    background-size: 300% 300%;
    animation: gradient-animation 20s ease infinite;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Removed body overlay for cleaner frosted glass effect */

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 85vh;
    max-width: 800px;
    width: 90%;
    margin: 7.5vh auto;
    /* Frosted glass effect */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
    overflow: hidden;
    /* Make the container resizable */
    resize: both;
    min-width: 400px;
    min-height: 500px;
    max-width: 1200px;
    max-height: 95vh;
}

/* Custom resize handle for app container */
.app-container::-webkit-resizer {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(139, 92, 246, 0.4));
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Add resize indicator in bottom right */
.app-container::after {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 16px;
    height: 16px;
    background:
        linear-gradient(45deg, transparent 40%, rgba(102, 126, 234, 0.3) 40%, rgba(102, 126, 234, 0.3) 60%, transparent 60%),
        linear-gradient(-45deg, transparent 40%, rgba(139, 92, 246, 0.3) 40%, rgba(139, 92, 246, 0.3) 60%, transparent 60%);
    background-size: 4px 4px;
    background-position: 0 0, 2px 2px;
    pointer-events: none;
    opacity: 0.6;
}

@media (min-width: 768px) {
    .app-container {
        height: 85vh;
        max-width: 1000px;
        margin: 7.5vh auto;
    }
}

/* Mobile styles moved to consolidated section below */

/* Header Styles */
.chat-header {
    background: linear-gradient(135deg, #ff006e 0%, #8338ec 50%, #3a86ff 100%);
    background-size: 200% 200%;
    animation: headerGradient 8s ease infinite;
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 24px 24px 0 0;
    box-shadow: 
        0 4px 20px rgba(255, 0, 110, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 3s infinite;
}

@keyframes headerGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

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

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

.logo {
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: logoFloat 3s ease-in-out infinite;
}

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

.header-text h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    background: linear-gradient(45deg, #ffffff, #e0e7ff, #ffffff);
    background-size: 200% 200%;
    animation: textShimmer 4s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes textShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.header-subtitle {
    font-size: 0.9rem;
    opacity: 0.95;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-toggle {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0;
}

.settings-toggle:hover {
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
}

.settings-toggle svg {
    width: 20px;
    height: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00ff88;
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.8),
        0 0 40px rgba(0, 255, 136, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: neonPulse 2s ease-in-out infinite;
    position: relative;
}

.status-dot::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: linear-gradient(45deg, transparent, rgba(0, 255, 136, 0.3), transparent);
    animation: rotate 3s linear infinite;
}

.status-dot.online {
    background: #00ff88;
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.8),
        0 0 40px rgba(0, 255, 136, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.status-dot.offline {
    background: #ff0055;
    box-shadow: 
        0 0 20px rgba(255, 0, 85, 0.8),
        0 0 40px rgba(255, 0, 85, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

@keyframes neonPulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
        box-shadow: 
            0 0 20px rgba(0, 255, 136, 0.8),
            0 0 40px rgba(0, 255, 136, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.1);
        box-shadow: 
            0 0 30px rgba(0, 255, 136, 1),
            0 0 60px rgba(0, 255, 136, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

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

/* Main Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
}

/* Removed chat-container overlay for cleaner frosted glass effect */

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
    position: relative;
    z-index: 1;
}

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

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

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.8);
}

/* Message Styles */
.message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease-out;
}

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

.message-avatar {
    flex-shrink: 0;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.bot-avatar {
    background: linear-gradient(135deg, #8338ec 0%, #3a86ff 100%);
    background-size: 200% 200%;
    animation: avatarGradient 6s ease infinite;
    color: white;
    box-shadow: 
        0 4px 15px rgba(131, 56, 236, 0.4),
        0 0 20px rgba(131, 56, 236, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-avatar {
    background: linear-gradient(135deg, #ff006e 0%, #00ff88 100%);
    background-size: 200% 200%;
    animation: avatarGradient 6s ease infinite reverse;
    color: white;
    box-shadow: 
        0 4px 15px rgba(255, 0, 110, 0.4),
        0 0 20px rgba(255, 0, 110, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

@keyframes avatarGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    /* Frosted glass message bubbles */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    word-wrap: break-word;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    color: #1f2937;
    font-weight: 500;
}

.message-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.message:hover .message-text::before {
    left: 100%;
}

.bot-message .message-text {
    /* Slightly different tint for bot messages */
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    box-shadow:
        0 8px 32px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: #1f2937;
    font-weight: 500;
}

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

.user-message .message-text {
    /* User messages with gradient background */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: messageGradient 8s ease infinite;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 8px 32px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

@keyframes messageGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.message-time {
    font-size: 0.75rem;
    color: rgba(31, 41, 55, 0.6);
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}

.user-message .message-time {
    text-align: right;
}

.welcome-message .message-text {
    /* Special styling for welcome message */
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-left: 4px solid #8b5cf6;
    box-shadow:
        0 8px 32px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    color: #1f2937;
    font-weight: 500;
}

.welcome-message .message-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: welcomeShimmer 3s ease infinite;
}

@keyframes welcomeShimmer {
    0% { transform: translateX(-100%) skewX(-15deg); }
    100% { transform: translateX(200%) skewX(-15deg); }
}

/* Knowledge Prompt Styles */
.knowledge-prompt {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    animation: slideInDown 0.5s ease-out;
}

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

.prompt-header h3 {
    color: #92400e;
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.prompt-header p {
    color: #b45309;
    margin-bottom: 1rem;
}

.guided-prompts {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.guided-prompt-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #fbbf24;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guided-prompt-item:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.guided-prompt-item.required::after {
    content: "*";
    color: #dc2626;
    margin-left: 4px;
}

.prompt-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Contribution Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    min-height: fit-content;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    margin: auto;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    font-family: inherit;
    background-color: #ffffff !important;
    color: #1f2937 !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #6b7280 !important;
    opacity: 1 !important;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.confidence-slider {
    margin-top: 0.5rem;
}

.confidence-slider input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

.confidence-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.confidence-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.confidence-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: inherit;
}

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

.btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-loading {
    display: none;
}

.btn.loading .btn-text {
    display: none;
}

.btn.loading .btn-loading {
    display: block;
}

/* Settings Modal */
.settings-modal {
    max-width: 450px;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

.setting-group {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0;
    background: #fafafa;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
}

.setting-info {
    flex: 1;
    margin-right: 1rem;
}

.setting-label {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
    cursor: pointer;
}

.setting-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.setting-control {
    flex-shrink: 0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease-out;
}

.typing-content {
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1rem 1.25rem;
    border-radius: 18px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4f46e5;
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-text {
    font-size: 0.875rem;
    color: #374151;
    font-style: italic;
}

/* Input Container */
.input-container {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1.5rem 2rem;
    border-radius: 0 0 24px 24px;
    position: relative;
}

/* Removed input-container overlay for cleaner frosted glass effect */

.input-form {
    display: flex;
    flex-direction: column;
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    /* Frosted glass input */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Removed input-wrapper overlay for cleaner frosted glass effect */

.input-wrapper:focus-within {
    border-color: rgba(102, 126, 234, 0.6);
    box-shadow:
        0 0 0 2px rgba(102, 126, 234, 0.3),
        0 8px 32px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.25);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: vertical;
    font-size: 1rem;
    line-height: 1.6;
    min-height: 40px;
    max-height: 200px;
    font-family: inherit;
    color: #1f2937;
    position: relative;
    z-index: 2;
    font-weight: 500;
    overflow-y: auto;
    padding: 0;
}

#messageInput::placeholder {
    color: rgba(31, 41, 55, 0.6);
    font-weight: 400;
}

/* Custom resize handle styling */
#messageInput::-webkit-resizer {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(139, 92, 246, 0.3));
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Firefox resize handle */
#messageInput {
    resize: vertical;
    background-image:
        linear-gradient(45deg, transparent 40%, rgba(102, 126, 234, 0.3) 40%, rgba(102, 126, 234, 0.3) 60%, transparent 60%),
        linear-gradient(-45deg, transparent 40%, rgba(139, 92, 246, 0.3) 40%, rgba(139, 92, 246, 0.3) 60%, transparent 60%);
    background-size: 8px 8px;
    background-position: bottom right;
    background-repeat: no-repeat;
}

.send-button {
    background: linear-gradient(135deg, #ff006e 0%, #8338ec 50%, #3a86ff 100%);
    background-size: 200% 200%;
    animation: buttonGradient 4s ease infinite;
    border: none;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    flex-shrink: 0;
    box-shadow: 
        0 4px 15px rgba(255, 0, 110, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.send-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 8px 25px rgba(255, 0, 110, 0.4),
        0 0 20px rgba(255, 0, 110, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.send-button:hover:not(:disabled)::before {
    left: 100%;
}

@keyframes buttonGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

.send-button svg {
    width: 18px;
    height: 18px;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}

.input-hints {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: rgba(31, 41, 55, 0.7);
}

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

/* Toast Messages */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    max-width: 400px;
    z-index: 1100;
    animation: slideInRight 0.3s ease-out;
}

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

.error-toast {
    border-left: 4px solid #ef4444;
}

.success-toast {
    border-left: 4px solid #10b981;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.toast-icon {
    font-size: 1.125rem;
}

.toast-message {
    font-size: 0.875rem;
    color: #374151;
}

.toast-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Contribution Prompt in Messages */
.contribution-prompt {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #0ea5e9;
    border-left: 4px solid #0ea5e9;
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
}

.contribution-prompt h4 {
    color: #0c4a6e;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.contribution-prompt p {
    color: #075985;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.contribution-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.contribution-actions .btn {
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .app-container {
        height: 100vh;
        width: 100%;
        margin: 0;
        border-radius: 0;
        /* Disable resize on mobile */
        resize: none;
        min-width: unset;
        min-height: unset;
        max-width: unset;
        max-height: unset;
    }

    .chat-header {
        border-radius: 0;
        padding: 1rem 1.25rem;
        padding-top: calc(1rem + env(safe-area-inset-top));
    }

    .header-content {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .header-text h1 {
        font-size: 1.375rem;
    }

    .header-subtitle {
        font-size: 0.8rem;
    }

    .messages-container {
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .message {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .message-text {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        border-radius: 16px;
        line-height: 1.5;
        /* Better contrast on mobile */
        color: #111827 !important;
        background: rgba(255, 255, 255, 0.9) !important;
        font-weight: 500;
    }

    .bot-message .message-text {
        background: rgba(255, 255, 255, 0.85) !important;
        border: 1px solid rgba(139, 92, 246, 0.3) !important;
        color: #111827 !important;
    }

    .user-message .message-text {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
        color: #ffffff !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }

    .input-container {
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        border-radius: 0;
    }

    .input-wrapper {
        padding: 0.75rem;
        border-radius: 12px;
    }

    #messageInput {
        font-size: 16px;
        min-height: 44px;
        max-height: 120px;
        /* Disable resize on mobile */
        resize: none;
        /* Prevent zoom on iOS */
        -webkit-text-size-adjust: 100%;
        transform: translateZ(0);
    }

    .send-button {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        flex-shrink: 0;
    }

    .input-hints {
        flex-direction: column;
        gap: 0.25rem;
        margin-top: 0.5rem;
        font-size: 0.7rem;
    }

    /* Hide resize indicator on mobile */
    .app-container::after {
        display: none;
    }
}

/* Extra small mobile devices (phones in portrait) */
@media (max-width: 480px) {
    .chat-header {
        padding: 0.875rem 1rem;
        padding-top: calc(0.875rem + env(safe-area-inset-top));
    }

    .header-text h1 {
        font-size: 1.25rem;
    }

    .header-subtitle {
        font-size: 0.75rem;
    }

    .messages-container {
        padding: 0.75rem;
    }

    .message-text {
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
    }

    .input-container {
        padding: 0.875rem;
        padding-bottom: calc(0.875rem + env(safe-area-inset-bottom));
    }

    .input-wrapper {
        padding: 0.625rem;
    }

    #messageInput {
        font-size: 0.9rem;
    }

    .send-button {
        width: 40px;
        height: 40px;
    }

    .input-hints {
        font-size: 0.65rem;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .app-container {
        height: 100vh;
    }

    .chat-header {
        padding: 0.75rem 1rem;
        padding-top: calc(0.75rem + env(safe-area-inset-top));
    }

    .header-text h1 {
        font-size: 1.125rem;
    }

    .header-subtitle {
        font-size: 0.7rem;
    }

    .messages-container {
        padding: 0.75rem;
    }

    .input-container {
        padding: 0.75rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .send-button {
        min-width: 48px;
        min-height: 48px;
    }

    /* Better touch feedback */
    .message-text {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
    }

    .input-wrapper {
        -webkit-tap-highlight-color: transparent;
    }

    /* Prevent zoom on input focus */
    #messageInput {
        font-size: 16px;
    }

    /* Better scrolling on mobile */
    .messages-container {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .app-container {
        height: 100vh;
        height: -webkit-fill-available;
    }

    .input-container {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 20px));
    }

    #messageInput {
        /* Prevent iOS zoom */
        font-size: 16px;
        -webkit-appearance: none;
        -webkit-text-size-adjust: 100%;
        border-radius: 0;
        /* Force hardware acceleration */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    /* Prevent zoom after form submission */
    .input-form {
        -webkit-text-size-adjust: 100%;
    }

    /* Better mobile scrolling */
    .messages-container {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }
}

/* Additional mobile zoom prevention */
@media (max-width: 768px) {
    /* Prevent zoom on any input focus */
    input, textarea, select {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
        transform: translateZ(0);
    }

    /* Ensure message text is readable */
    .message-time {
        color: rgba(17, 24, 39, 0.7) !important;
    }

    .welcome-message .message-text {
        color: #111827 !important;
        background: rgba(255, 255, 255, 0.9) !important;
    }

    /* Better input placeholder visibility */
    #messageInput::placeholder {
        color: rgba(17, 24, 39, 0.5) !important;
    }

    /* Prevent text selection issues */
    .message-text {
        -webkit-user-select: text;
        user-select: text;
    }
}

    /* Enhanced Modal Styles for Mobile */
    .modal-overlay {
        padding: 0.5rem;
        align-items: stretch;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .modal-content {
        margin: 0;
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 2rem);
        min-height: calc(100vh - 2rem);
        border-radius: 20px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 1.5rem 1.25rem 1rem;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }

    .modal-body {
        padding: 0 1.25rem 1rem;
    }

    .modal-footer {
        padding: 1rem 1.25rem 1.5rem;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        z-index: 10;
    }

    /* Improved form elements for mobile */
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 1rem;
        font-size: 1rem;
        border-radius: 12px;
        border: 2px solid #d1d5db;
        background-color: #ffffff !important;
        color: #1f2937 !important;
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    .form-group input::placeholder,
    .form-group textarea::placeholder {
        color: #6b7280 !important;
        opacity: 1 !important;
    }

    .form-group textarea {
        min-height: 120px;
        resize: vertical;
    }

    .btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        border-radius: 12px;
        min-height: 48px;
    }

    /* Knowledge Prompt Mobile Improvements */
    .knowledge-prompt {
        margin: 1rem 0;
        padding: 1.25rem;
        border-radius: 16px;
    }

    .guided-prompts {
        gap: 1rem;
    }

    .guided-prompt-item {
        padding: 1rem;
        border-radius: 12px;
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .prompt-actions,
    .contribution-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .contribution-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Toast improvements for mobile */
    .toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
        border-radius: 12px;
        padding: 1.25rem;
    }

    .toast-content {
        gap: 0.75rem;
    }

    .toast-message {
        font-size: 1rem;
    }

    /* Contribution prompt in messages - mobile */
    .contribution-prompt {
        padding: 1.25rem;
        margin: 1rem 0;
        border-radius: 16px;
    }

    .contribution-prompt h4 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }

    .contribution-prompt p {
        font-size: 1rem;
        margin-bottom: 1.25rem;
        line-height: 1.6;
    }

    /* Character counter improvements */
    .char-counter {
        font-size: 0.875rem;
        margin-top: 0.5rem;
    }

    .confidence-labels {
        font-size: 0.875rem;
    }

    /* Fix modal scrolling on mobile */
    .modal-content {
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
    }
    
    /* Mobile header actions */
    .header-actions {
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .contribution-toggle {
        gap: 0.5rem;
        background: rgba(255, 255, 255, 0.1);
        padding: 0.5rem 0.75rem;
        border-radius: 12px;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .toggle-label {
        font-size: 0.875rem;
        font-weight: 500;
        color: #ffffff;
        white-space: nowrap;
    }
    
    .toggle-switch {
        width: 44px;
        height: 24px;
    }
    
    .toggle-slider:before {
        height: 18px;
        width: 18px;
        left: 2px;
        bottom: 2px;
    }
    
    input:checked + .toggle-slider:before {
        transform: translateX(20px);
    }
    
    .settings-toggle {
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .settings-toggle svg {
        width: 20px;
        height: 20px;
    }
    
    .status-indicator {
        padding: 0.5rem 0.75rem;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}

@media (max-width: 480px) {
    .guided-prompts {
        grid-template-columns: 1fr;
    }

    .confidence-labels {
        font-size: 0.6875rem;
    }

    .input-hints .hint:last-child {
        display: none;
    }
    
    /* Extra small screen improvements */
    .header-actions {
        justify-content: center;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .contribution-toggle {
        order: 1;
    }
    
    .settings-toggle {
        order: 2;
    }
    
    .status-indicator {
        order: 3;
        font-size: 0.8125rem;
    }
    
    /* Improve touch targets */
    .modal-close {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.75rem;
    }
    
    .toast-close {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Visual Enhancement Animations */
.shooting-stars {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.shooting-star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: radial-gradient(circle, #ffffff 0%, #667eea 50%, #764ba2 100%);
    border-radius: 50%;
    box-shadow:
        0 0 12px #ffffff,
        0 0 24px #667eea,
        0 0 36px #764ba2,
        0 0 48px rgba(102, 126, 234, 0.5);
    opacity: 0;
    animation: shootingStar 4s ease-out infinite;
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), rgba(102, 126, 234, 0.7), transparent);
    right: 2px;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}

@keyframes shootingStar {
    0% {
        opacity: 0;
        transform: translateX(-200px) translateY(-200px) rotate(45deg) scale(0.5);
    }
    5% {
        opacity: 1;
        transform: translateX(-150px) translateY(-150px) rotate(45deg) scale(1);
    }
    95% {
        opacity: 1;
        transform: translateX(calc(100vw + 50px)) translateY(calc(100vh + 50px)) rotate(45deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(calc(100vw + 100px)) translateY(calc(100vh + 100px)) rotate(45deg) scale(0.5);
    }
}

.sparkles {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    opacity: 0;
    animation: sparkle 2s ease-in-out infinite;
}

.sparkle:nth-child(odd) {
    background: #667eea;
    box-shadow: 0 0 8px #667eea, 0 0 16px rgba(102, 126, 234, 0.5);
}

.sparkle:nth-child(even) {
    background: #f093fb;
    box-shadow: 0 0 8px #f093fb, 0 0 16px rgba(240, 147, 251, 0.5);
}

.sparkle:nth-child(3n) {
    background: #4facfe;
    box-shadow: 0 0 8px #4facfe, 0 0 16px rgba(79, 172, 254, 0.5);
}

.sparkle:nth-child(4n) {
    background: #f5576c;
    box-shadow: 0 0 8px #f5576c, 0 0 16px rgba(245, 87, 108, 0.5);
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: floatParticle 15s linear infinite;
}

.particle:nth-child(odd) {
    background: rgba(255, 0, 110, 0.2);
}

.particle:nth-child(even) {
    background: rgba(58, 134, 255, 0.2);
}

.particle:nth-child(3n) {
    background: rgba(0, 255, 136, 0.2);
}

@keyframes floatParticle {
    0% {
        opacity: 0;
        transform: translateY(100vh) translateX(0px) rotate(0deg) scale(0.5);
    }
    10% {
        opacity: 0.8;
        transform: translateY(90vh) translateX(10px) rotate(36deg) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(50vh) translateX(25px) rotate(180deg) scale(1.2);
    }
    90% {
        opacity: 0.8;
        transform: translateY(10vh) translateX(40px) rotate(324deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-10vh) translateX(50px) rotate(360deg) scale(0.5);
    }
}

/* Add floating orbs */
.floating-orbs {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.floating-orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.1));
    backdrop-filter: blur(2px);
    animation: orbFloat 20s ease-in-out infinite;
    opacity: 0.5;
}

.floating-orb:nth-child(1) {
    width: 60px;
    height: 60px;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 25s;
}

.floating-orb:nth-child(2) {
    width: 40px;
    height: 40px;
    left: 80%;
    animation-delay: 8s;
    animation-duration: 30s;
}

.floating-orb:nth-child(3) {
    width: 80px;
    height: 80px;
    left: 50%;
    animation-delay: 15s;
    animation-duration: 35s;
}

@keyframes orbFloat {
    0%, 100% {
        transform: translateY(100vh) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    50% {
        transform: translateY(50vh) translateX(30px) rotate(180deg);
        opacity: 0.7;
    }
    90% {
        opacity: 0.5;
        transform: translateY(10vh) translateX(-20px) rotate(320deg);
    }
}

/* Enhanced button hover effects */
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Add glass morphism effect to containers */
.app-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Improved scrollbar styling */
.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #ff006e, #8338ec);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #e6005c, #7429d9);
}

/* Add neon glow to active elements */
.input-wrapper:focus-within {
    box-shadow: 
        0 0 20px rgba(255, 0, 110, 0.4),
        0 0 40px rgba(255, 0, 110, 0.2),
        0 8px 25px rgba(255, 0, 110, 0.3);
}

/* Loading spinner enhancement */
.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

/* Enhanced typing indicator - styles moved to main typing section */

/* Improved focus indicators */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #ff006e;
    box-shadow: 
        0 0 0 3px rgba(255, 0, 110, 0.2),
        0 0 20px rgba(255, 0, 110, 0.1);
    outline: none;
}

/* Enhanced status indicator */
.status-indicator {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.contribution-link {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    backdrop-filter: blur(10px);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.contribution-link:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Contribution Toggle */
.contribution-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-label {
    font-size: 0.875rem;
    color: #ffffff;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: #ffffff;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #00ff88 0%, #3a86ff 100%);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle-slider:hover {
    background: rgba(255, 255, 255, 0.4);
}

input:checked + .toggle-slider:hover {
    background: linear-gradient(135deg, #00e67a 0%, #3578e6 100%);
}

/* Settings Toggle Button */
.settings-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    backdrop-filter: blur(10px);
}

.settings-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.settings-toggle svg {
    width: 20px;
    height: 20px;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 
        0 8px 25px rgba(79, 70, 229, 0.4),
        0 0 20px rgba(79, 70, 229, 0.3);
    animation: buttonPulse 1s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 
            0 8px 25px rgba(79, 70, 229, 0.4),
            0 0 20px rgba(79, 70, 229, 0.3);
    }
    50% {
        box-shadow: 
            0 12px 35px rgba(79, 70, 229, 0.5),
            0 0 30px rgba(79, 70, 229, 0.4);
    }
}

/* Enhanced message animations */
.message {
    animation: messageSlideIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message:hover {
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.message:hover .message-text {
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .message-text {
        border: 2px solid #374151;
    }
    
    .btn-primary {
        background: #1f2937;
        border: 2px solid #374151;
    }
    
    .input-wrapper:focus-within {
        border: 2px solid #1f2937;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .typing-dots span {
        animation: none;
        opacity: 1;
    }
    
    .status-dot {
        animation: none;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    /* Improve tap targets for touch devices */
    .toggle-switch {
        min-width: 48px;
        min-height: 28px;
    }
    
    .btn {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
    }
    
    /* Remove hover effects on touch devices */
    .message:hover {
        transform: none;
    }
    
    .message:hover .message-text {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }
    
    .btn:hover {
        transform: none;
        box-shadow: initial;
    }
    
    /* Enhance focus indicators for touch navigation */
    .toggle-switch input:focus + .toggle-slider {
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
    }
    
    .btn:focus {
        outline: 3px solid rgba(79, 70, 229, 0.5);
        outline-offset: 2px;
    }
}