/* ============================================
   SMART AI CHAT APP - COMPLETE CSS
   Part 1/3: Base Styles + Splash Screen
   ============================================ */

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

:root {
    --bg-dark: #0a0a0a;
    --bg-dark-secondary: #1a1a1a;
    --bg-dark-tertiary: #2a2a2a;
    --text-white: #ffffff;
    --text-gray: #a0a0a0;
    --text-gray-dark: #6a6a6a;
    --accent-blue: #4A90E2;
    --accent-green: #10b981;
    --border-dark: #333333;
    --sidebar-width: 280px;
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-dark);
    color: var(--text-white);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   SPLASH SCREEN STYLES
   ============================================ */

#splashScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow: hidden;
    padding: 20px;
}

#splashScreen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    top: 0;
    left: 0;
}

.splash-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: splashFloat 15s infinite;
}

@keyframes splashFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

.splash-container {
    text-align: center;
    z-index: 10;
    animation: splashFadeIn 1s ease-in;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

@keyframes splashFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.splash-logo-container {
    position: relative;
    margin-bottom: 40px;
    animation: splashPulse 2s ease-in-out infinite;
}

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

.splash-ai-icon {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.splash-ai-icon::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 45px;
    animation: splashRotate 3s linear infinite;
}

@keyframes splashRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.splash-ai-text {
    font-size: 80px;
    font-weight: 900;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.splash-app-name {
    font-size: 48px;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.splash-tagline {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 50px;
    letter-spacing: 1px;
}

.splash-loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin: 0 auto 60px;
    overflow: hidden;
}

.splash-loading-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ec4899, #8b5cf6, #ec4899);
    background-size: 200% 100%;
    border-radius: 10px;
    animation: splashLoading 2s ease-in-out infinite, splashShimmer 1.5s linear infinite;
}

@keyframes splashLoading {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

@keyframes splashShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.splash-footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.8;
    z-index: 100;
    width: 90%;
    max-width: 400px;
    padding: 10px;
}

.splash-developer {
    font-weight: 600;
    color: white;
    font-size: 15px;
    display: block;
    margin-bottom: 5px;
}

.splash-copyright {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    display: block;
}

.splash-spmods {
    font-weight: 700;
    color: white;
}

.splash-sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: splashSparkle 3s infinite;
}

@keyframes splashSparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

.splash-sparkle:nth-child(1) { top: 15%; left: 20%; animation-delay: 0s; }
.splash-sparkle:nth-child(2) { top: 25%; right: 15%; animation-delay: 0.5s; }
.splash-sparkle:nth-child(3) { bottom: 30%; left: 25%; animation-delay: 1s; }
.splash-sparkle:nth-child(4) { bottom: 20%; right: 20%; animation-delay: 1.5s; }

