/* AI Page (ChatGPT-like) Layout - uses project theme variables */



.ai-app {
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--main-bg);
    color: var(--text-color);
    overflow: hidden;
}

/* Top bar */
.ai-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: transparent;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.menu-toggle {
    display: flex;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(22,42,51,0.6);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.menu-toggle:hover {
    color: #fff;
    border-color: var(--primary-color);
    background: rgba(22,42,51,1);
}
.ai-topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
}
.ai-topbar .brand img { height: 24px; }
.ai-topbar .actions { display: flex; gap: 8px; }
.ai-topbar .actions .btn {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.95rem;
}

/* Main area: sidebar + conversation */
.ai-main {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0; /* for proper overflow */
}

/* Sidebar */
.ai-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    border-right: 1px solid rgba(255,255,255,0.06);
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    transform: translateX(-100%);
    box-shadow: 0 0 0 rgba(0,0,0,0);
}

/* Desktop: sidebar open by default */
@media (min-width: 993px) {
    .ai-sidebar {
        transform: translateX(0);
    }
    
    /* Collapsed sidebar state for desktop */
    .ai-sidebar.collapsed {
        width: 60px;
        transform: translateX(0);
        overflow: hidden;
        transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: 2px 0 20px rgba(0,0,0,0.1);
    }
    
    /* Hide content with animation when collapsed */
    .ai-sidebar.collapsed .new-chat {
        opacity: 1;
        transform: scale(1);
        transition: all 0.3s ease;
    }
    
    .ai-sidebar.collapsed .chat-section {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
        transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .ai-sidebar.collapsed .sidebar-header {
        justify-content: center;
        padding: 16px 8px;
        position: relative;
        /* Logo remains static in collapsed state */
    }
    
    .ai-sidebar.collapsed .sidebar-header img {
        height: 28px;
        width: 28px;
        margin-right: 0;
        /* Logo size changes but no animations */
    }
    
    .ai-sidebar.collapsed .sidebar-close {
        display: none;
    }
    
    .ai-sidebar.collapsed .history {
        display: none;
    }
    
    /* Show new chat icon in collapsed state */
    .ai-sidebar.collapsed .new-chat {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        margin: 8px;
        margin-top: 21px;
        border: 1px dashed rgba(255,255,255,0.12);
        border-radius: 8px;
        text-align: center;
        cursor: pointer;
        /* Removed transition - plus icon should be static */
        font-size: 0.8rem;
        font-weight: 500;
        background: transparent;
        color: var(--text-light);
        min-height: 40px;
    }
    
    .ai-sidebar.collapsed .new-chat:hover {
        border-color: var(--primary-color);
        color: var(--primary-color);
        background: rgba(237,108,58,0.1);
        /* No hover animations - plus icon remains static */
    }
    
    .ai-sidebar.collapsed .new-chat i {
        display: none;
    }
    
    .ai-sidebar.collapsed .new-chat::before {
        content: '\f067';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 16px;
        margin-right: 0;
    }
    
    .ai-sidebar.collapsed .new-chat span {
        display: none;
    }
    
    .ai-sidebar.collapsed .chat-section {
        display: none;
    }
    
    /* Show menu icon on hover for collapsed sidebar */
    .ai-sidebar.collapsed .sidebar-header::after {
        content: '\f0c9';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        opacity: 0;
        font-size: 24px;
        color: var(--text-light);
        pointer-events: none;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .ai-sidebar.collapsed:hover .sidebar-header::after {
        opacity: 1;
        /* Logo remains static - no animations on hover */
    }
    
    .ai-sidebar.collapsed:hover .sidebar-header img {
        opacity: 0;
        /* Logo fades out but no transition animations */
    }
    
    .ai-sidebar.collapsed:hover .sidebar-header {
        cursor: pointer;
        /* Header remains static */
    }
}

/* Sidebar overlay */
.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: opacity 0.3s ease, visibility 0.3s ease;
}

/* Hide overlay on desktop when sidebar is open by default */
@media (min-width: 993px) {
    .sidebar-overlay {
        display: none;
    }
}

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

/* Sidebar header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 12px;
    background: var(--bg-dark);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-color);
    position: sticky;
    top: 0;
    z-index: 10;
    /* Removed transition - logo should be static */
}

/* Sidebar open state */
.ai-sidebar.open {
    transform: translateX(0);
}

