/* AI Chat Styles - AI chat interface, messages, conversations, streaming responses */

/* AI Chat Modal Styles */
.ai-chat-modal {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    max-width: 1000px;
    width: 95%;
    height: 85vh;
    max-height: 700px;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    margin: auto;
    box-shadow: var(--shadow-heavy);
    position: relative;
}

/* Improved Modal Overlay for Mobile */
@media (max-width: 768px) {
    .modal-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 9999 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
    }
}

/* ChatGPT-Style Hamburger Menu */
.hamburger-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    border-radius: 6px;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger-line {
    width: 20px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3); /* Make it more visible */
}

/* Hamburger animation to X when sidebar collapsed */
.sidebar-collapsed .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.sidebar-collapsed .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.sidebar-collapsed .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Sidebar Overlay for Mobile - Updated for ChatGPT Style */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    pointer-events: none;
}

/* Show overlay when sidebar is open */
.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ai-chat-sidebar {
    width: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* Desktop Sidebar Collapsed State - ChatGPT Style */
.sidebar-collapsed .ai-chat-sidebar {
    transform: translateX(-100%);
    width: 300px; /* Keep width for smooth animation */
    opacity: 0;
    pointer-events: none;
}

/* Desktop Main Chat Area Expansion */
.sidebar-collapsed .ai-chat-main {
    width: 100%;
    flex: 1;
}

/* Desktop Sidebar Visible State */
.ai-chat-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.ai-chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ChatGPT-Style Sidebar Sections */
.sidebar-section {
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-section-title {
    padding: 12px 16px 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.child-pills-sidebar {
    padding: 0 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.child-pill-sidebar {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.child-pill-sidebar:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
}

.child-pill-sidebar.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.ai-chat-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

/* ChatGPT-Style Chat Start Prompt */
.chat-start-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    padding: 40px 20px;
}

.chat-prompt-content {
    text-align: center;
    max-width: 400px;
}

.chat-prompt-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.chat-prompt-content p {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
    font-size: 16px;
}

.chat-prompt-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.prompt-action-btn {
    padding: 12px 24px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
}

.prompt-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.ai-chat-sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ai-chat-sidebar-actions {
    display: flex;
    gap: 8px;
}

.ai-new-chat-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    box-shadow: var(--shadow-light);
}

.ai-new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-chat-sidebar-header .ai-fullscreen-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 0.7;
    box-shadow: var(--shadow-light);
}

.ai-chat-sidebar-header .ai-fullscreen-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-chat-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.ai-chat-folder {
    margin-bottom: 8px;
}

.ai-chat-folder-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid var(--glass-border);
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-folder-toggle {
    font-size: 10px;
    transition: transform 0.2s;
}

.ai-chat-folder.collapsed .ai-chat-folder-toggle {
    transform: rotate(-90deg);
}

.ai-chat-folder-content {
    max-height: 200px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.ai-chat-folder.collapsed .ai-chat-folder-content {
    max-height: 0;
    overflow: hidden;
}

.ai-chat-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
}

.ai-chat-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ai-chat-item.active {
    background: var(--primary-color);
    color: white;
}

.ai-chat-item-info {
    flex: 1;
    overflow: hidden;
}

.ai-chat-item-title {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.ai-chat-item-preview {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-chat-item.active .ai-chat-item-preview {
    color: rgba(255, 255, 255, 0.8);
}

.ai-chat-item-date {
    font-size: 10px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.ai-chat-item.active .ai-chat-item-date {
    color: rgba(255, 255, 255, 0.8);
}

.ai-chat-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.ai-chat-item:hover .ai-chat-item-actions {
    opacity: 1;
}

.ai-chat-item-delete {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chat-item-delete:hover {
    background: rgba(248, 113, 113, 0.8);
    transform: translateY(-1px);
}

.ai-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gradient-primary);
    color: white;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-icon {
    font-size: 24px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

.ai-chat-info h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.ai-chat-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

.ai-child-selection {
    padding: 30px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-child-selection-content {
    text-align: center;
}

.ai-child-selection-content h4 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

.ai-child-pills {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.ai-child-pill {
    padding: 12px 20px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
    box-shadow: var(--shadow-light);
}

.ai-child-pill:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.ai-chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Important for flexbox scrolling */
}

.ai-chat-context {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ai-context-info {
    display: flex;
    gap: 16px;
    align-items: center;
}

.ai-context-child {
    font-weight: 600;
    color: var(--text-primary);
}

.ai-context-data {
    font-size: 14px;
    color: var(--text-secondary);
}

.ai-context-switch {
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-light);
}

.ai-context-switch:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 300px; /* Minimum height for readability */
}

.ai-welcome-message, .ai-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.ai-message-avatar.ai {
    background: var(--gradient-primary);
    color: white;
}

.ai-message-avatar.user {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.ai-message-content {
    flex: 1;
    max-width: calc(100% - 48px);
}

.ai-message-text {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: 16px;
    color: var(--text-primary);
    line-height: 1.5;
    border: 1px solid var(--glass-border);
    word-wrap: break-word;
}

.ai-message-text p {
    margin: 0 0 12px 0;
}

.ai-message-text p:last-child {
    margin-bottom: 0;
}

.ai-message-text ul,
.ai-message-text ol {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-message-text li {
    margin: 6px 0;
    line-height: 1.4;
}

.ai-message-text h3,
.ai-message-text h4 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-message-text h3 {
    font-size: 1.1em;
}

.ai-message-text h4 {
    font-size: 1em;
}

.ai-message-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.ai-message.user .ai-message-text {
    background: var(--gradient-primary);
    color: white;
    border: 1px solid var(--primary-color);
}

.ai-message.ai .ai-message-text {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

/* NEW: Streaming message styles */
.ai-message.streaming {
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    padding: 4px 8px;
    margin: 2px 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.streaming-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    min-height: 24px;
}

.streaming-cursor {
    animation: blink 1s infinite;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2em;
}

.ai-message.error {
    background: rgba(248, 113, 113, 0.2);
    border-left: 3px solid var(--error-color);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.streaming-error {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--error-color);
    font-weight: 500;
}

.error-icon {
    font-size: 1.2em;
}

.error-text {
    font-size: 14px;
}

.ai-chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0; /* Prevent shrinking */
    background: rgba(255, 255, 255, 0.05);
}

.ai-chat-footer {
    display: flex;
    justify-content: center;
    padding: 12px 0 8px 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 12px;
}

.ai-fullscreen-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.8;
    box-shadow: var(--shadow-light);
}

.ai-fullscreen-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.ai-fullscreen-icon {
    font-size: 14px;
}

.ai-chat-input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    color: #333333; /* Dark text for visibility */
}

.ai-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-chat-input:disabled {
    background: rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
    opacity: 0.5;
}

.ai-chat-input::placeholder {
    color: #666666; /* Dark placeholder for visibility */
}

.ai-chat-send {
    padding: 12px 16px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    min-width: 48px;
    box-shadow: var(--shadow-light);
}

.ai-chat-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.ai-chat-send:disabled {
    background: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

.ai-chat-suggestions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ai-suggestion-pill {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.ai-suggestion-pill:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

.ai-typing-dots {
    display: flex;
    gap: 4px;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: aiTypingPulse 1.4s infinite ease-in-out;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* Mobile responsiveness for AI chat */
@media (max-height: 700px) {
    .ai-chat-modal {
        height: 95vh;
        max-height: none;
    }
    
    .ai-chat-messages {
        min-height: 250px;
    }
    
    .ai-child-selection {
        padding: 20px 30px;
    }
}

/* CHATGPT-STYLE MOBILE SIDEBAR REDESIGN */
@media (max-width: 768px) {
    .ai-chat-modal {
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        margin: 0;
        border-radius: 0;
        flex-direction: row; /* Keep row layout for true sidebar */
        max-width: none;
        max-height: none;
        position: fixed; /* Fixed positioning to prevent viewport issues */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    /* Mobile Sidebar - TRUE ChatGPT Style */
    .ai-chat-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px; /* Fixed width like ChatGPT */
        height: 100vh;
        background: rgba(0, 0, 0, 0.9); /* Dark sidebar like ChatGPT */
        backdrop-filter: blur(10px);
        border-right: 1px solid var(--glass-border);
        transform: translateX(-100%); /* Hidden by default */
        transition: transform 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    
    /* Mobile Sidebar Open State */
    .sidebar-open .ai-chat-sidebar {
        transform: translateX(0); /* Slide in from left */
    }
    
    /* Mobile Overlay Backdrop */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
    }
    
    .sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mobile - Main Chat Area (Always Full Width) */
    .ai-chat-main {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        flex: 1;
        position: relative;
        overflow: hidden;
    }
    
    .ai-chat-messages {
        flex: 1;
        padding: 16px;
        min-height: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
        position: relative; /* Keep relative positioning within the flex container */
        box-sizing: border-box;
    }
    
    .ai-chat-input-area {
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom, 8px));
        background: rgba(255, 255, 255, 0.75);
        backdrop-filter: blur(10px);
        border-top: 2px solid rgba(0, 0, 0, 0.1);
        position: relative; /* Keep within the modal's flex container */
        flex-shrink: 0;
        min-height: 70px;
        box-sizing: border-box;
    }
    
    /* Mobile Sidebar Sections */
    .sidebar-section {
        border-bottom: 1px solid var(--glass-border);
    }
    
    .child-pills-sidebar {
        padding: 8px 12px 12px 12px;
    }
    
    .child-pill-sidebar {
        padding: 10px 12px;
        font-size: 13px;
        border-radius: 6px;
        min-height: 40px;
        display: flex;
        align-items: center;
    }
    
    .ai-chat-input {
        font-size: 16px !important; /* Prevent iOS zoom */
        padding: 14px 18px;
        border-radius: 12px;
        min-height: 48px; /* Touch target compliance */
        background: rgba(255, 255, 255, 0.98) !important;
        color: #333333 !important; /* Dark text for visibility */
        border: 2px solid rgba(0, 0, 0, 0.15) !important;
    }
    
    .ai-send-btn {
        min-width: 48px;
        min-height: 48px;
        padding: 12px;
        border-radius: 12px;
    }
    
    .ai-chat-header {
        padding: 12px 16px;
        padding-top: max(12px, env(safe-area-inset-top, 0px));
        background: var(--gradient-primary); /* Restore gradient background */
        color: white;
        border-bottom: 1px solid var(--glass-border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        min-height: 60px; /* Ensure minimum header height */
        box-sizing: border-box;
        position: relative; /* Keep within modal bounds */
    }
    
    /* Make hamburger more visible on mobile */
    .hamburger-menu {
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
    
    .hamburger-line {
        background: white !important; /* White lines on gradient background */
        height: 3px;
        width: 20px;
    }
    
    .ai-chat-close {
        min-width: 44px;
        min-height: 44px;
        border-radius: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .ai-child-selection {
        padding: 16px 20px;
    }
    
    .ai-child-selection-content h4 {
        font-size: 16px;
        margin-bottom: 16px;
        font-weight: 600;
    }
    
    .ai-child-pill {
        padding: 12px 18px;
        font-size: 15px;
        min-width: 80px;
        min-height: 44px; /* Touch target compliance */
        border-radius: 12px;
    }
    
    /* Message styling improvements */
    .ai-message {
        margin-bottom: 20px;
    }
    
    .ai-message-content {
        padding: 16px 20px;
        font-size: 16px;
        line-height: 1.5;
        border-radius: 16px;
    }
    
    /* Fix suggestion pill readability on mobile */
    .ai-suggestion-pill {
        background: rgba(255, 255, 255, 0.9) !important;
        color: #333333 !important; /* Dark text for visibility */
        border: 2px solid rgba(102, 126, 234, 0.3) !important;
        font-weight: 500;
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
    }
    
    .ai-suggestion-pill:hover {
        background: var(--primary-color) !important;
        color: white !important;
        border-color: var(--primary-color) !important;
    }
}

/* Enhanced mobile support for tablets and large phones */
@media (max-width: 576px) {
    .ai-chat-modal {
        width: 98%;
        height: 95vh;
        margin: 2.5vh auto;
        border-radius: 12px;
    }
    
    .ai-chat-header {
        padding: 16px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .ai-chat-title {
        font-size: 1.2rem;
    }
    
    .ai-chat-subtitle {
        font-size: 0.85rem;
    }
    
    .ai-chat-messages {
        padding: 16px;
        min-height: 300px;
    }
    
    .ai-message {
        margin-bottom: 16px;
    }
    
    .ai-message-content {
        padding: 12px 16px;
        font-size: 15px;
        line-height: 1.5;
    }
    
    .ai-chat-input-area {
        padding: 16px;
        gap: 12px;
    }
    
    .ai-chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
    }
    
    .ai-send-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
    }
    
    .ai-child-selection {
        padding: 16px;
    }
    
    .ai-child-pill {
        min-width: 80px;
        padding: 12px 16px;
    }
}

/* Small phone optimizations */
@media (max-width: 480px) {
    .ai-chat-modal {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .ai-chat-header {
        padding: 12px 16px;
    }
    
    .ai-chat-title {
        font-size: 1.1rem;
    }
    
    .ai-chat-messages {
        padding: 12px;
        min-height: 250px;
    }
    
    .ai-message-content {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .ai-chat-input-area {
        padding: 12px;
    }
    
    .ai-chat-input {
        font-size: 16px;
        padding: 10px 14px;
    }
    
    .ai-send-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 16px;
    }
    
    .ai-child-selection {
        padding: 12px;
    }
    
    .ai-child-pill {
        min-width: 70px;
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .ai-chat-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}