/* Mobile-First AI Customer Support Demo */
:root {
  /* Color Palette - matching homepage */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  
  /* Base Colors */
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(255, 255, 255, 0.1);
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #b8b8b8;
  --text-muted: #888888;
  --text-accent: #667eea;
  
  /* Accent Colors */
  --accent-purple: #667eea;
  --accent-pink: #f093fb;
  --accent-blue: #4facfe;
  --accent-green: #a8edea;
  
  /* Border Radius */
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  
  /* Shadows */
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.3);
  
  /* Mobile-specific variables */
  --header-height: 60px;
  --header-expanded-height: 120px;
  --input-height: 70px;
  --panel-width: 320px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
}

/* Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(240, 147, 251, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(79, 172, 254, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Mobile Header - Collapsible */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    z-index: 1000;
    transition: all 0.3s ease;
    height: var(--header-height);
    overflow: hidden;
}

.mobile-header.expanded {
    height: var(--header-expanded-height);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: var(--header-height);
    min-height: var(--header-height);
}

.header-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.header-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.header-toggle.rotated {
    transform: rotate(180deg);
}

.mobile-header h1 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.2rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
    margin: 0 1rem;
}

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

.action-btn {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.action-btn:hover,
.action-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.header-details {
    padding: 0 1rem 1rem 1rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.mobile-header.expanded .header-details {
    opacity: 1;
    transform: translateY(0);
}

.header-details p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.header-details small {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* Main Chat Container - Full Screen */
.chat-container {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
    z-index: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: calc(var(--input-height) + 1rem);
}

/* Message Styles */
.message {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 1.25rem;
    max-width: 85%;
    word-wrap: break-word;
    position: relative;
    animation: fadeInUp 0.3s ease-out;
}

.user-message {
    background: var(--primary-gradient);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
    font-size: 0.9rem;
}

.ai-message {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    align-self: flex-start;
    backdrop-filter: blur(10px);
    border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
    font-size: 0.9rem;
}

/* Fixed Input Area */
.user-input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    height: var(--input-height);
    z-index: 100;
}

.user-input textarea {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    color: var(--text-primary);
    resize: none;
    height: 44px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    max-height: 120px;
}

.user-input textarea:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.user-input textarea::placeholder {
    color: var(--text-muted);
}

.user-input button {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-input button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.user-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Slide-out Panels */
.slide-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: var(--panel-width);
    height: 100vh;
    background: var(--bg-glass);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    z-index: 2000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.slide-panel.active {
    right: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-card);
    min-height: 60px;
}

.panel-header h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Quick Questions Panel */
.quick-questions-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quick-btn {
    padding: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    min-height: 56px;
}

.quick-btn i {
    color: var(--accent-purple);
    font-size: 1.1rem;
    width: 20px;
    flex-shrink: 0;
}

.quick-btn:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-btn:hover i {
    color: white;
}

/* Settings Panel */
.setting {
    margin-bottom: 1.5rem;
}

.setting label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.setting input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.setting input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-gradient);
    border-radius: 50%;
    cursor: pointer;
}

.setting input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-gradient);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.setting input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-height: 44px;
}

.setting input[type="number"]:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.setting input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: var(--accent-purple);
    width: 18px;
    height: 18px;
}

#temperature-value {
    color: var(--accent-purple);
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Panel Overlay */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* Desktop Footer - Hidden on mobile */
.desktop-footer {
    display: none;
}