/* Static when sidebar opens */
.ai-sidebar.open .new-chat {
    opacity: 1;
    transform: scale(1);
    /* Removed animation - plus icon should be static */
}

.ai-sidebar.open .chat-section {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    animation: slideInUpEnhanced 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s forwards;
}

/* Sidebar closed state */
.ai-sidebar.closed {
    transform: translateX(-100%);
}

/* Desktop sidebar styling */
@media (min-width: 993px) {
    .ai-sidebar {
        width: 320px;
    }
    
    /* Show sidebar header on desktop */
    .sidebar-header {
        display: flex;
    }
    
    /* Sidebar close button on desktop */
    .sidebar-close {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

.sidebar-header img {
    height: 26px;
    width: 26px;
    margin-right: 4px;
    /* Logo is completely static - no animations or interactions */
}
.sidebar-header .orange {
    color: var(--primary-color);
}

/* Sidebar close button */
.sidebar-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(22,42,51,0.6);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-close:hover {
    color: #fff;
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.15);
}

.ai-sidebar .new-chat {
    padding: 12px;
    margin: 12px;
    margin-top: 16px;
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    /* Removed all transitions and animations - plus icon should be static */
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 1;
    transform: scale(1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    width: auto;
    white-space: nowrap;
}

/* Static new-chat when sidebar opens */
.ai-sidebar.open .new-chat {
    opacity: 1;
    transform: scale(1);
    /* Removed animation - plus icon should be static */
    min-height: 44px;
    width: auto;
    padding: 12px;
    margin: 12px;
    margin-top: 16px;
}

/* Static new-chat on initial load when sidebar is not collapsed */
.ai-sidebar:not(.collapsed):not(.closed) .new-chat {
    opacity: 1;
    transform: scale(1);
    /* Removed animation - plus icon should be static */
    min-height: 44px;
    width: auto;
    padding: 12px;
    margin: 12px;
    margin-top: 16px;
}

.ai-sidebar .new-chat i {
    font-size: 14px;
    color: var(--text-light);
    /* Removed all transitions - plus icon should be completely static */
}
.ai-sidebar .new-chat:hover { 
    border-color: var(--primary-color); 
    color: var(--primary-color); 
    /* Removed all hover animations - plus icon should be static */
}

.ai-sidebar .new-chat:hover i {
    color: var(--primary-color);
    /* Removed rotation animation - plus icon should be static */
}

/* Chat section */
.ai-sidebar .chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    animation: slideInUpEnhanced 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s forwards;
}


.ai-sidebar .chat-label {
    padding: 8px 12px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 8px;
}

.ai-sidebar .history {
    padding: 8px 12px;
    overflow: auto;
    flex: 1;
}
.ai-sidebar .history .item {
    padding: 8px 8px;
    border-radius: 10px;
    color: var(--text-light);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transform: translateX(0);
}
.ai-sidebar .history .item:hover { 
    background: var(--bg-light); 
    color: var(--text-color); 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.ai-sidebar .history .item.active { background: rgba(255,255,255,0.06); color: var(--text-color); }
.ai-sidebar .history .item .title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-sidebar .history .item .menu-btn {
    width: 28px; height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(22,42,51,0.6);
    display: grid; place-items: center;
    color: var(--text-lighter);
    cursor: pointer; transition: var(--transition);
}
.ai-sidebar .history .item .menu-btn:hover { color: #fff; border-color: rgba(255,255,255,0.2); }

/* Context menu */
.context-menu {
    position: absolute;
    background: var(--bg-lighter);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 1001;
    display: none;
}
.context-menu.show { display: block; }
.context-menu .menu-item {
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.context-menu .menu-item:hover { background: var(--bg-light); color: var(--text-color); }
.context-menu .menu-item[data-action="delete"] { color: #f44336; }
.context-menu .menu-item[data-action="delete"]:hover { background: rgba(244, 67, 54, 0.15); color: #f44336; }

/* Conversation area */
.ai-conversation {
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 0;
}
.ai-messages {
    padding: 24px 0 12px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.ai-messages .container { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.ai-empty-hero {
    display: grid;
    place-items: center;
    text-align: center;
    padding: 40px 16px;
    color: var(--text-light);
}
.ai-empty-hero h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

/* Composer */
.ai-composer {
    border-top: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(180deg, rgba(12,25,30,0.7), var(--bg-dark));
}
.ai-composer .container { max-width: 900px; margin: 0 auto; padding: 12px 16px; }
.composer-prompt {
    color: var(--text-color);
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin: 4px 6px 35px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: block;
}
.composer-prompt.hidden { display: none; }
.composer-box {
    background: rgba(29, 53, 64, 0.7);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    padding: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
    backdrop-filter: blur(8px);
    transition: box-shadow .25s ease, border-color .25s ease, background .25s ease, border-radius .25s ease;
}
.composer-box:focus-within {
    border-color: rgba(237,108,58,0.5);
    box-shadow: 0 8px 20px rgba(237,108,58,0.14), 0 1px 0 rgba(237,108,58,0.12) inset;
    background: rgba(29, 53, 64, 0.82);
}
.composer-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 6px;
}
.composer-input {
    flex: 1;
    min-height: 44px;
    max-height: 160px;
    background: transparent;
    border: none;
    color: var(--text-color);
    resize: none;
    outline: none;
    font-family: 'Mulish', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    padding: 10px 12px;
}
.composer-input::placeholder { color: var(--text-lighter); }
.composer-actions {
    display: flex;
    gap: 8px;
}
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.1);
    display: grid;
    place-items: center;
    background: rgba(22,42,51,0.9);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}
.icon-btn:hover { color: #fff; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(237,108,58,0.15); background: rgba(22,42,51,1); }
.send-btn { width: 44px; height: 44px; background: var(--primary-color); color: #fff; border: none; box-shadow: 0 5px 14px rgba(237,108,58,0.28); }
.send-btn:hover { background: var(--primary-dark); box-shadow: 0 6px 18px rgba(237,108,58,0.36); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.voice-btn { 
  width: 44px; 
  height: 44px; 
  background: #3EBCE8; 
  color: #fff; 
  border: none; 
  box-shadow: 0 5px 14px rgba(62,188,232,0.28);
  cursor: pointer;
  transition: all 0.3s ease;
}
.voice-btn:hover { 
  background: #2BA5D1; 
  box-shadow: 0 6px 18px rgba(62,188,232,0.36);
  transform: scale(1.05);
}
.voice-btn.listening { 
  background: #f44336; 
  animation: pulse 1.5s infinite;
  box-shadow: 0 5px 14px rgba(244,67,54,0.28);
}
.voice-btn.listening:hover { 
  background: #d32f2f; 
  box-shadow: 0 6px 18px rgba(244,67,54,0.36);
}

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

.message { display: flex; gap: 0; margin-bottom: 14px; align-items: flex-start; }
.message.user { justify-content: flex-end; margin-right: 0; }
.message.user .avatar { order: 2; }
.message.user .bubble { order: 1; }
.message.ai { justify-content: flex-start; margin-left: 0; }
/* Hide avatar/icon next to messages for both user and bot */
.avatar { display: none !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important; }
.bubble {
    background: var(--bg-light);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 12px;
}
.bubble.user { background: var(--primary-color); color: #fff; border-color: rgba(0,0,0,0.05); }
.bubble.ai { 
    background: transparent !important; 
    border: none !important; 
    padding: 0 !important; 
    box-shadow: none !important;
    margin-left: 16px;
}

/* Ensure bullet points are visible in AI messages */
.bubble.ai ul {
    margin: 0.5em 0;
    padding-left: 1.5em;
    list-style-type: disc;
}

.bubble.ai ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
    list-style-type: decimal;
}

.bubble.ai li {
    margin: 0.3em 0;
    line-height: 1.5;
    display: list-item;
}

.bubble.ai li::marker {
    color: var(--primary-color);
}

/* Copy button styles to follow page margins */
.copy-btn {
    position: absolute;
    bottom: 12px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* Edit button styles */
.edit-btn {
    position: absolute;
    bottom: 12px;
    background: #3EBCE8;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(62, 188, 232, 0.15);
    z-index: 10;
}

.edit-btn:hover {
    background: #2BA5D1;
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 4px 12px rgba(62, 188, 232, 0.2);
}

.edit-btn:active {
    transform: translateY(-1px) scale(1.05);
}

.edit-btn i {
    font-size: 10px;
}

/* Regenerate button styles */
.regenerate-btn {
    position: absolute;
    bottom: 12px;
    background: #3EBCE8;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.15);
    z-index: 10;
}

.regenerate-btn:hover {
    background: #37a9d3;
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.2);
}

.regenerate-btn:active {
    transform: translateY(-1px) scale(1.05);
}

.regenerate-btn i {
    font-size: 10px;
}

.copy-btn:hover {
    background: #e55a2b;
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.copy-btn:active {
    transform: translateY(-1px) scale(1.05);
}

.copy-btn i {
    font-size: 12px;
}

/* AI message copy and regenerate buttons - follows left margin */
.message.ai {
    position: relative;
}

.message.ai .copy-btn {
    left: 16px;
    opacity: 1 !important; /* Always visible for AI messages */
}

.message.ai .regenerate-btn {
    left: 56px; /* Position regenerate button to the right of copy button */
    opacity: 1 !important; /* Always visible for AI messages */
}

/* User message copy and edit buttons - follows right margin */
.message.user {
    position: relative;
}

.message.user .copy-btn {
    right: 16px;
}

.message.user .edit-btn {
    right: 56px; /* Position edit button to the left of copy button */
}

/* Show copy, edit, and regenerate buttons on hover */
.message:hover .copy-btn,
.message:hover .edit-btn,
.message:hover .regenerate-btn {
    opacity: 1;
}

/* Ensure proper spacing for messages with copy buttons */
.message {
    padding-bottom: 50px;
}

/* Edit mode styles */
.edit-input {
    width: 100%;
    min-height: 44px;
    max-height: 160px;
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    color: var(--text-color);
    resize: none;
    outline: none;
    font-family: 'Mulish', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    padding: 10px 12px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.edit-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(237, 108, 58, 0.15);
}

.edit-actions {
    display: flex !important;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
    width: 100%;
    flex-wrap: wrap;
}

.cancel-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(22,42,51,0.6);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex !important;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.cancel-btn:hover {
    background: rgba(244, 67, 54, 0.15);
    border-color: #f44336;
    color: #f44336;
}

.send-edit-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex !important;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.send-edit-btn:hover {
    background: #e55a2b;
    transform: translateY(-1px);
}

/* Image upload styles */
.image-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.1);
    display: grid;
    place-items: center;
    background: rgba(22,42,51,0.9);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 8px;
}

.image-btn:hover {
    color: #fff;
    border-color: #3EBCE8;
    box-shadow: 0 0 0 3px rgba(62, 188, 232, 0.15);
    background: rgba(22,42,51,1);
}

.image-preview {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.image-preview img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Drag and drop styles */
.composer-box.drag-over {
    border-color: #3EBCE8 !important;
    background: rgba(62, 188, 232, 0.1) !important;
    box-shadow: 0 0 0 3px rgba(62, 188, 232, 0.15) !important;
}

/* Responsive */
@media (max-width: 992px) {
    .ai-main { grid-template-columns: 1fr; }
    
    /* Prevent horizontal scrolling on mobile */
    body, html {
        overflow-x: hidden !important;
        overflow-y: auto;
        height: 100vh;
        position: relative;
        width: 100% !important;
        max-width: 100vw !important;
        touch-action: pan-y;
    }
    
    /* Prevent horizontal scrolling for the main app */
    .ai-app {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure all containers don't exceed viewport width */
    .ai-main,
    .ai-conversation,
    .ai-messages,
    .ai-composer {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* Make topbar buttons smaller on mobile */
    .ai-topbar {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        padding: 10px 16px !important;
    }
    
    .ai-topbar .topbar-left {
        flex-shrink: 0;
        overflow: hidden;
    }
    
    .ai-topbar .actions {
        flex-shrink: 0;
        overflow: hidden;
        gap: 6px;
    }
    
    .ai-topbar .actions .btn {
        padding: 6px 10px;
        font-size: 0.85rem;
        border-radius: 8px;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    /* Make profile button smaller */
    .ai-topbar .actions .btn i {
        font-size: 0.9rem;
    }
    
    /* Add top padding to sidebar for mobile */
    .ai-sidebar {
        padding-top: 0;
        overflow-x: hidden !important;
    }
    
    /* Sidebar header on mobile */
    .sidebar-header {
        padding: 20px 12px 16px;
        justify-content: space-between;
        /* Logo remains static on mobile */
    }
    .sidebar-header img {
        height: 26px;
        width: 26px;
        margin-right: 4px;
        /* Logo size changes but no animations */
    }
    
    /* Sidebar close button on mobile */
    .sidebar-close {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    /* Mobile: Fixed composer at bottom */
    .ai-composer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        z-index: 100 !important;
        border-top: 1px solid rgba(255,255,255,0.06) !important;
        background: linear-gradient(180deg, rgba(12,25,30,0.95), var(--bg-dark)) !important;
        backdrop-filter: blur(10px) !important;
        padding: 12px 16px !important;
        box-sizing: border-box !important;
    }
    
    /* Mobile: always show composer at bottom, prompt in center */
    .is-empty .ai-composer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        z-index: 100 !important;
        border-top: 1px solid rgba(255,255,255,0.06) !important;
        background: linear-gradient(180deg, rgba(12,25,30,0.95), var(--bg-dark)) !important;
        backdrop-filter: blur(10px) !important;
        padding: 12px 16px !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure consistent composer styling on mobile */
    .ai-composer .container {
        max-width: 100% !important;
        padding: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .composer-box {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }
    
    /* Ensure consistent styling for both empty and filled states */
    .is-empty .composer-box,
    .composer-box {
        background: rgba(29, 53, 64, 0.7) !important;
        border: 1px solid rgba(255,255,255,0.08) !important;
        border-radius: 24px !important;
        backdrop-filter: blur(8px) !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.18) !important;
        padding: 8px !important;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure composer input is consistent */
    .composer-input {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure composer actions are consistent */
    .composer-actions {
        flex-shrink: 0 !important;
    }
    .is-empty .ai-messages {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 40px 16px 120px 16px; /* Add bottom padding for fixed composer */
        min-height: calc(100vh - 120px); /* Account for fixed composer */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Allow scrolling in messages area on mobile */
    .ai-messages {
        overflow-y: auto;
        max-height: calc(100vh - 120px); /* Account for fixed composer */
        padding-bottom: 120px; /* Add bottom padding for fixed composer */
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure normal composer (after sending messages) has proper margins */
    .ai-composer:not(.is-empty) {
        padding: 12px 16px !important;
    }
    
    .ai-composer:not(.is-empty) .container {
        padding: 0 !important;
    }
    
    /* Ensure messages container follows same margin as composer on mobile */
    .ai-messages .container {
        max-width: 100% !important;
        padding: 0 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    /* Ensure message margins are consistent on mobile */
    .message.ai {
        justify-content: flex-start !important;
        margin-left: 0 !important;
    }
    
    .message.user {
        justify-content: flex-end !important;
        margin-right: 0 !important;
    }
    
    /* Ensure AI messages appear as text only on mobile */
    .bubble.ai {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
        margin-left: 16px !important;
    }
    
    /* Ensure bullet points are visible in AI messages on mobile */
    .bubble.ai ul {
        margin: 0.5em 0 !important;
        padding-left: 1.5em !important;
        list-style-type: disc !important;
    }
    
    .bubble.ai ol {
        margin: 0.5em 0 !important;
        padding-left: 1.5em !important;
        list-style-type: decimal !important;
    }
    
    .bubble.ai li {
        margin: 0.3em 0 !important;
        line-height: 1.5 !important;
        display: list-item !important;
    }
    
    .bubble.ai li::marker {
        color: var(--primary-color) !important;
    }
    
    /* Copy, edit, and regenerate button responsive positioning */
    .message.ai .copy-btn {
        left: 16px !important;
        opacity: 1 !important; /* Always visible for AI messages on mobile */
    }
    
    .message.ai .regenerate-btn {
        left: 56px !important;
        opacity: 1 !important; /* Always visible for AI messages on mobile */
    }
    
    .message.user .copy-btn {
        right: 16px !important;
    }
    
    .message.user .edit-btn {
        right: 56px !important;
    }
    .is-empty .ai-empty-hero {
        display: block !important;
        text-align: center;
    }
    .is-empty .ai-empty-hero .desktop-title {
        display: none;
    }
    .is-empty .ai-empty-hero .mobile-title {
        display: block;
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    .is-empty .composer-prompt {
        display: none !important;
    }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
    /* Make buttons even smaller on very small screens */
    .ai-topbar .actions .btn {
        padding: 5px 8px;
        font-size: 0.8rem;
        border-radius: 6px;
        min-width: auto;
        white-space: nowrap;
    }
    
    /* Reduce gap between buttons */
    .ai-topbar .actions {
        gap: 4px;
    }
    
    /* Make profile button icon smaller */
    .ai-topbar .actions .btn i {
        font-size: 0.85rem;
    }
    
    /* Adjust topbar padding for smaller buttons */
    .ai-topbar {
        padding: 8px 12px !important;
        overflow-x: hidden !important;
    }
    
    /* Ensure buttons don't wrap */
    .ai-topbar .actions {
        flex-shrink: 0;
        overflow: hidden;
    }
    
    /* Ensure composer stays fixed on very small screens */
    .ai-composer {
        padding: 10px 12px !important;
    }
    
    /* Adjust messages padding for smaller composer */
    .ai-messages {
        padding-bottom: 100px !important;
        max-height: calc(100vh - 100px) !important;
    }
    
    .is-empty .ai-messages {
        padding: 40px 12px 100px 12px !important;
        min-height: calc(100vh - 100px) !important;
    }
}

/* Very small screens (like iPhone SE) */
@media (max-width: 375px) {
    /* Make buttons even more compact */
    .ai-topbar .actions .btn {
        padding: 4px 6px;
        font-size: 0.75rem;
        border-radius: 5px;
    }
    
    /* Reduce gap even more */
    .ai-topbar .actions {
        gap: 3px;
    }
    
    /* Make profile button icon even smaller */
    .ai-topbar .actions .btn i {
        font-size: 0.8rem;
    }
    
    /* Adjust topbar padding */
    .ai-topbar {
        padding: 6px 10px !important;
        overflow-x: hidden !important;
    }
    
    /* Ensure composer stays fixed on very small screens */
    .ai-composer {
        padding: 8px 10px !important;
    }
    
    /* Adjust messages padding for even smaller composer */
    .ai-messages {
        padding-bottom: 90px !important;
        max-height: calc(100vh - 90px) !important;
    }
    
    .is-empty .ai-messages {
        padding: 30px 10px 90px 10px !important;
        min-height: calc(100vh - 90px) !important;
    }
}

/* Initial centered composer when there are no messages */
.is-empty .ai-messages { display: none; }
.is-empty .ai-empty-hero { display: none; }

/* Desktop: show composer prompt in center */
@media (min-width: 993px) {
    .is-empty .ai-empty-hero { display: none; }
    .is-empty .composer-prompt { display: block; }
    
    /* Desktop: centered composer when empty */
    .is-empty .ai-composer {
        border-top: none;
        display: grid;
        justify-items: center; /* keep horizontal centering */
        align-items: start; /* move to top */
        background: transparent;
        padding-top: 25vh;
        position: relative !important; /* Override mobile fixed positioning */
    }
    
    .is-empty .ai-composer .container { width: 100%; max-width: 900px; }
    .is-empty .composer-box { box-shadow: var(--shadow-lg); }
    
    /* Desktop: normal composer positioning */
    .ai-composer:not(.is-empty) {
        position: relative !important; /* Override mobile fixed positioning */
    }
}

/* Animations */
@keyframes slideToBottom {
    from { transform: translateY(-30px); opacity: 0.0; }
    to { transform: translateY(0); opacity: 1; }
}

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

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

@keyframes slideInUpEnhanced {
    0% { 
        opacity: 0; 
        transform: translateY(15px) scale(0.95); 
    }
    50% {
        opacity: 0.7;
        transform: translateY(5px) scale(0.98);
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

@keyframes fadeInScale {
    0% { 
        opacity: 0; 
        transform: scale(0.8); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1); 
    }
}

.animate-slide {
    animation: slideToBottom 0.35s ease-out;
}

.bubble.appear {
    animation: messageAppear 0.3s ease-out both;
}

.ai-empty-hero.hidden { display: none; }

/* AI Disclaimer */
.ai-disclaimer {
    text-align: center;
    font-size: 0.80rem;
    color: var(--text-light);
    margin-top: 10px;
    padding: 6px 12px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.ai-disclaimer.hidden {
    display: none;
}

.ai-disclaimer.animate-slide {
    animation: slideToBottom 0.35s ease-out;
}