/* Mobile responsiveness for splash */
@media (max-width: 768px) {
    .splash-ai-icon {
        width: 140px;
        height: 140px;
    }
    
    .splash-ai-icon::before {
        width: 160px;
        height: 160px;
    }
    
    .splash-ai-text {
        font-size: 60px;
    }
    
    .splash-app-name {
        font-size: 36px;
    }
    
    .splash-tagline {
        font-size: 16px;
        margin-bottom: 40px;
    }
    
    .splash-loading-bar {
        margin-bottom: 40px;
    }
    
    .splash-footer {
        bottom: 10px;
        font-size: 12px;
        padding: 8px;
    }
    
    .splash-developer {
        font-size: 13px;
    }
    
    .splash-copyright {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .splash-container {
        padding: 10px;
    }
    
    .splash-logo-container {
        margin-bottom: 30px;
    }
    
    .splash-ai-icon {
        width: 120px;
        height: 120px;
    }
    
    .splash-app-name {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .splash-tagline {
        font-size: 14px;
        margin-bottom: 30px;
    }
    
    .splash-loading-bar {
        width: 150px;
        margin-bottom: 30px;
    }
    
    .splash-footer {
        bottom: 5px;
        font-size: 11px;
        line-height: 1.5;
    }
    
    .splash-developer {
        font-size: 12px;
    }
    
    .splash-copyright {
        font-size: 10px;
    }
}

@media (max-height: 600px) {
    .splash-ai-icon {
        width: 100px;
        height: 100px;
    }
    
    .splash-app-name {
        font-size: 28px;
        margin-bottom: 8px;
    }
    
    .splash-tagline {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .splash-loading-bar {
        margin-bottom: 20px;
    }
    
    .splash-footer {
        bottom: 5px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .splash-logo-container,
    .splash-loading-progress,
    .splash-particle,
    .splash-sparkle {
        animation: none !important;
    }
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

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

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: var(--text-white);
}

.spinner-icon {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(74, 144, 226, 0.3);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 14px;
    color: var(--text-gray);
}

/* ============================================
   TEXT ART STYLES
   ============================================ */

.text-art-message {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-left: 4px solid #667eea;
}

.text-art-container {
    width: 100%;
    margin: 10px 0;
}

.text-art-title {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    border: 2px solid #667eea;
    display: inline-block;
}

.text-art-display {
    background: #1a1a1a;
    color: #00ff00;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre;
    border: 3px solid #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    max-width: 100%;
    margin: 0;
}

.text-art-display::-webkit-scrollbar {
    height: 8px;
}

.text-art-display::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

.text-art-display::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.text-art-display::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.text-art-message .download-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.text-art-message .download-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .text-art-display {
        font-size: 10px;
        padding: 15px;
    }
    
    .text-art-title {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .splash-ai-icon {
        width: 140px;
        height: 140px;
    }
    
    .splash-ai-icon::before {
        width: 160px;
        height: 160px;
    }
    
    .splash-ai-text {
        font-size: 60px;
    }
    
    .splash-app-name {
        font-size: 36px;
    }
    
    .splash-tagline {
        font-size: 16px;
    }
}

/* ============================================
   SMART AI CHAT APP - COMPLETE CSS
   Part 2/3: Authentication & Chat Interface
   ============================================ */

/* AUTH STYLES - MOBILE OPTIMIZED */
#authContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 16px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.auth-box {
    background: var(--bg-dark-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-dark);
    width: 100%;
    max-width: 400px;
    padding: 24px;
    margin: 0 auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.auth-header h1 {
    color: var(--text-white);
    font-size: 24px;
    margin-bottom: 6px;
    font-weight: 600;
}

.auth-header p {
    color: var(--text-gray);
    font-size: 13px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-gray);
    font-weight: 500;
    font-size: 12px;
}

.form-group label i {
    margin-right: 6px;
    color: var(--accent-blue);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s;
    background: var(--bg-dark);
    color: var(--text-white);
    -webkit-appearance: none;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #3a7bc8;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.error-message, .success-message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    display: none;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.success-message {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.toggle-link {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-gray);
}

.toggle-link a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.toggle-link a:hover {
    text-decoration: underline;
}

/* CHAT APP - MOBILE OPTIMIZED */
#chatApp {
    display: none;
    height: 100vh;
    height: 100dvh;
}

.chat-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

/* SIDEBAR OVERLAY */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 98;
}

.sidebar-overlay.active {
    display: block;
}

/* SIDEBAR - MOBILE OPTIMIZED */
.chat-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-dark);
    border-right: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 99;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
}

.chat-sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.close-sidebar-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.close-sidebar-btn:hover {
    background: var(--bg-dark-secondary);
    color: var(--text-white);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-item {
    padding: 14px 16px;
    margin-bottom: 4px;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-height: 60px;
}

.history-item:hover {
    background: var(--bg-dark-secondary);
}

.history-item:hover .delete-chat-btn {
    display: flex;
}

.history-item.active {
    background: var(--bg-dark-tertiary);
}

.history-title {
    color: var(--text-white);
    font-size: 15px;
    font-weight: 400;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 40px;
}

.history-preview {
    color: var(--text-gray-dark);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-time {
    color: var(--text-gray-dark);
    font-size: 11px;
    margin-top: 4px;
}

.delete-chat-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--bg-dark-tertiary);
    border: none;
    border-radius: 8px;
    color: #ef4444;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.delete-chat-btn:hover {
    background: #ef4444;
    color: white;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-info:hover {
    background: var(--bg-dark-secondary);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    color: var(--text-white);
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-email {
    color: var(--text-gray);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-action-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sidebar-action-btn:hover {
    background: var(--bg-dark-secondary);
    color: var(--text-white);
}

/* MAIN CHAT - MOBILE OPTIMIZED */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    width: 100%;
}

.chat-header {
    height: 60px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-dark);
    background: var(--bg-dark);
    position: sticky;
    top: 0;
    z-index: 10;
}

.menu-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: var(--bg-dark-secondary);
    color: var(--text-white);
}

