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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            height: 100vh;
            overflow: hidden;
            position: fixed;
            width: 100%;
        }

        .chat-container {
            width: 100%;
            height: 100vh;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            display: flex;
            overflow: hidden;
            transition: all 0.3s ease;
            position: relative;
        }

        /* Backdrop overlay for mobile */
        .sidebar-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
            z-index: 998;
        }

        .sidebar-backdrop.active {
            opacity: 1;
            visibility: visible;
        }

        .sidebar {
            width: 20%;
            min-width: 280px;
            background: linear-gradient(180deg, #1a365d 0%, #2d3748 100%);
            color: white;
            display: flex;
            flex-direction: column;
            border-right: 1px solid rgba(255, 255, 255, 0.1);
            transition: all 0.3s ease;
            overflow: hidden;
            position: relative;
            z-index: 999;
        }

        .sidebar.hidden {
            width: 0;
            min-width: 0;
            border-right: none;
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }

        .new-chat-btn {
            width: 100%;
            padding: 12px 16px;
            background: linear-gradient(135deg, #48bb78, #38a169);
            border: none;
            border-radius: 10px;
            color: white;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .new-chat-btn:hover {
            background: linear-gradient(135deg, #38a169, #2d5a27);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
        }

        .mode-selector {
            margin-top: 15px;
        }

        .mode-selector label {
            display: block;
            font-size: 12px;
            margin-bottom: 5px;
            opacity: 0.8;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .mode-select {
            width: 100%;
            padding: 8px 12px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 8px;
            color: white;
            font-size: 14px;
            outline: none;
            transition: all 0.2s ease;
        }

        .mode-select:focus {
            background: rgba(255, 255, 255, 0.15);
            border-color: #48bb78;
        }

        .mode-select option {
            background: #2d3748;
            color: white;
        }

        .chat-history {
            flex: 1;
            padding: 20px 0;
            overflow-y: auto;
        }

        .chat-history-header {
            padding: 0 20px 15px;
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            opacity: 0.7;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            margin-bottom: 15px;
        }

        .chat-history-item {
            padding: 12px 20px;
            margin: 2px 10px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
            font-size: 14px;
            border-left: 3px solid transparent;
        }

        .chat-history-item:hover {
            background: rgba(255, 255, 255, 0.1);
            border-left-color: #48bb78;
        }

        .chat-history-item.active {
            background: rgba(72, 187, 120, 0.2);
            border-left-color: #48bb78;
        }

        .chat-history-item .title {
            font-weight: 500;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .chat-history-item .time {
            font-size: 11px;
            opacity: 0.6;
        }

        .main-chat {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transition: all 0.3s ease;
            height: 100vh;
        }

        .main-chat.expanded {
            width: 100%;
        }

        .sidebar-toggle {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, #48bb78, #38a169);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10;
            box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
        }

        .sidebar-toggle:hover {
            background: linear-gradient(135deg, #38a169, #2d5a27);
            transform: scale(1.05);
            box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
        }

        .sidebar-toggle:active {
            transform: scale(0.95);
        }

        .chat-header {
            background: linear-gradient(135deg, #2d5a27 0%, #4a7c59 100%);
            color: white;
            padding: 20px 25px;
            padding-right: 80px;
            display: flex;
            align-items: center;
            gap: 15px;
            position: relative;
            overflow: hidden;
            flex-shrink: 0;
        }

        .chat-header::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="leaves" patternUnits="userSpaceOnUse" width="20" height="20"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23leaves)"/></svg>');
            opacity: 0.3;
        }

        .ai-avatar {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #48bb78, #38a169);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            z-index: 1;
            animation: pulse 2s infinite;
        }

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

        .header-info {
            z-index: 1;
        }

        .bot-name {
            font-size: 24px;
            font-weight: 700;
            margin-bottom: 5px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .bot-status {
            font-size: 14px;
            opacity: 0.9;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .status-indicator {
            width: 8px;
            height: 8px;
            background: #48bb78;
            border-radius: 50%;
            animation: blink 2s infinite;
        }

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

        .chat-messages {
            flex: 1;
            padding: 25px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 20px;
            background: linear-gradient(180deg, rgba(247, 250, 252, 0.8) 0%, rgba(237, 242, 247, 0.8) 100%);
            min-height: 0;
            
        }


        .message {
            display: flex;
            gap: 12px;
            animation: slideIn 0.3s ease-out;
        }

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

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

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

        .message.bot .message-avatar {
            background: linear-gradient(135deg, #48bb78, #38a169);
            color: white;
        }

        .message.user .message-avatar {
            background: linear-gradient(135deg, #4299e1, #3182ce);
            color: white;
        }

        .message-content {
            max-width: 70%;
            padding: 15px 20px;
            border-radius: 18px;
            position: relative;
            word-wrap: break-word;
             box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: white; 
    border: 1px solid #e2e8f0;
        }

      
        .message.bot .message-content {
            background: linear-gradient(135deg, #f7fafc, #edf2f7);
            border: 1px solid rgba(72, 187, 120, 0.2);
            color: #2d3748;
        }

        .message.user .message-content {
            background: linear-gradient(135deg, #4299e1, #3182ce);
            color: white;
        }

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

        .typing-indicator {
            display: flex;
            gap: 4px;
            padding: 10px 0;
        }

        .typing-dot {
            width: 8px;
            height: 8px;
            background: #48bb78;
            border-radius: 50%;
            animation: typing 1.4s infinite;
        }

        .typing-dot:nth-child(2) { animation-delay: 0.2s; }
        .typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

        .quick-actions {
            padding: 15px 25px;
            background: rgba(247, 250, 252, 0.9);
            border-top: 1px solid rgba(0, 0, 0, 0.1);
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            flex-shrink: 0;
        }

        .quick-action {
            padding: 8px 16px;
            background: linear-gradient(135deg, #e6fffa, #b2f5ea);
            border: 1px solid #38a169;
            border-radius: 20px;
            font-size: 13px;
            color: #2d5a27;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
        }

        .quick-action:hover {
            background: linear-gradient(135deg, #38a169, #2d5a27);
            color: white;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(56, 161, 105, 0.3);
        }

        .chat-input-container {
            padding: 20px 25px;
            background: white;
            border-top: 1px solid rgba(0, 0, 0, 0.1);
            display: flex;
            gap: 15px;
            align-items: flex-end;
            flex-shrink: 0;
        }

        
        .chat-input {
            flex: 1;
            min-height: 50px;
            max-height: 120px;
            padding: 15px 20px;
            border: 2px solid #e2e8f0;
            border-radius: 25px;
            resize: none;
            font-family: inherit;
            font-size: 16px;
            outline: none;
            transition: all 0.2s ease;
            background: linear-gradient(135deg, #f7fafc, #edf2f7);
            overflow-y: hidden;
            overflow-x: hidden;
        }


        
        .chat-input:focus {
            border-color: #48bb78;
            box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
            background: white;
        }

        .send-button {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #48bb78, #38a169);
            border: none;
            border-radius: 50%;
            color: white;
            font-size: 20px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .send-button:hover {
            background: linear-gradient(135deg, #38a169, #2d5a27);
            transform: scale(1.05);
            box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
        }

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

        .close-inside-sidebar {
            background: none;
            border: none;
            color: white;
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 15px;
            cursor: pointer;
            align-self: flex-end;
            transition: color 0.2s ease;
        }

        .close-inside-sidebar:hover {
            color: #48bb78;
        }

        /* Mobile Responsiveness - Fixed Layout */
        @media (max-width: 768px) {
            body {
                height: 100vh;
                height: 100dvh; /* Use dynamic viewport height for mobile */
                overflow: hidden;
                position: fixed;
                width: 100%;
            }
            
            .chat-container {
                height: 100vh;
                height: 100dvh; /* Use dynamic viewport height */
                flex-direction: row;
            }

            .sidebar {
                position: fixed;
                top: 0;
                left: 0;
                width: 80%;
                max-width: 320px;
                height: 100vh;
                height: 100dvh;
                min-width: unset;
                transform: translateX(-100%);
                transition: transform 0.3s ease-in-out;
                z-index: 999;
                box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
            }

            .sidebar.mobile-open {
                transform: translateX(0);
            }

            .sidebar.hidden {
                width: 80%;
                max-width: 320px;
                min-width: unset;
                border-right: 1px solid rgba(255, 255, 255, 0.1);
            }

            .main-chat {
                width: 100%;
                flex: 1;
                height: 100vh;
                height: 100dvh;
                display: flex;
                flex-direction: column;
            }

            .main-chat.expanded {
                width: 100%;
            }
            
            .chat-header {
                padding: 12px 15px;
                padding-right: 60px;
                flex-shrink: 0;
                min-height: auto;
            }
            
            .ai-avatar {
                width: 40px;
                height: 40px;
                font-size: 20px;
            }
            
            .bot-name {
                font-size: 18px;
            }
            
            .bot-status {
                font-size: 12px;
            }
            
            .chat-messages {
                flex: 1;
                padding: 10px 15px;
                min-height: 0;
                overflow-y: auto;
                gap: 15px;
            }
            
            .message-content {
                max-width: 85%;
                padding: 10px 15px;
                font-size: 14px;
            }
            
            .message-avatar {
                width: 35px;
                height: 35px;
                font-size: 16px;
            }
            
            .quick-actions {
                padding: 8px 15px;
                flex-shrink: 0;
                gap: 6px;
            }
            
            .quick-action {
                padding: 6px 12px;
                font-size: 12px;
            }
            
            .chat-input-container {
                padding: 10px 15px;
                flex-shrink: 0;
                background: white;
                border-top: 1px solid rgba(0, 0, 0, 0.1);
                 box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05); /* subtle top shadow */
                 border-radius: 16px 16px 0 0; /* soft rounded top */
                gap: 10px;
            }


    
            
            .chat-input {
                font-size: 16px;
                padding: 10px 15px;
                min-height: 40px;
                max-height: 80px;
                border-radius: 20px;
                overflow-y: hidden;
            }
            
            .send-button {
                width: 40px;
                height: 40px;
                font-size: 16px;
                flex-shrink: 0;
            }

            .sidebar-toggle {
                width: 35px;
                height: 35px;
                font-size: 16px;
                top: 10px;
                right: 10px;
            }
        }

        @media (max-width: 480px) {
            .sidebar {
                width: 85%;
                max-width: 300px;
            }
            
            .sidebar-header {
                padding: 12px;
            }
            
            .new-chat-btn {
                padding: 8px 10px;
                font-size: 12px;
            }
            
            .chat-history-item {
                padding: 8px 12px;
                font-size: 12px;
            }
            
            .message-content {
                max-width: 90%;
                padding: 8px 12px;
                font-size: 13px;
            }
            
            .chat-header {
                padding: 8px 12px;
                padding-right: 50px;
            }
            
            .ai-avatar {
                width: 35px;
                height: 35px;
                font-size: 18px;
            }
            
            .bot-name {
                font-size: 16px;
            }
            
            .sidebar-toggle {
                width: 30px;
                height: 30px;
                font-size: 14px;
                top: 8px;
                right: 8px;
            }

            .chat-input-container {
                padding: 8px 12px;
            }

            .chat-input {
                padding: 8px 12px;
                font-size: 16px;
                min-height: 36px;
                max-height: 72px;
            }
            
            .send-button {
                width: 36px;
                height: 36px;
                font-size: 14px;
            }
        }

        /* Extra small screens and landscape phones */
        @media (max-height: 600px) {
            .chat-header {
                padding: 8px 12px;
                padding-right: 50px;
            }
            
            .ai-avatar {
                width: 32px;
                height: 32px;
                font-size: 16px;
            }
            
            .bot-name {
                font-size: 14px;
            }
            
            .bot-status {
                font-size: 11px;
            }
            
            .chat-messages {
                padding: 8px 12px;
                gap: 10px;
            }
            
            .message-content {
                padding: 6px 10px;
                font-size: 12px;
            }
            
            .message-avatar {
                width: 30px;
                height: 30px;
                font-size: 14px;
            }
            
            .quick-actions {
                padding: 6px 12px;
                gap: 4px;
            }
            
            .quick-action {
                padding: 4px 8px;
                font-size: 11px;
            }
            
            .chat-input-container {
                padding: 6px 12px;
            }
            
            .chat-input {
                padding: 6px 10px;
                min-height: 32px;
                max-height: 64px;
                font-size: 14px;
            }
            
            .send-button {
                width: 32px;
                height: 32px;
                font-size: 12px;
            }
            
            .sidebar-toggle {
                width: 28px;
                height: 28px;
                font-size: 12px;
                top: 6px;
                right: 6px;
            }
        }

        /* Fix for iOS Safari */
        @supports (-webkit-appearance: none) {
            @media (max-width: 768px) {
                body {
                    height: 100vh;
                    height: -webkit-fill-available;
                }
                
                .chat-container {
                    height: 100vh;
                    height: -webkit-fill-available;
                }
                
                .main-chat {
                    height: 100vh;
                    height: -webkit-fill-available;
                }
                
                .sidebar {
                    height: 100vh;
                    height: -webkit-fill-available;
                }
            }
        }


 .welcome-popup-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(5px);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 10000;
            opacity: 1;
            transition: opacity 0.3s ease;
        }

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

        .welcome-popup {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 20px;
            padding: 40px;
            max-width: 500px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            position: relative;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
            color: white;
            text-align: center;
            transform: scale(0.9);
            transition: transform 0.3s ease;
        }

        .welcome-popup-overlay:not(.hidden) .welcome-popup {
            transform: scale(1);
        }

        .popup-close {
            position: absolute;
            top: 15px;
            right: 20px;
            background: none;
            border: none;
            font-size: 24px;
            color: rgba(255, 255, 255, 0.8);
            cursor: pointer;
            transition: color 0.2s ease;
        }

        .popup-close:hover {
            color: white;
        }

        .popup-icon {
            font-size: 60px;
            margin-bottom: 20px;
            display: block;
        }

        .popup-title {
            font-size: 28px;
            font-weight: bold;
            margin-bottom: 15px;
            color: white;
        }

        .popup-subtitle {
            font-size: 16px;
            margin-bottom: 25px;
            opacity: 0.9;
            line-height: 1.5;
        }

        .popup-features {
            text-align: left;
            margin: 25px 0;
        }

        .popup-feature {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            padding: 10px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 10px;
            transition: background 0.2s ease;
        }

        .popup-feature:hover {
            background: rgba(255, 255, 255, 0.15);
        }

        .popup-feature-icon {
            font-size: 24px;
            margin-right: 15px;
            width: 30px;
            text-align: center;
        }

        .popup-feature-text {
            flex: 1;
        }

        .popup-feature-title {
            font-weight: bold;
            margin-bottom: 5px;
        }

        .popup-feature-desc {
            font-size: 14px;
            opacity: 0.8;
        }

        .popup-buttons {
            display: flex;
            gap: 15px;
            margin-top: 30px;
        }

        .popup-button {
            flex: 1;
            padding: 12px 20px;
            border: none;
            border-radius: 10px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .popup-button.primary {
            background: white;
            color: #667eea;
        }

        .popup-button.primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
        }

        .popup-button.secondary {
            background: transparent;
            color: white;
            border: 2px solid rgba(255, 255, 255, 0.5);
        }

        .popup-button.secondary:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .popup-footer {
            margin-top: 20px;
            font-size: 12px;
            opacity: 0.7;
        }

        /* Mobile responsiveness */
        @media (max-width: 600px) {
            .welcome-popup {
                padding: 30px 20px;
                margin: 20px;
            }

            .popup-title {
                font-size: 24px;
            }

            .popup-buttons {
                flex-direction: column;
            }
        }


.speech-popup-btn {
    background-color: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-left: 6px;
    color: #4CAF50;
}

.speech-popup-btn:hover {
    color: #2e7d32;
}

.speech-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 30, 30, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.speech-popup {
  background: #1e1e1e;
  color: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  padding: 30px;
  text-align: center;
  position: relative;
}

.speech-popup .popup-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

.speech-content {
  background: #2d2d2d;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
  min-height: 80px;
  font-size: 16px;
}

.speech-transcript {
  margin-top: 10px;
  font-style: italic;
  color: #c0ffc0;
}

.hidden {
  display: none !important;
}

