:root {
   --primary: #2563eb;
   --primary-light: #3b82f6;
   --bg-main: #ffffff;
   --bg-secondary: #f8fafc;
   --text-primary: #0f172a;
   --text-secondary: #64748b;
   --bubble-ai: #f1f5f9;
   --bubble-user: #2563eb;
   --border-color: #e2e8f0;
   --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
   --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1)
}

.dark-theme {
   --bg-main: #0f172a;
   --bg-secondary: #1e293b;
   --text-primary: #f8fafc;
   --text-secondary: #94a3b8;
   --bubble-ai: #1e293b;
   --border-color: #334155
}

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

body {
   font-family: 'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;
   background: var(--bg-secondary);
   color: var(--text-primary);
   line-height: 1.5;
   transition: background-color 0.3s, color 0.3s
}

.app {
   display: flex;
   flex-direction: column;
   height: 100vh;
   max-width: 1200px;
   margin: 0 auto;
   background: var(--bg-main);
   box-shadow: var(--shadow-md)
}

header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 1rem 1.5rem;
   background: var(--bg-main);
   border-bottom: 1px solid var(--border-color);
   position: sticky;
   top: 0;
   z-index: 10
}

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

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

.logo h1 {
   font-size: 1.25rem;
   font-weight: 600;
   background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
   -webkit-background-clip: text;
   -webkit-text-fill-color: transparent
}

.header-actions {
   display: flex;
   gap: 0.5rem
}

.icon-button {
   padding: 0.5rem;
   border: none;
   background: transparent;
   color: var(--text-secondary);
   cursor: pointer;
   border-radius: 0.5rem;
   transition: all 0.2s
}

.icon-button:hover {
   background: var(--bg-secondary);
   color: var(--text-primary)
}

main {
   flex: 1;
   overflow-y: auto;
   padding: 2rem 1rem;
   scroll-behavior: smooth
}

.message-bubble {
   display: flex;
   margin-bottom: 1.5rem;
   animation: slideIn 0.3s ease-out
}

.ai-bubble {
   display: flex;
   gap: 1rem
}

.user-bubble {
   justify-content: flex-end
}

.avatar {
   width: 40px;
   height: 40px;
   border-radius: 12px;
   overflow: hidden;
   flex-shrink: 0
}

.avatar img {
   width: 100%;
   height: 100%;
   object-fit: cover
}

.message {
   position: relative;
   max-width: 80%;
   padding: 1rem 2.5rem 1rem 1.25rem;
   border-radius: 1rem;
   font-size: 0.95rem;
   line-height: 1.6
}

.ai-bubble .message {
   background: var(--bubble-ai);
   border-top-left-radius: 0;
   color: var(--text-primary)
}

.user-bubble .message {
   background: var(--bubble-user);
   color: white;
   border-top-right-radius: 0
}

.copy-button {
   position: absolute;
   top: 0.5rem;
   right: 0.5rem;
   padding: 0.25rem;
   border: none;
   background: transparent;
   color: var(--text-secondary);
   cursor: pointer;
   opacity: 0;
   transition: all 0.2s;
   border-radius: 4px
}

.message:hover .copy-button {
   opacity: 1
}

.copy-button:hover {
   background: var(--bg-secondary);
   color: var(--text-primary)
}

.copy-button.copied {
   color: #10B981
}

.input-area {
   display: flex;
   gap: 0.75rem;
   padding: 1.25rem;
   background: var(--bg-main);
   border-top: 1px solid var(--border-color)
}

textarea {
   flex: 1;
   padding: 0.75rem 1rem;
   border: 1px solid var(--border-color);
   border-radius: 12px;
   resize: none;
   font-family: inherit;
   font-size: 0.95rem;
   line-height: 1.5;
   max-height: 200px;
   background: var(--bg-main);
   color: var(--text-primary);
   transition: border-color 0.2s
}

textarea:focus {
   outline: none;
   border-color: var(--primary)
}

.send-button {
   width: 44px;
   height: 44px;
   border-radius: 12px;
   border: none;
   background: var(--primary);
   color: white;
   cursor: pointer;
   transition: all 0.2s;
   display: flex;
   align-items: center;
   justify-content: center
}

.send-button:hover:not(:disabled) {
   background: var(--primary-light);
   transform: translateY(-1px)
}

.send-button:disabled {
   background: var(--text-secondary);
   cursor: not-allowed;
   opacity: 0.5
}

.typing-indicator {
   display: flex;
   gap: 4px;
   padding: 1rem;
   animation: fadeIn 0.3s
}

.typing-dot {
   width: 8px;
   height: 8px;
   background: var(--primary);
   border-radius: 50%;
   animation: bounce 1.4s infinite
}

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

.message p {
   margin-bottom: 1rem
}

.message p:last-child {
   margin-bottom: 0
}

.message ul, .message ol {
   margin: 1rem 0;
   padding-left: 1.5rem
}

.message li {
   margin-bottom: 0.5rem
}

.message li:last-child {
   margin-bottom: 0
}

.message ul li {
   list-style-type: disc;
   color: var(--text-primary)
}

.user-bubble .message ul li,
.user-bubble .message ol li {
   color: white
}

.message ol li {
   list-style-type: decimal
}

.message code {
   font-family: monospace;
   background: rgba(0, 0, 0, 0.1);
   padding: 0.2em 0.4em;
   border-radius: 4px;
   font-size: 0.9em
}

.message pre {
   background: rgba(0, 0, 0, 0.1);
   padding: 1rem;
   border-radius: 8px;
   overflow-x: auto;
   margin: 1rem 0
}

.message pre code {
   background: none;
   padding: 0;
   border-radius: 0
}

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

@keyframes fadeIn {
   from { opacity: 0 }
   to { opacity: 1 }
}

@keyframes bounce {
   0%, 60%, 100% { transform: translateY(0) }
   30% { transform: translateY(-4px) }
}

@media (max-width: 768px) {
   .message {
       max-width: 85%
   }
   
   .input-area {
       padding: 1rem
   }
   
   textarea {
       padding: 0.5rem 0.75rem
   }
}

@media (max-width: 480px) {
   .logo h1 {
       font-size: 1.1rem
   }
   
   .message {
       max-width: 90%;
       font-size: 0.9rem
   }
}

