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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 80vh;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Prevent horizontal overflow on initial load */
html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Bottom Dock Variables */
:root {
    --bottom-dock-height: 80px; /* collapsed dock height (header + input only) */
    --bottom-dock-height-expanded: 220px; /* expanded dock height (suggestions + input) */
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    
    /* Light Mode Colors */
    --bg-gradient-start: #6a84f5;
    --bg-gradient-end: #7846ad;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-primary: white;
    --bg-secondary: #f8f9fa;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --chat-bg: white;
    --message-user-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --message-ai-bg: #f0f0f0;
    --input-bg: white;
    --input-border: #ddd;
}

/* Dark Mode Colors */
body.dark-mode {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --bg-primary: #1e1e1e;
    --bg-secondary: #2a2a2a;
    --border-color: #3a3a3a;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --chat-bg: #252525;
    --message-user-bg: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    --message-ai-bg: #2a2a2a;
    --input-bg: #2a2a2a;
    --input-border: #3a3a3a;
}

.main-content {
    flex: 1;
    padding: 1rem;
    max-width: 950px;
    min-width: 320px; /* Prevent shrinking below minimum usable width */
    margin: 0 auto;
    width: 100%; /* Ensure it takes full available width */
}

/* Upload Button in Chat Input */
.upload-btn {
    background: linear-gradient(135deg, #ffa264, #ff8900);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    margin-right: 0.5rem;
}

.upload-btn:hover {
    background: linear-gradient(135deg, #e55a2b, #e0831a);
    transform: scale(1.05);
}

/* Upload Panel Overlay */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.upload-overlay.active {
    display: flex;
}

.upload-panel {
    background: var(--bg-primary);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    transition: background 0.3s ease;
}

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

.upload-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 2rem;
    background: linear-gradient(135deg, #ff6b35, #f19f3f);
    color: white;
    border-radius: 16px 16px 0 0;
}

.upload-panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Chat Container */
.chat-container {
    background: var(--chat-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow-color);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 950px;
    min-width: 320px; /* Prevent shrinking below minimum usable width */
    margin: 0 auto;
    padding: 0;
    /* Make the chat layout fit within 90% of viewport height */
    height: 90vh;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Prevent horizontal scroll */
    overflow-y: visible; /* Allow toggle icon to overflow vertically */
    transition: background 0.3s ease, border 0.3s ease;
    position: relative; /* For bottom-dock positioning */
}

.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Prevent horizontal scroll */
    overflow-y: visible; /* Allow toggle icon to overflow */
    min-height: 0; /* Important for flex children */
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flex scrolling */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: transparent;
    padding: 0px 0;
    text-align: center;
    margin-bottom: 0px;
    position: sticky;
    top: 0;
    z-index: 999;
    transition: transform 0.3s ease;
    will-change: transform;
}

.header-content {
    background: transparent;
    padding: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo-title {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.logo-subtitle {
    color: white;
    font-size: 1.2rem;
    font-weight: 400;
    margin: 5px 0 0 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

.logo-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* About Toggle (info icon) */
.about-toggle {
    position: absolute;
    right: 9rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.about-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.about-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

body.dark-mode .about-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .about-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Settings Toggle */
.settings-toggle {
    position: absolute;
    right: 5rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.settings-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.settings-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

body.dark-mode .settings-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .settings-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.dark-mode-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

body.dark-mode .dark-mode-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.settings-modal.active {
    display: flex;
}

.settings-content {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    transition: background 0.3s ease;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 2rem;
    background: linear-gradient(135deg, #ffa264, #ff8900);
    color: white;
    border-radius: 16px 16px 0 0;
}

.settings-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-body {
    padding: 1.5rem 2rem;
}

/* About Section Styles */
.about-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.about-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.about-section h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.about-section p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.about-section ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.about-section ul li {
    color: var(--text-primary);
    line-height: 1.8;
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.5rem;
}

.about-section ul li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.about-section a {
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.about-section a:hover {
    opacity: 0.8;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-label {
    font-size: 1rem;
}

.setting-value {
    background: linear-gradient(135deg, #ffa264, #ff8900);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

.setting-item input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: var(--input-border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 0.5rem;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffa264, #ff8900);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 137, 0, 0.4);
    transition: all 0.3s ease;
}

.setting-item input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 12px rgba(255, 137, 0, 0.6);
}

.setting-item input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffa264, #ff8900);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(255, 137, 0, 0.4);
    transition: all 0.3s ease;
}

.setting-item input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 12px rgba(255, 137, 0, 0.6);
}

.setting-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.default-indicator {
    color: var(--text-primary);
    font-weight: 600;
    font-style: normal;
    opacity: 0.7;
}

.settings-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--input-border);
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.reset-btn {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.clear-chat-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-left: 0.5rem;
}

.reset-btn:hover {
    background: linear-gradient(135deg, #ffa264, #ff8900);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 137, 0, 0.3);
}

.clear-chat-btn:hover {
    background: linear-gradient(135deg, #ee5a52, #e53935);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(238, 90, 82, 0.3);
}

.reset-btn:active,
.clear-chat-btn:active {
    transform: translateY(0);
}

/* Responsive logo for mobile devices */
@media (max-width: 768px) {
    .logo {
        gap: 25px;
    }
    
    .logo-title {
        font-size: 2rem;
    }
    
    .logo-subtitle {
        font-size: 1rem;
    }
    
    .logo-img {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .logo {
        gap: 10px;
        flex-direction: column;
        text-align: center;
    }
    
    .logo-text {
        align-items: center;
    }
    
    .logo-title {
        font-size: 1.8rem;
    }
    
    .logo-subtitle {
        display: none; /* Hide subtitle on mobile to save space */
    }
    
    .logo-img {
        width: 50px;
        height: 50px;
    }
    
    /* Adjust header buttons for mobile - move to top to prevent blocking title */
    .about-toggle {
        right: 7.5rem;
        top: 0.75rem;
        transform: none;
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    
    .about-toggle:hover {
        transform: scale(1.1);
    }
    
    .about-toggle:active {
        transform: scale(0.95);
    }
    
    .settings-toggle {
        right: 4rem;
        top: 0.75rem;
        transform: none;
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    
    .settings-toggle:hover {
        transform: scale(1.1);
    }
    
    .settings-toggle:active {
        transform: scale(0.95);
    }
    
    .dark-mode-toggle {
        right: 0.5rem;
        top: 0.75rem;
        transform: none;
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    
    .dark-mode-toggle:hover {
        transform: scale(1.1);
    }
    
    .dark-mode-toggle:active {
        transform: scale(0.95);
    }
    
    /* Settings modal buttons stack on mobile */
    .settings-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .reset-btn {
        width: 100%;
        justify-content: center;
    }
    
    .clear-chat-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Maximize mobile space - minimal margins */
    .container {
        padding: 5px;
        margin: 0;
    }
    
    .main-content {
        padding: 0.5rem;
    }
    
    .chat-container {
        margin: 0;
        padding: 0; /* Remove horizontal padding - bottom-dock will handle its own padding */
    }
    
    .chat-section {
        margin: 0;
        padding: 0;
    }
    
    .chat-window {
        margin: 0;
        border-radius: 8px;
        padding-left: 10px;
        padding-right: 10px;
        /* Increase bottom padding for very small screens */
        padding-bottom: calc(2.5rem + var(--bottom-dock-height) + var(--safe-area-inset-bottom));
    }
    
    .chat-input-section {
        margin: 5px 0 0 0;
        padding: 0;
    }
    
    .input-container {
        margin: 0;
        gap: 5px;
    }
    
    .suggestions-section {
        margin: 5px 0;
        padding: 0;
    }
    
    .suggestions-content {
        padding: 0 5px;
    }
    
    /* Mobile upload panel optimization - Reduced size */
    .upload-panel {
        margin: 10px;
        width: calc(100vw - 20px);
        max-width: none;
        max-height: 75vh; /* Reduced from 80vh */
        border-radius: 12px;
        font-size: 0.9rem; /* Slightly smaller text */
    }
    
    .upload-panel-header {
        padding: 12px 15px; /* Reduced padding */
    }
    
    .upload-panel-header h3 {
        font-size: 1rem; /* Smaller header */
    }
    
    .upload-section {
        padding: 8px 12px 12px 12px; /* Reduced padding */
    }
    
    .upload-tabs {
        gap: 5px;
    }
    
    .upload-tab {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    /* Mobile settings modal optimization - Reduced size */
    .settings-content {
        width: 95%;
        max-width: none;
        max-height: 80vh; /* Limit height on mobile */
        margin: 10px;
        font-size: 0.9rem; /* Slightly smaller text */
        overflow-y: auto; /* Allow scrolling if content is too tall */
    }
    
    .settings-header {
        padding: 12px 15px; /* Reduced padding */
    }
    
    .settings-header h3 {
        font-size: 1rem; /* Smaller header */
    }
    
    .settings-body {
        padding: 15px; /* Reduced from default */
    }
    
    .settings-group {
        margin-bottom: 15px; /* Reduced spacing */
    }
    
    .settings-group label {
        font-size: 0.85rem; /* Smaller labels */
        margin-bottom: 6px;
    }
    
    .slider-container {
        margin: 8px 0; /* Reduced margins */
    }
    
    .settings-footer {
        padding: 12px 15px; /* Reduced padding */
        gap: 8px; /* Reduced gap between buttons */
    }
    
    .reset-btn {
        padding: 8px 12px; /* Smaller buttons */
        font-size: 0.85rem;
    }
    
    /* Improve touch targets on mobile */
    .upload-btn, .send-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .suggestion-btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    /* Ensure bottom dock doesn't get too tall on small screens */
    :root {
        --bottom-dock-height: 80px; /* collapsed by default */
        --bottom-dock-height-expanded: 200px;
    }
    
    /* Better keyboard handling for very small screens */
    body.keyboard-visible .chat-window {
        /* Use actual dock height when available, fallback to CSS variable */
        padding-bottom: calc(0.5rem + var(--actual-bottom-dock-height, var(--bottom-dock-height)));
    }
    
}

/* Upload Success Styles */
.upload-success {
    margin-top: 10px;
    padding: 10px;
    background: linear-gradient(135deg, #ffd446, #ec5a2c);
    border-radius: 12px;
    text-align: center;
    color: white;
    animation: slideInUp 0.3s ease;
}

.success-message {
    margin-bottom: 15px;
}

.success-message i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.success-message h4 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.success-message p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.continue-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.continue-btn:hover {
    background: white;
    color: #4CAF50;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.continue-btn i {
    font-size: 1.1rem;
}

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

/* Mobile-specific upload success styles */
@media (max-width: 480px) {
    .upload-success {
        margin-top: 15px;
        padding: 15px;
    }
    
    .continue-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

.badge {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

/* Upload Info Styles */
.upload-info {
    margin-top: 15px;
    padding: 12px 16px;
    background: rgba(102, 126, 234, 0.1);
    border-left: 4px solid #667eea;
    border-radius: 8px;
    transition: background 0.3s ease;
}

body.dark-mode .upload-info {
    background: rgba(102, 126, 234, 0.2);
    border-left-color: #8b9dc3;
}

.upload-info p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.upload-info strong {
    color: #667eea;
    font-weight: 600;
}

body.dark-mode .upload-info strong {
    color: #8b9dc3;
}

/* Upload Section Styles */
.upload-section {
    padding: 2rem;
    overflow-y: auto;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(102, 126, 234, 0.05);
}

body.dark-mode .upload-area {
    border-color: #8b9dc3;
    background: rgba(102, 126, 234, 0.15);
}

.upload-area:hover {
    border-color: #764ba2;
    background: rgba(118, 75, 162, 0.1);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.browse-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    width: 100%;
    justify-content: center;
}

.browse-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.image-preview {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
}

.image-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(102, 126, 234, 0.1);
    padding: 10px 15px;
    border-radius: 6px;
}

body.dark-mode .image-info {
    background: rgba(102, 126, 234, 0.2);
}

.remove-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.remove-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
}

.prompt-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.prompt-label {
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.prompt-label i {
    color: #667eea;
}

/* Chat Interface Styles */
.chat-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    min-height: 0; /* Allows flex items to shrink below content size */
    min-width: 0; /* Allows flex items to shrink below content size */
    overflow: hidden; /* contain internal scrolling to chat-window */
}

.chat-header {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid var(--border-color);
    transition: border 0.3s ease;
}

body.dark-mode .chat-header {
    background: rgba(0, 0, 0, 0.2);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
}

.chat-title i {
    color: #4CAF50;
}

.chat-status {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.chat-window {
    flex: 1;
    overflow-y: auto; /* only this element should scroll */
    padding: 1.5rem;
    /* Prevent last messages from being hidden behind the bottom dock */
    /* This will be dynamically updated by JavaScript for zoom level compatibility */
    padding-bottom: calc(1.5rem + var(--bottom-dock-height) + var(--safe-area-inset-bottom));
    min-height: 400px; /* Minimum height to prevent shrinking when empty */
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
    border-radius: 0;
    margin: 0;
    order: 1; /* Ensure chat window comes first */
    /* Ensure proper scrolling behavior on mobile */
    -webkit-overflow-scrolling: touch;
    /* Smooth transitions when padding changes */
    transition: padding-bottom 0.2s ease, background 0.3s ease;
}

/* Ensure media never overflows the container width */
.chat-window img,
.message-image,
.ai-thumbnail-container img,
.input-image-thumbnail img {
    max-width: 100%;
    height: auto;
}

/* Make suggestions grid safe on narrow screens */
.suggestions-grid {
    max-width: 100%;
    overflow-x: auto;
}

/* Bottom Dock (inside chat-container) */
.bottom-dock {
    position: relative;
    width: 100%;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -8px 24px var(--shadow-color);
    z-index: 100;
    /* Add safe area support for iOS devices */
    padding-bottom: var(--safe-area-inset-bottom);
    /* Ensure dock is always visible */
    min-height: fit-content;
    transition: background 0.3s ease, border 0.3s ease;
    flex-shrink: 0; /* Don't shrink when chat grows */
    /* CRITICAL: Allow overflow for toggle icon */
    overflow: visible !important;
}

.bottom-dock-inner {
    width: 100%;
    padding: 8px 10px; /* a bit more side padding for safe touch targets */
    box-sizing: border-box; /* Ensure padding is included in width calculation */
    overflow: visible; /* Allow toggle icon to overflow */
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    :root {
        --bottom-dock-height: 80px; /* collapsed by default on mobile */
        --bottom-dock-height-expanded: 240px; /* increased to account for mobile keyboards */
    }
    
    /* Hide desktop-only content on mobile */
    .desktop-only {
        display: none !important;
    }
    
    .bottom-dock-inner {
        padding: 10px 12px;
        /* Add extra padding for touch targets */
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    }
    
    .chat-window {
        /* Improve scroll performance on mobile */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        /* Ensure minimum height on mobile */
        min-height: 300px;
    }
    
    /* Ensure chat container height works with mobile viewports */
    .chat-container {
        /* Use viewport height that excludes browser UI */
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for modern browsers */
        min-height: 100vh;
        min-height: 100dvh;
    }
}

/* Remove extra margins that might push content under the dock */
.suggestions-section {
    margin-bottom: 8px;
}

/* Ensure bottom dock always stays on top and visible */
.bottom-dock {
    /* Higher z-index to ensure it's always visible */
    z-index: 1001 !important;
    /* Prevent any content from overlapping */
    isolation: isolate;
}

/* Add a subtle visual separator to help identify dock boundaries */
.bottom-dock::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
    pointer-events: none;
}

/* Ensure chat messages have proper spacing from bottom */
.chat-window .chat-message:last-child {
    margin-bottom: 1rem;
}

/* Debug helper - uncomment to visualize padding area */
/*
.chat-window::after {
    content: 'Padding Area';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--actual-bottom-dock-height, var(--bottom-dock-height));
    background: rgba(255, 0, 0, 0.1);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: red;
    z-index: 999;
}
*/

.chat-welcome {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.ai-message, .user-message, .system-message {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    max-width: 80%;
}

.ai-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
    margin-left: auto;
}

.system-message {
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    max-width: 90%;
}

.system-message .message-avatar {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    font-size: 18px;
}

.system-message .message-text {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 12px;
    color: var(--text-primary);
    text-align: center;
    font-size: 0.95rem;
}

body.dark-mode .system-message .message-text {
    background: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.4);
}

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

.ai-message .message-avatar {
    background: linear-gradient(135deg, #90e193, #45a049);
}


.message-content {
    flex: 1;
}

.message-sender-name {
    font-size: 12px;
    font-weight: 600;
    color: #45a049;
    margin-bottom: 4px;
    padding-left: 4px;
    transition: color 0.3s ease;
}

body.dark-mode .message-sender-name {
    color: #90e193;
}

.message-text {
    background: var(--bg-primary);
    padding: 12px 16px;
    border-radius: 18px;
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 14px;
    font-weight: 500;
    text-shadow: none;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: background 0.3s ease, color 0.3s ease;
}

.ai-message .message-text {
    background: var(--message-ai-bg);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 6px;
    color: var(--text-primary);
}

.user-message .message-text {
    background: var(--message-user-bg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom-right-radius: 6px;
    color: white;
}

.message-time {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
    margin-top: 4px;
    padding: 0 16px;
    font-weight: 400;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    max-width: 80%;
}

.typing-indicator .message-avatar {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

.typing-dots {
    background: rgba(76, 175, 80, 0.2);
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.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);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 0 0 12px 12px;
    order: 3; /* Ensure it comes after suggestions */
    flex-shrink: 0; /* Don't shrink this section */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s ease, border 0.3s ease;
}

body.dark-mode .chat-input-container {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
}

/* Clear chat button is now an icon button next to send button */

.chat-input-wrapper {
    display: flex;
    gap: 0;
    align-items: center;
}

#chatInput {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
    width: 100%;
    resize: none; /* Disable manual resize */
    overflow-y: hidden; /* Hide scrollbar */
    min-height: 44px; /* Minimum height */
    max-height: 200px; /* Maximum height before scrolling */
    line-height: 1.5;
    font-family: inherit;
}

#chatInput:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

#chatInput::placeholder {
    color: var(--text-secondary);
}

/* Mobile: Allow placeholder text to wrap and display fully */
@media (max-width: 768px) {
    #chatInput {
        min-height: 60px; /* Increased from 44px to show full placeholder */
        padding: 10px 16px; /* Adjusted padding for better text display */
        line-height: 1.4; /* Slightly tighter line height */
    }
    
    #chatInput::placeholder {
        font-size: 0.85rem;
        white-space: normal; /* Allow wrapping instead of truncating */
        overflow: visible;
        text-overflow: clip;
        line-height: 1.4;
    }
}

#chatInput:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Removed input-field-wrapper and attachment-btn styles - using main upload button instead */

/* Old thumbnail styles removed - now using inline chat thumbnails */

/* Keyboard key styling */
kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    color: #ffa319;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Chat window drag and drop styles */
.chat-window.chat-dragover {
    position: relative;
    background: rgba(76, 175, 80, 0.1);
    border: 2px dashed rgba(76, 175, 80, 0.5);
    border-radius: 12px;
}

.chat-window.chat-dragover::before {
    content: '📎 Drop for single image editing';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(76, 175, 80, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.chat-window.chat-dragover.try-on-mode::before {
    content: '👗 Drop for virtual try-on';
    background: rgba(255, 152, 0, 0.9);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.chat-window.chat-dragover.try-on-mode {
    background: rgba(255, 152, 0, 0.1);
    border: 2px dashed rgba(255, 152, 0, 0.5);
}

.send-btn {
    background: linear-gradient(135deg, #63db68, #45a049);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-left: 0.5rem;
}

.send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049, #388e3c);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Chat History Styles */
.chat-history {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-history h4 {
    margin: 0 0 15px 0;
    color: #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 3px solid #4CAF50;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-number {
    font-weight: 600;
    color: #4CAF50;
    font-size: 14px;
}

.history-timestamp {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.history-prompt {
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.revert-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.revert-btn:hover {
    background: linear-gradient(135deg, #ee5a24, #d63031);
    transform: translateY(-1px);
}

.continue-editing-btn {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
}

.continue-editing-btn:hover {
    background: linear-gradient(135deg, #00a085, #00906f);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.3);
}

#promptInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

#promptInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.prompt-suggestions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suggestion-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-btn {
    background: rgba(217, 174, 95, 0.09);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: var(--text-secondary);
    padding: 8px 11px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

body.dark-mode .suggestion-btn {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.4);
}

.suggestion-btn:hover {
    background: rgba(252, 156, 12, 0.372);
    transform: translateY(-1px);
}

body.dark-mode .suggestion-btn:hover {
    background: rgba(102, 126, 234, 0.3);
}

.generate-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(78, 205, 196, 0.3);
}

.generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.result-section {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.5s ease;
}

.upload-section {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 1.2rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.upload-tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    transition: border 0.3s ease;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #ff6b35;
    border-bottom-color: #ff6b35;
}

.tab-btn:hover {
    color: #ff6b35;
}

.upload-mode {
    display: none;
}

.upload-mode.active {
    display: block;
}

.multi-upload-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    max-width: 100%;
}

/* Responsive: Stack on smaller screens */
@media (max-width: 900px) {
    .multi-upload-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.upload-slot {
    text-align: center;
    flex: 1;
    max-width: 300px;
    position: relative;
}

.use-current-image-btn {
    margin-top: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.use-current-image-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.use-current-image-btn:active {
    transform: translateY(0);
}

.use-current-image-btn i {
    font-size: 1rem;
}

body.dark-mode .use-current-image-btn {
    background: linear-gradient(135deg, #8b9dc3 0%, #9370db 100%);
}

.upload-area.small {
    height: 240px;
    margin-bottom: 0.5rem;
}

.upload-area.small .upload-content h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.upload-area.small .upload-content p {
    font-size: 0.9rem;
}

.upload-label {
    font-weight: 600;
    color: #333;
    margin-top: 0.5rem;
}

.optional-badge {
    font-size: 0.75rem;
    font-weight: 400;
    color: #888;
    font-style: italic;
}

.image-preview.small {
    height: 240px;
    margin-bottom: 0.5rem;
}

.image-preview.small img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
}

.remove-btn.small {
    width: 25px;
    height: 25px;
    font-size: 0.8rem;
}

.try-on-suggestions {
    margin-top: 0rem;
    padding-top: 0rem;
}


/* Suggestions Section Styles */
.suggestions-section {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    transition: all 0.3s ease;
    order: 2; /* Ensure it comes after chat-window */
    flex-shrink: 0; /* Don't shrink this section */
    position: relative;
    overflow: visible; /* Allow toggle icon to extend outside */
}

.suggestions-toggle-icon {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffa726, #ff9800);
    border: 3px solid var(--bg-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 1002; /* Higher than bottom-dock and chat-container */
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.suggestions-toggle-icon:hover {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 152, 0, 0.4);
}

.suggestions-section.collapsed .suggestions-toggle-icon {
    display: flex;
}

.suggestions-section:not(.collapsed) .suggestions-toggle-icon {
    display: none;
}

.suggestions-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 5px 25px;
    background: var(--bg-secondary);
    border-bottom: 0px solid var(--border-color);
    transition: background 0.3s ease;
}

.suggestions-section.collapsed .suggestions-header {
    display: none;
}

.suggestions-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    transition: color 0.3s ease;
    text-align: center;
}

.suggestions-header .collapse-btn {
    position: absolute;
    right: 25px;
}

.suggestions-content {
    padding: 0.9rem;
    transition: all 0.3s ease;
    overflow: hidden;
}

.suggestions-section.collapsed .suggestions-content {
    max-height: 0;
    padding: 0 1.5rem;
    opacity: 0;
}


/* Chat Image Styles */
.message-image-container {
    margin-top: 1rem;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.message-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.message-image:hover {
    opacity: 0.9;
}

.image-actions {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-start;
}

.download-btn {
    background: #4CAF50;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.download-btn i {
    font-size: 0.8rem;
}

.result-container h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #333;
}

.result-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    align-items: start;
}

.result-image {
    text-align: center;
}

.result-image img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.download-btn, .share-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.share-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
}

.download-btn:hover, .share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.result-info {
    background: rgba(78, 205, 196, 0.1);
    padding: 20px;
    border-radius: 6px;
    border-left: 4px solid #4ecdc4;
}

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

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #333;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-history {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.chat-history h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-history h3 i {
    color: #007bff;
}

.history-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-number {
    background: #007bff;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.history-time {
    color: #6c757d;
    font-size: 0.85rem;
}

.history-revert-btn {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-revert-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

.history-prompt {
    color: #495057;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.4;
}

.continue-btn {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto;
}

.continue-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.footer {
    text-align: center;
    padding: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Social Sharing Styles - Minimalistic */
.social-sharing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 5px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.share-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
}

.sharing-buttons {
    display: flex;
    gap: 8px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    opacity: 0.8;
}

.share-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.share-btn i {
    font-size: 14px;
}

/* Platform-specific colors */
.share-btn.twitter {
    background: #1DA1F2;
    color: white;
}

.share-btn.facebook {
    background: #4267B2;
    color: white;
}

.share-btn.linkedin {
    background: #0077B5;
    color: white;
}

.share-btn.reddit {
    background: #FF4500;
    color: white;
}

.share-btn.copy-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.share-btn.copy-link.copied {
    background: #4CAF50;
}

/* Input Image Thumbnails in Chat */
.input-images {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* Ensure user message layout stays correct with thumbnails */
.user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-message .input-images {
    justify-content: flex-end;
}

.input-image-thumbnail {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    min-height: 60px;
}

.thumbnail-image {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: default;
    transition: transform 0.2s ease;
}

.thumbnail-image:hover {
    transform: scale(1.05);
}

/* AI thumbnail container styling */
.ai-thumbnail-container {
    margin-top: 10px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-message .input-image-thumbnail {
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.thumbnail-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-size: 0.7rem;
    padding: 4px 6px 2px;
    text-align: center;
    font-weight: 500;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .social-sharing {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .share-text {
        font-size: 0.8rem;
    }
    
    .sharing-buttons {
        gap: 6px;
    }
    
    .share-btn {
        width: 28px;
        height: 28px;
    }
    
    .share-btn i {
        font-size: 12px;
    }
    
    /* Mobile thumbnail adjustments */
    .thumbnail-image {
        max-width: 100px;
        max-height: 100px;
    }
    
    .thumbnail-label {
        font-size: 0.65rem;
        padding: 2px 4px 1px;
    }
}

.footer a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #ffd700;
    text-decoration: underline;
}

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

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Comparison Slider Modal */
.comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.comparison-modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 30px;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.comparison-header h3 {
    color: var(--text-primary);
    font-size: 24px;
    margin: 0;
    flex-shrink: 0;
}

.comparison-toggle-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.comparison-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.comparison-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.comparison-toggle-btn:active {
    transform: translateY(0);
}

.comparison-toggle-btn i {
    font-size: 14px;
}

body.dark-mode .comparison-toggle-btn {
    background: linear-gradient(135deg, #8b9dc3 0%, #9370db 100%);
}

.comparison-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
}

.comparison-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .comparison-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .comparison-header h3 {
        font-size: 20px;
        text-align: center;
    }
    
    .comparison-toggle-container {
        order: 2;
    }
    
    .comparison-toggle-btn {
        padding: 8px 16px;
        font-size: 13px;
        width: 100%;
    }
    
    .comparison-close {
        width: 44px;
        height: 44px;
        font-size: 18px;
        position: absolute;
        top: 10px;
        right: 10px;
    }
}

.comparison-container {
    position: relative;
    width: 800px;
    height: 600px;
    max-width: 80vw;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 12px;
    user-select: none;
}

.comparison-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.comparison-after {
    clip-path: inset(0 0 0 50%);
}

.comparison-before {
    clip-path: inset(0 50% 0 0);
}

.comparison-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.comparison-label {
    position: absolute;
    top: 40px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    z-index: 20;
    pointer-events: none;
    line-height: 1;
}

.comparison-label-before {
    left: 20px;
    top: 40px;
}

.comparison-label-after {
    right: 20px;
    top: 40px;
}

/* Mobile: Ensure labels stay visible */
@media (max-width: 768px) {
    .comparison-label {
        top: 20px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .comparison-label-before {
        left: 10px;
        top: 20px;
    }
    
    .comparison-label-after {
        right: 10px;
        top: 20px;
    }
}

.comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: white;
    cursor: ew-resize;
    transform: translateX(-50%);
    z-index: 10;
}

.comparison-slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    color: #333;
    font-size: 20px;
}

/* Keyboard Shortcuts Indicator */
.keyboard-shortcut-toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9000;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s;
    pointer-events: none;
}

.keyboard-shortcut-toast kbd {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    margin: 0 4px;
}

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

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Export Session Modal */
.export-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.export-modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.export-header h3 {
    color: var(--text-primary);
    font-size: 24px;
    margin: 0;
}

.export-body p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.export-option-btn {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.export-option-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.export-option-btn i {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 10px;
}

.export-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.export-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Settings Footer - Column Layout */
.settings-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.settings-footer button {
    width: 100%;
    margin: 0;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .result-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .suggestions {
        flex-direction: column;
    }
    
    .result-actions {
        flex-direction: column;
    }
}