.header-title {
    flex: 1;
    font-size: 17px;
    font-weight: 400;
    color: var(--text-white);
}

.header-action-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--border-dark);
    border-radius: 50%;
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header-action-btn:hover {
    background: var(--bg-dark-secondary);
    color: var(--text-white);
}

.language-btn {
    font-size: 20px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 0;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 32px 16px;
}

.ai-logo {
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-screen h1 {
    font-size: 28px;
    font-weight: 400;
    color: var(--text-white);
    margin-bottom: 10px;
}

.welcome-screen p {
    font-size: 16px;
    color: var(--text-gray);
    line-height: 1.4;
}

/* ============================================
   SMART AI CHAT APP - COMPLETE CSS
   Part 3/3: Messages, Input & Responsive
   ============================================ */

.message {
    margin-bottom: 20px;
    max-width: 100%;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

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

.user-message .message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.ai-message .message-avatar {
    background: var(--bg-dark-tertiary);
    color: var(--accent-blue);
}

.message-content {
    padding: 14px 16px;
    border-radius: 20px;
    line-height: 1.5;
    margin-left: 48px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}

.user-message .message-content {
    background: var(--bg-dark-secondary);
    color: var(--text-white);
    border: 2px solid var(--accent-blue);
    border-bottom-right-radius: 6px;
}

.ai-message .message-content {
    background: var(--bg-dark-secondary);
    color: var(--text-white);
    border: 2px solid var(--accent-green);
    border-bottom-left-radius: 6px;
}

.message-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 8px;
    height: auto;
}

.message-actions {
    margin-top: 8px;
    margin-left: 48px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border-dark);
    padding: 8px 14px;
    border-radius: 18px;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}

.action-btn:hover {
    background: var(--bg-dark-secondary);
    color: var(--text-white);
}

.typing-indicator {
    display: none;
    padding: 16px;
    align-items: center;
    gap: 12px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--accent-blue);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-8px); opacity: 1; }
}

.chat-input-container {
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-area-inset-bottom));
    width: 100%;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-dark);
    position: sticky;
    bottom: 0;
}

.image-preview {
    background: var(--bg-dark-secondary);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-dark);
}

.preview-content {
    position: relative;
    display: inline-block;
}

.preview-content img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: #ef4444;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}

.remove-image-btn:hover {
    background: #dc2626;
}

.ocr-text {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-dark);
    border-radius: 8px;
    color: var(--text-gray);
    font-size: 12px;
    max-height: 80px;
    overflow-y: auto;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    background: var(--bg-dark-secondary);
    padding: 12px 16px;
    border-radius: 24px;
    align-items: center;
    border: 1px solid var(--border-dark);
}

.input-wrapper:focus-within {
    border-color: var(--accent-blue);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 16px;
    font-family: inherit;
    min-height: 24px;
    max-height: 120px;
    resize: none;
    line-height: 1.4;
}

#messageInput:focus {
    outline: none;
}

#messageInput::placeholder {
    color: var(--text-gray-dark);
}

.input-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-action-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 18px;
}

.input-action-btn:hover {
    background: var(--bg-dark-tertiary);
    color: var(--text-white);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--accent-blue);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 18px;
}

.send-btn:hover:not(:disabled) {
    background: #3a7bc8;
    transform: scale(1.05);
}

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

