 @import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&display=swap');

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "Inter", sans-serif;
        }

        body {
            width: 100%;
            height: 100vh;
            background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .chat-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 16px 24px;
            background: #ffffff;
            border-bottom: 1px solid #e2e8f0;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            z-index: 100;
            flex-shrink: 0;
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .chatbot-logo {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .logo-text {
            font-size: 1.25rem;
            font-weight: 700;
            color: #1f2937;
            background: #667eea;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .status-indicator {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            background: #dcfce7;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 500;
            color: #166534;
        }

        .status-dot {
            width: 6px;
            height: 6px;
            background: #22c55e;
            border-radius: 50%;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {

            0%,
            100% {
                opacity: 1;
                transform: scale(1);
            }

            50% {
                opacity: 0.5;
                transform: scale(1.2);
            }
        }

        .header-btn {
            padding: 8px 16px;
            border: 1px solid #e2e8f0;
            background: #ffffff;
            border-radius: 8px;
            font-size: 0.875rem;
            font-weight: 500;
            color: #374151;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
            text-decoration: none;
        }

        .header-btn:hover {
            border-color: #667eea;
            background: #f8fafc;
            transform: translateY(-1px);
            color: #374151;
            text-decoration: none;
        }

        .chat-container {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        .chat-body {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            background: #ffffff;
            padding: 16px 20px;
            gap: 12px;
            scrollbar-width: thin;
            scrollbar-color: #cbd5e1 transparent;
            padding-bottom: 20px;
        }

        .chat-body::-webkit-scrollbar {
            width: 6px;
        }

        .chat-body::-webkit-scrollbar-track {
            background: transparent;
        }

        .chat-body::-webkit-scrollbar-thumb {
            background: #cbd5e1;
            border-radius: 3px;
        }

        .welcome-section {
            text-align: center;
            padding: 32px 20px;
            max-width: 600px;
            margin: 0 auto;
        }

        .welcome-title {
            font-size: 2.2rem;
            font-weight: 700;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 12px;
        }

        .welcome-subtitle {
            font-size: 1.125rem;
            color: #6b7280;
            margin-bottom: 24px;
            line-height: 1.6;
        }

        .quick-actions {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 12px;
            margin-top: 24px;
        }

        .quick-action {
            padding: 12px;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            background: #ffffff;
            cursor: pointer;
            transition: all 0.2s;
            text-align: left;
        }

        .quick-action:hover {
            border-color: #667eea;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(103, 126, 234, 0.15);
        }

        .quick-action-title {
            font-weight: 600;
            color: #374151;
            margin-bottom: 4px;
        }

        .quick-action-desc {
            font-size: 0.875rem;
            color: #6b7280;
        }

        .message {
            display: flex;
            gap: 10px;
            max-width: 85%;
            animation: messageSlideIn 0.4s ease-out;
            align-items: flex-end;
            margin-bottom: 8px;
        }

        .message.user-message {
            align-self: flex-end;
            flex-direction: row-reverse;
        }

        @keyframes messageSlideIn {
            from {
                opacity: 0;
                transform: translateY(15px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .message-avatar {
            width: 28px;
            height: 28px;
            border-radius: 6px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            font-size: 0.8rem;
        }

        .bot-avatar {
            background: #667eea;
            color: white;
        }

        .user-avatar {
            background: #f3f4f6;
            color: #374151;
        }

        .message-content {
            flex: 1;
            min-width: 0;
        }

        .message-text {
            padding: 10px 14px;
            border-radius: 10px;
            line-height: 1.5;
            word-wrap: break-word;
            font-size: 0.9rem;
            max-width: 100%;
        }

        .bot-message .message-text {
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            color: #374151;
            border-radius: 12px 12px 12px 3px;
        }

        .user-message .message-text {
            background: #667eea;
            color: white;
            border-radius: 12px 12px 3px 12px;
        }

        .user-message .attachment {
            width: 50%;
            margin-top: -7px;
            border-radius: 12px 3px 12px 12px;
        }

        .bot-message.thinking .message-text {
            padding: 10px 14px;
        }

        .thinking-indicator {
            display: flex;
            gap: 4px;
            padding: 12px 0;
        }

        .dot {
            height: 8px;
            width: 8px;
            opacity: 0.7;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            animation: dotPulse 1.8s ease-in-out infinite;
        }

        .dot:nth-child(1) {
            animation-delay: 0.2s;
        }

        .dot:nth-child(2) {
            animation-delay: 0.3s;
        }

        .dot:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes dotPulse {

            0%,
            44% {
                transform: translateY(0);
            }

            28% {
                opacity: 0.4;
                transform: translateY(-4px);
            }

            44% {
                opacity: 0.2;
            }
        }

        .code-block {
            background: #2d3748;
            border-radius: 12px;
            padding: 0;
            margin: 12px 0;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        }

        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 16px;
            background: #1a202c;
            border-bottom: 1px solid #4a5568;
        }

        .code-language {
            font-size: 12px;
            color: #a0aec0;
            font-weight: 600;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .code-language::before {
            content: '';
            width: 8px;
            height: 8px;
            background: #4299e1;
            border-radius: 50%;
        }

        .copy-btn {
            background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
            border: none;
            color: white;
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .copy-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
        }

        .copy-btn.copied {
            background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
        }

        .code-content {
            padding: 16px;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 13px;
            line-height: 1.6;
            color: #e2e8f0;
            overflow-x: auto;
            background: #2d3748;
        }

        .code-content::-webkit-scrollbar {
            height: 8px;
        }

        .code-content::-webkit-scrollbar-thumb {
            background: #4a5568;
            border-radius: 4px;
        }

        .inline-code {
            background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
            color: #2d3748;
            padding: 2px 6px;
            border-radius: 4px;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 0.85em;
            border: 1px solid #e2e8f0;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }

    
        .chat-footer {
            flex-shrink: 0;
            padding: 12px 16px;
            background: #ffffff;
            border-top: 1px solid #e2e8f0;
            padding-bottom: calc(12px + env(safe-area-inset-bottom));
            position: relative;
            z-index: 50;
        }

        .chat-form {
            max-width: 100%;
            margin: 0 auto;
            position: relative;
            background: #ffffff;
            border: 2px solid #e2e8f0;
            border-radius: 20px;
            transition: all 0.2s;
            display: flex;
            align-items: flex-end;
            min-height: 44px;
        }

        .chat-form:focus-within {
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(103, 126, 234, 0.1);
        }

        .message-input {
            flex: 1;
            padding: 12px 0 12px 16px;
            border: none;
            outline: none;
            background: transparent;
            resize: none;
            font-size: 0.95rem;
            line-height: 1.4;
            max-height: 120px;
            min-height: 20px;
            font-family: inherit;
            scrollbar-width: thin;
            scrollbar-color: transparent transparent;
        }

        .message-input::placeholder {
            color: #9ca3af;
        }

        .chat-controls {
            display: flex;
            align-items: center;
            gap: 2px;
            padding: 4px;
            align-self: flex-end;
            height: 44px;
        }

        .control-btn {
            width: 32px;
            height: 32px;
            border: none;
            background: none;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: #706DB0;
            transition: all 0.2s;
            font-size: 1.1rem;
        }

        .control-btn:hover {
            color: #667eea;
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
            transform: scale(1.1);
        }

        .send-btn {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            display: none;
            box-shadow: 0 4px 15px rgba(103, 126, 234, 0.4);
        }

        .send-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(103, 126, 234, 0.6);
        }

        .message-input:valid~.chat-controls .send-btn {
            display: flex;
        }

        .file-upload-wrapper {
            position: relative;
            height: 32px;
            width: 32px;
        }

        .file-upload-wrapper :where(button, img) {
            position: absolute;
        }

        .file-upload-wrapper img {
            height: 100%;
            width: 100%;
            object-fit: cover;
            border-radius: 50%;
        }

        .file-upload-wrapper #file-cancel {
            color: #ff0000;
            background: #fff;
        }

        .file-upload-wrapper :where(img, #file-cancel),
        .file-upload-wrapper.file-uploaded #file-upload {
            display: none;
        }

        .file-upload-wrapper.file-uploaded img,
        .file-upload-wrapper.file-uploaded:hover #file-cancel {
            display: block;
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            z-index: 2000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            padding: 30px;
            border-radius: 20px;
            width: 90%;
            max-width: 400px;
            text-align: center;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            transform: scale(0.7);
            animation: modalShow 0.3s forwards;
        }

        @keyframes modalShow {
            to {
                transform: scale(1);
            }
        }

        .modal img {
            width: 100%;
            border-radius: 12px;
        }

        .timer {
            margin-top: 15px;
            font-weight: 600;
            color: #666;
        }

        .countdown {
            color: #ef4444;
            font-weight: 700;
        }

        .menu {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            border-radius: 16px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
            z-index: 2000;
            padding: 24px;
            width: 320px;
        }

        .menu h1 {
            font-size: 1.5rem;
            margin-bottom: 16px;
            color: #1f2937;
        }

        .menu p {
            color: #6b7280;
            margin-bottom: 16px;
            line-height: 1.5;
        }

        .close-menu {
            background: #ef4444;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            margin-top: 16px;
        }

        @media (max-width: 768px) {
            .chat-header {
                padding: 10px 12px;
            }

            .logo-text {
                font-size: 1rem;
            }

            .header-btn {
                padding: 6px 10px;
                font-size: 0.8rem;
            }

            .status-indicator {
                padding: 4px 8px;
                font-size: 0.7rem;
            }

            .chat-body {
                padding: 12px 14px;
                gap: 8px;
                padding-bottom: 16px;
            }

            .welcome-section {
                padding: 20px 16px;
            }

            .welcome-title {
                font-size: 1.8rem;
                margin-bottom: 8px;
            }

            .welcome-subtitle {
                font-size: 0.95rem;
                margin-bottom: 20px;
            }

            .quick-actions {
                grid-template-columns: 1fr;
                gap: 10px;
                margin-top: 20px;
            }

            .quick-action {
                padding: 12px;
            }

            .message {
                gap: 8px;
                max-width: 90%;
                margin-bottom: 6px;
            }

            .message-avatar {
                width: 24px;
                height: 24px;
                font-size: 0.75rem;
            }

            .message-text {
                padding: 8px 12px;
                font-size: 0.9rem;
                line-height: 1.4;
            }

            .chat-footer {
                padding: 10px 12px;
                padding-bottom: calc(10px + env(safe-area-inset-bottom));
            }

            .message-input {
                padding: 10px 0 10px 14px;
                font-size: 0.95rem;
                max-height: 100px;
            }

            .chat-controls {
                height: 40px;
                padding: 2px;
            }

            .control-btn {
                width: 30px;
                height: 30px;
                font-size: 1rem;
            }

            .code-content {
                font-size: 12px;
                padding: 12px;
            }
        }

        @media (max-width: 480px) {
            .chat-header {
                padding: 8px 10px;
            }

            .header-right .status-indicator {
                display: none;
            }

            .message {
                max-width: 95%;
            }

            .message-text {
                padding: 6px 10px;
                font-size: 0.875rem;
            }

            .chat-footer {
                padding: 8px 10px;
                padding-bottom: calc(8px + env(safe-area-inset-bottom));
            }

            .welcome-title {
                font-size: 1.6rem;
            }
        }

        .hidden {
            display: none !important;
        }

        @supports (padding: max(0px)) {
            .chat-footer {
                padding-bottom: max(12px, env(safe-area-inset-bottom));
            }

            @media (max-width: 768px) {
                .chat-footer {
                    padding-bottom: max(10px, env(safe-area-inset-bottom));
                }
            }

            @media (max-width: 480px) {
                .chat-footer {
                    padding-bottom: max(8px, env(safe-area-inset-bottom));
                }
            }
        }