 :root {
            --primary-color: #2a6477;
            --secondary-color: #17202a;
            --accent-color: #4f9db3;
            --text-color: #ffffff;
            --user-message-bg: rgba(42, 100, 119, 0.4);
            --assistant-message-bg: rgba(23, 32, 42, 0.8);
            --gradient-start: #1a2a3a;
            --gradient-end: #0d1b2a;
            --sidebar-width: 80px;
            --sidebar-expanded-width: 280px;
            --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            --shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
            --radius: 16px;
        }

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

        body {
            font-family: var(--font-family);
            background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
            margin: 0;
            padding: 0;
            color: var(--text-color);
            min-height: 100vh;
            overflow-x: hidden;
            position: relative;
            font-size: 14px;
            line-height: 1.5;
        }

        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: 
                radial-gradient(circle at 20% 80%, rgba(42, 100, 119, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(79, 157, 179, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(23, 32, 42, 0.2) 0%, transparent 50%);
            z-index: -1;
        }

        .app-container {
            display: flex;
            min-height: 100vh;
        }

        /* Sidebar Styles */
        .sidebar {
            width: var(--sidebar-expanded-width);
            background: rgba(23, 32, 42, 0.95);
            backdrop-filter: blur(15px);
            border-right: 1px solid rgba(79, 157, 179, 0.3);
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            overflow: hidden;
            position: fixed;
            left: 0;
            top: 0;
            height: 100vh;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            box-shadow: var(--shadow);
        }

        .sidebar.collapsed {
            width: var(--sidebar-width);
            transform: translateX(-100%);
        }

        .sidebar-logo {
            padding: 20px 15px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }

        .sidebar-logo img {
            width: 50%;
            height: auto;
            transition: all 0.3s ease;
            filter: drop-shadow(0 0 5px rgba(79, 157, 179, 0.5));
        }

        .sidebar.collapsed .sidebar-logo img {
            width: 40px;
            height: 40px;
        }

        .sidebar-logo-text {
            margin-left: 10px;
            font-weight: 600;
            font-size: 1.1rem;
            white-space: nowrap;
            transition: opacity 0.3s ease 0.1s;
        }

        .sidebar.collapsed .sidebar-logo-text {
            opacity: 0;
        }

        .sidebar-toggle {
            background: none;
            border: none;
            color: var(--text-color);
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            padding: 8px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 36px;
            height: 36px;
            margin: 10px auto;
        }

        .sidebar-toggle:hover {
            background: rgba(42, 100, 119, 0.3);
        }

        .sidebar.collapsed .sidebar-toggle {
            transform: rotate(180deg);
        }

        .new-chat-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--primary-color);
            color: var(--text-color);
            border: none;
            border-radius: 12px;
            padding: 12px 16px;
            margin: 15px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 500;
            font-size: 0.9rem;
            gap: 10px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
        }

        .new-chat-btn:hover {
            background: var(--accent-color);
            transform: translateY(-2px);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
        }

        .new-chat-btn i {
            font-size: 1rem;
        }

        .new-chat-text {
            white-space: nowrap;
            transition: opacity 0.3s ease;
        }

        .sidebar.collapsed .new-chat-text {
            opacity: 0;
        }

        .sidebar-nav {
            flex: 1;
            padding: 10px 0;
            overflow-y: auto;
        }

        .nav-item {
            display: flex;
            align-items: center;
            padding: 12px 20px;
            color: var(--text-color);
            text-decoration: none;
            transition: all 0.3s ease;
            white-space: nowrap;
            gap: 15px;
            border-radius: 0;
            margin: 0 10px;
            font-size: 0.9rem;
        }

        .nav-item:hover {
            background: rgba(42, 100, 119, 0.3);
            border-radius: 10px;
        }

        .nav-item i {
            font-size: 1.1rem;
            min-width: 24px;
            text-align: center;
        }

        .nav-text {
            transition: opacity 0.3s ease;
        }

        .sidebar.collapsed .nav-text {
            opacity: 0;
        }

        .nav-divider {
            height: 1px;
            background: rgba(255, 255, 255, 0.1);
            margin: 10px 20px;
        }

        .conversation-history {
            margin-top: 10px;
            padding: 0 10px;
        }

        .history-title {
            font-size: 0.8rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            padding: 10px 15px;
            color: rgba(255, 255, 255, 0.6);
            transition: opacity 0.3s ease;
        }

        .sidebar.collapsed .history-title {
            opacity: 0;
        }

        .history-item {
            display: flex;
            align-items: center;
            padding: 10px 15px;
            color: var(--text-color);
            text-decoration: none;
            transition: all 0.3s ease;
            white-space: nowrap;
            gap: 12px;
            border-radius: 8px;
            margin-bottom: 5px;
            font-size: 0.85rem;
            cursor: pointer;
            opacity: 0.8;
        }

        .history-item:hover {
            background: rgba(42, 100, 119, 0.2);
            opacity: 1;
        }

        .history-item i {
            font-size: 0.9rem;
            min-width: 20px;
            text-align: center;
        }

        .history-text {
            overflow: hidden;
            text-overflow: ellipsis;
            transition: opacity 0.3s ease;
        }

        .sidebar.collapsed .history-text {
            opacity: 0;
        }

        /* Floating toggle button for collapsed sidebar */
        .floating-toggle {
            position: fixed;
            top: 20px;
            left: 20px;
            background: rgba(23, 32, 42, 0.9);
            border: 1px solid rgba(79, 157, 179, 0.3);
            color: var(--text-color);
            width: 44px;
            height: 44px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 999;
            backdrop-filter: blur(10px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
            opacity: 0;
            pointer-events: none;
        }

        .floating-toggle.visible {
            opacity: 1;
            pointer-events: all;
        }

        .floating-toggle:hover {
            background: rgba(42, 100, 119, 0.3);
            transform: scale(1.05);
        }

        /* Main Content */
        .main-content {
            flex: 1;
            margin-left: 0;
            transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            width: 100%;
        }

        .sidebar:not(.collapsed) ~ .main-content {
            margin-left: var(--sidebar-expanded-width);
        }

        .header-section {
            text-align: center;
            padding: 30px 20px 15px;
            position: relative;
        }

        .logo-container {
            position: relative;
            display: inline-block;
            margin-bottom: 10px;
        }

        .logo {
            width: 50%;
            max-width: 250px;
            filter: drop-shadow(0 0 10px rgba(79, 157, 179, 0.5));
            transition: all 0.5s ease;
        }

        .logo:hover {
            transform: scale(1.05);
            filter: drop-shadow(0 0 15px rgba(79, 157, 179, 0.8));
        }

        .welcome-text {
            font-size: 1rem;
            margin-bottom: 10px;
            opacity: 0.9;
            font-weight: 300;
            letter-spacing: 0.5px;
            transition: opacity 0.5s ease;
        }

        .welcome-text.fade-out {
            opacity: 0;
        }

        /* Chat Container */
        .chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            padding: 0 20px 20px;
            max-width: 800px;
            margin: 0 auto;
            width: 100%;
        }

        #chat-history {
            flex-grow: 1;
            padding: 15px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 12px;
            position: relative;
            scroll-behavior: smooth;
        }

        /* Message Styles */
        .message {
            margin-bottom: 12px;
            max-width: 85%;
            padding: 12px 16px;
            border-radius: var(--radius);
            line-height: 1.5;
            position: relative;
            animation: messageAppear 0.4s ease-out;
            backdrop-filter: blur(5px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            font-size: 0.9rem;
            overflow: hidden;
        }

        @keyframes messageAppear {
            0% {
                opacity: 0;
                transform: translateY(15px);
            }
            100% {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .user-message {
            background: var(--user-message-bg);
            margin-left: auto;
            border-bottom-right-radius: 5px;
            border: 1px solid rgba(79, 157, 179, 0.3);
        }

        .user-message::after {
            content: '';
            position: absolute;
            bottom: 0;
            right: -10px;
            width: 0;
            height: 0;
            border: 10px solid transparent;
            border-left-color: var(--user-message-bg);
            border-right: 0;
            border-bottom: 0;
            margin-top: -5px;
            margin-right: -10px;
        }

        .assistant-message {
            background: var(--assistant-message-bg);
            margin-right: auto;
            border-bottom-left-radius: 5px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .assistant-message::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: -10px;
            width: 0;
            height: 0;
            border: 10px solid transparent;
            border-right-color: var(--assistant-message-bg);
            border-left: 0;
            border-bottom: 0;
            margin-top: -5px;
            margin-left: -10px;
        }

        .message-content {
            margin: 0;
            opacity: 0;
            transform: translateY(5px);
            transition: opacity 0.3s ease, transform 0.3s ease;
        }

        .message-content.visible {
            opacity: 1;
            transform: translateY(0);
        }

        .message-typing {
            display: inline-block;
            overflow: hidden;
            border-right: 2px solid var(--accent-color);
            white-space: nowrap;
            animation: typing 1s steps(40, end), blink-caret 0.75s step-end infinite;
        }

        @keyframes typing {
            from { width: 0 }
            to { width: 100% }
        }

        @keyframes blink-caret {
            from, to { border-color: transparent }
            50% { border-color: var(--accent-color) }
        }

        .typing-indicator {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 12px 16px;
            background: var(--assistant-message-bg);
            border-radius: var(--radius);
            max-width: 70px;
            margin-right: auto;
            border-bottom-left-radius: 5px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% {
                opacity: 0.6;
            }
            50% {
                opacity: 1;
            }
            100% {
                opacity: 0.6;
            }
        }

        .typing-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background-color: var(--accent-color);
            animation: typingAnimation 1.4s infinite ease-in-out;
        }

        .typing-dot:nth-child(1) {
            animation-delay: -0.32s;
        }

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

        @keyframes typingAnimation {
            0%, 80%, 100% {
                transform: scale(0.8);
                opacity: 0.5;
            }
            40% {
                transform: scale(1);
                opacity: 1;
            }
        }

        /* Fixed Input Area */
        .input-area {
            padding: 15px;
            background: rgba(23, 32, 42, 0.9);
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            position: sticky;
            bottom: 0;
            backdrop-filter: blur(10px);
            border-radius: 20px;
        }

        .input-wrapper {
            position: relative;
            display: flex;
            align-items: flex-end;
            background: rgba(42, 100, 119, 0.2);
            border-radius: var(--radius);
            padding: 8px;
            border: 1px solid rgba(79, 157, 179, 0.3);
            transition: all 0.3s ease;
            max-width: 750px;
            margin: 0 auto;
        }

        .input-wrapper:focus-within {
            box-shadow: 0 0 0 2px rgba(79, 157, 179, 0.5);
            background: rgba(42, 100, 119, 0.3);
            transform: translateY(-2px);
        }

        textarea {
            flex-grow: 1;
            padding: 10px 12px;
            background: transparent;
            color: var(--text-color);
            border-radius: 12px;
            font-size: 0.9rem;
            border: none;
            resize: none;
            max-height: 100px;
            outline: none;
            font-family: var(--font-family);
            transition: all 0.3s ease;
        }

        textarea::placeholder {
            color: rgba(255, 255, 255, 0.6);
        }

        .controls {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-left: 8px;
        }

        .send-btn {
            background: var(--primary-color);
            border: none;
            color: var(--text-color);
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }

        .send-btn:hover {
            background: var(--accent-color);
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
        }

        .send-btn:active {
            transform: translateY(-1px);
        }

        .send-btn:disabled {
            background: rgba(42, 100, 119, 0.3);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        /* Particles */
        .particles {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
            overflow: hidden;
        }

        .particle {
            position: absolute;
            background: rgba(79, 157, 179, 0.2);
            border-radius: 50%;
            animation: float 15s infinite linear;
        }

        @keyframes float {
            0% {
                transform: translateY(0) translateX(0) rotate(0deg);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateY(-100vh) translateX(100px) rotate(360deg);
                opacity: 0;
            }
        }

        /* Scrollbar Styling */
        #chat-history::-webkit-scrollbar {
            width: 6px;
        }

        #chat-history::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 10px;
        }

        #chat-history::-webkit-scrollbar-thumb {
            background: rgba(79, 157, 179, 0.5);
            border-radius: 10px;
        }

        #chat-history::-webkit-scrollbar-thumb:hover {
            background: rgba(79, 157, 179, 0.7);
        }

        /* Responsive - CORRECTIONS MOBILE */
        @media (max-width: 768px) {
            .sidebar {
                width: 85%;
                max-width: 280px;
                transform: translateX(-100%);
                transition: transform 0.3s ease;
            }
            
            .sidebar:not(.collapsed) {
                transform: translateX(0);
            }
            
            .sidebar.collapsed {
                transform: translateX(-100%);
            }
            
            .main-content {
                margin-left: 0 !important;
                width: 100%;
            }
            
            .chat-area {
                padding: 0 10px 10px;
            }
            
            .message {
                max-width: 90%;
            }
            
            .welcome-text {
                font-size: 0.9rem;
            }
            
            .header-section {
                padding: 20px 15px 10px;
            }
            
            .logo {
                width: 70%;
            }
            
            .input-wrapper {
                margin: 0 5px;
            }
            
            .floating-toggle {
                top: 15px;
                left: 15px;
                width: 40px;
                height: 40px;
            }
        }

        @media (max-width: 480px) {
            .sidebar {
                width: 90%;
            }
            
            .logo {
                width: 70%;
            }
            
            .message {
                max-width: 95%;
                font-size: 0.85rem;
                padding: 10px 12px;
            }
            
            .chat-area {
                padding: 0 5px 5px;
            }
            
            .input-area {
                padding: 10px;
            }
            
            .floating-toggle {
                top: 10px;
                left: 10px;
                width: 38px;
                height: 38px;
            }
        }

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

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

        @media (min-width: 769px) {
            .sidebar-overlay {
                display: none;
            }
        }