/* Loading indicator */
.typing-indicator {
    display: inline-block;
    padding: 0.75rem 1rem;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
    margin-bottom: 0.75rem;
    backdrop-filter: blur(10px);
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    margin-right: 0.25rem;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

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

.typing-indicator span:nth-child(3) {
    animation-delay: 0s;
    margin-right: 0;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Code block styling */
.code-block {
    background: var(--bg-secondary);
    color: var(--accent-green);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Markdown formatting styles */
.ai-message h1, .ai-message h2, .ai-message h3 {
    margin: 1rem 0 0.75rem 0;
    color: var(--text-primary);
}

.ai-message h1 {
    font-size: 1.3em;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
    padding-bottom: 0.5rem;
}

.ai-message h2 {
    font-size: 1.1em;
    color: var(--text-secondary);
}

.ai-message h3 {
    font-size: 1em;
    color: var(--text-muted);
}

.ai-message strong {
    font-weight: 600;
    color: var(--text-primary);
}

.ai-message ul {
    margin: 0.5rem 0;
    padding-left: 1rem;
}

.ai-message ul li {
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar,
.panel-content::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track,
.panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Tablet Styles */
@media (min-width: 768px) {
    :root {
        --header-height: 70px;
        --header-expanded-height: 140px;
        --input-height: 80px;
        --panel-width: 380px;
    }
    
    .mobile-header h1 {
        font-size: 1.4rem;
    }
    
    .header-details p {
        font-size: 1rem;
    }
    
    .header-details small {
        font-size: 0.85rem;
    }
    
    .chat-messages {
        padding: 1.5rem;
        gap: 1rem;
    }
    
    .message {
        font-size: 1rem;
        max-width: 80%;
    }
    
    .user-input {
        padding: 1rem 1.5rem;
    }
    
    .user-input textarea {
        height: 48px;
        font-size: 1rem;
    }
    
    .user-input button {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .quick-btn {
        font-size: 1rem;
        padding: 1.25rem;
        min-height: 64px;
    }
    
    .quick-btn i {
        font-size: 1.2rem;
    }
}

/* Desktop Styles */
@media (min-width: 900px) {
    :root {
        --panel-width: 400px;
    }
    
    /* Desktop layout with permanent sidebar */
    .slide-panel {
        position: fixed;
        right: 0;
        width: var(--panel-width);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        transition: none; /* Remove transition for desktop */
    }
    
    .chat-container {
        right: var(--panel-width);
    }
    
    .user-input {
        right: var(--panel-width);
    }
    
    .mobile-header {
        right: var(--panel-width);
    }
    
    /* Hide panel overlay on desktop */
    .panel-overlay {
        display: none !important;
    }
    
    /* Desktop panel switching - allow both panels to be shown/hidden */
    .slide-panel.active {
        right: 0 !important;
    }
    
    .slide-panel:not(.active) {
        right: -100% !important;
    }
    
    /* Adjust action buttons for desktop */
    .action-btn {
        width: 44px;
        height: 44px;
    }
    
    /* Show desktop footer */
    .desktop-footer {
        display: block;
        position: fixed;
        bottom: var(--input-height);
        left: 0;
        right: var(--panel-width);
        background: var(--bg-glass);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(20px);
        padding: 0.75rem 1.5rem;
        text-align: center;
        font-size: 0.85rem;
        color: var(--text-muted);
        z-index: 50;
        height: 50px;
    }
    
    /* Adjust chat container for desktop footer */
    .chat-messages {
        padding-bottom: calc(var(--input-height) + 50px);
    }
    
    /* Desktop-specific header styling */
    .mobile-header {
        background: var(--bg-glass);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-header h1 {
        font-size: 1.5rem;
    }
    
    /* Better desktop message layout */
    .message {
        max-width: 70%;
        font-size: 1rem;
    }
    
    /* Desktop input styling */
    .user-input textarea {
        font-size: 1rem;
        height: 50px;
    }
    
    .user-input button {
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
    }
}

/* Large Desktop */
@media (min-width: 1440px) {
    :root {
        --panel-width: 450px;
    }
    
    .chat-messages {
        padding: 2rem;
        gap: 1.25rem;
    }
    
    .message {
        max-width: 75%;
        font-size: 1.05rem;
    }
    
    .panel-content {
        padding: 2rem;
    }
    
    .quick-btn {
        padding: 1.5rem;
        font-size: 1.05rem;
        min-height: 72px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .action-btn,
    .header-toggle,
    .panel-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    .user-input button {
        min-width: 48px;
        min-height: 48px;
    }
    
    .quick-btn {
        min-height: 56px;
    }
    
    .setting input[type="range"] {
        height: 8px;
    }
    
    .setting input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .setting input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    :root {
        --header-height: 50px;
        --header-expanded-height: 100px;
        --input-height: 60px;
    }
    
    .mobile-header h1 {
        font-size: 1.1rem;
    }
    
    .header-details p {
        font-size: 0.85rem;
    }
    
    .header-details small {
        font-size: 0.75rem;
    }
    
    .chat-messages {
        padding: 0.75rem;
    }
    
    .user-input {
        padding: 0.5rem 0.75rem;
    }
    
    .user-input textarea {
        height: 40px;
        font-size: 0.85rem;
    }
    
    .user-input button {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .action-btn,
    .header-toggle,
    .panel-close {
        border-width: 0.5px;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