.input-footer {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-btn {
    background: transparent;
    border: 1px solid var(--border-dark);
    padding: 10px 16px;
    border-radius: 20px;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    min-height: 40px;
}

.footer-btn:hover {
    background: var(--bg-dark-secondary);
    color: var(--text-white);
}

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

/* NOTIFICATION */
.notification {
    position: fixed;
    top: 20px;
    right: 16px;
    left: 16px;
    background: var(--bg-dark-secondary);
    border: 1px solid var(--border-dark);
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transform: translateY(-100px);
    transition: transform 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.notification.show {
    transform: translateY(0);
}

.notification.success {
    border-left: 4px solid #22c55e;
}

.notification.error {
    border-left: 4px solid #ef4444;
}

.notification i {
    font-size: 18px;
}

.notification.success i {
    color: #22c55e;
}

.notification.error i {
    color: #ef4444;
}

.notification span {
    font-size: 14px;
    color: var(--text-white);
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-dark-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

/* MOBILE RESPONSIVE ENHANCEMENTS */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 85vw;
    }
    
    .auth-box {
        padding: 20px;
        margin: 0 8px;
    }
    
    .auth-header h1 {
        font-size: 22px;
    }
    
    .chat-header {
        padding: 0 12px;
    }
    
    .chat-messages {
        padding: 12px;
        padding-bottom: 0;
    }
    
    .welcome-screen {
        padding: 24px 12px;
    }
    
    .welcome-screen h1 {
        font-size: 24px;
    }
    
    .welcome-screen p {
        font-size: 15px;
    }
    
    .ai-logo svg {
        width: 60px;
        height: 60px;
    }
    
    .message-content {
        margin-left: 44px;
        padding: 12px 14px;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .message-actions {
        margin-left: 44px;
    }
    
    .chat-input-container {
        padding: 12px;
        padding-bottom: calc(12px + var(--safe-area-inset-bottom));
    }
    
    .input-wrapper {
        padding: 10px 14px;
    }
    
    .input-action-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .footer-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .history-item {
        padding: 12px 14px;
        min-height: 56px;
    }
    
    .sidebar-footer {
        padding: 12px;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .auth-box {
        padding: 16px;
    }
    
    .form-group input {
        padding: 12px 14px;
    }
    
    .btn {
        padding: 12px;
        min-height: 44px;
    }
    
    .chat-header {
        height: 56px;
    }
    
    .menu-btn,
    .header-action-btn {
        width: 40px;
        height: 40px;
    }
    
    .header-title {
        font-size: 16px;
    }
    
    .welcome-screen h1 {
        font-size: 22px;
    }
    
    .welcome-screen p {
        font-size: 14px;
    }
    
    .message-content {
        margin-left: 40px;
        padding: 10px 12px;
        font-size: 15px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
    }
    
    .message-actions {
        margin-left: 40px;
    }
    
    .action-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .input-footer {
        gap: 8px;
    }
    
    .footer-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn, 
    .menu-btn, 
    .header-action-btn, 
    .input-action-btn, 
    .send-btn, 
    .footer-btn,
    .action-btn,
    .sidebar-action-btn,
    .close-sidebar-btn,
    .delete-chat-btn,
    .remove-image-btn {
        transition: none;
    }
    
    .btn:active, 
    .menu-btn:active, 
    .header-action-btn:active, 
    .input-action-btn:active, 
    .send-btn:active, 
    .footer-btn:active,
    .action-btn:active,
    .sidebar-action-btn:active,
    .close-sidebar-btn:active,
    .delete-chat-btn:active,
    .remove-image-btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
    
    .history-item:active {
        background: var(--bg-dark-tertiary);
    }
}

/* DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-dark: #0a0a0a;
        --bg-dark-secondary: #1a1a1a;
        --bg-dark-tertiary: #2a2a2a;
    }
}

/* HIGH CONTRAST MODE SUPPORT */
@media (prefers-contrast: high) {
    :root {
        --text-gray: #ffffff;
        --text-gray-dark: #cccccc;
        --border-dark: #555555;
    }
}

/* REDUCED MOTION SUPPORT */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .ai-logo {
        animation: none;
    }
    
    .typing-dots span {
        animation: none;
        opacity: 0.7;
    }
    
    .splash-logo-container,
    .splash-loading-progress,
    .splash-particle,
    .splash-sparkle {
        animation: none !important;
    }
}

/* ============================================
   END OF SMART AI COMPLETE CSS
   ============================================ */
