/* ==========================================
   Zurfax AI Chatbot - Elegant Modern UI
   Developed by Arfa Surya Pratama
   ========================================== */

/* CSS Variables */
:root {
    --color-black: #000000;
    --color-white: #ffffff;
    --color-gray-50: #fafafa;
    --color-gray-100: #f4f4f5;
    --color-gray-200: #e4e4e7;
    --color-gray-300: #d4d4d8;
    --color-gray-400: #a1a1aa;
    --color-gray-500: #71717a;
    --color-gray-600: #52525b;
    --color-gray-700: #3f3f46;
    --color-gray-800: #27272a;
    --color-gray-900: #18181b;
    --color-gray-950: #09090b;

    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1f1f1f;
    --bg-hover: #2a2a2a;
    --bg-sidebar: #0f0f0f;

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --border-color: #2a2a2a;
    --border-light: #1f1f1f;

    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #f97316 100%);
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;

    --sidebar-width: 280px;
    --header-height: 56px;
    --input-max-width: 800px;
    --message-max-width: 800px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    --shadow-glow: 0 0 60px rgba(139, 92, 246, 0.3);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==========================================
   Splash Screen - Elegant Opening
   ========================================== */

.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.active {
    opacity: 1;
    visibility: visible;
}

.splash-content {
    text-align: center;
    z-index: 2;
    padding: 20px;
}

.splash-logo-container {
    position: relative;
    display: inline-block;
    margin-bottom: 24px;
}

.splash-glow {
    position: absolute;
    inset: -20px;
    background: var(--accent-gradient);
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.5;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

.splash-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    position: relative;
    z-index: 1;
    animation: floatLogo 3s ease-in-out infinite;
}

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

.splash-title {
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.splash-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    animation: fadeInUp 0.6s ease 0.5s both;
}

.splash-loader {
    width: min(200px, 80vw);
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    margin: 32px auto 0;
    overflow: hidden;
    animation: fadeInUp 0.6s ease 0.7s both;
}

.loader-bar {
    height: 100%;
    width: 0;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    animation: loadProgress 2s ease-in-out forwards;
}

@keyframes loadProgress {
    0% { width: 0; }
    100% { width: 100%; }
}

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

.splash-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
}

.screen.active {
    display: flex;
}

/* ==========================================
   Welcome Screen - Elegant Hero
   ========================================== */

#welcome-screen {
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg-primary);
}

.welcome-background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
}

.orb-1 {
    width: min(600px, 100vw);
    height: min(600px, 100vw);
    background: #8b5cf6;
    top: -30%;
    right: -20%;
    animation: orbFloat 20s ease-in-out infinite;
}

.orb-2 {
    width: min(500px, 80vw);
    height: min(500px, 80vw);
    background: #ec4899;
    bottom: -20%;
    left: -20%;
    animation: orbFloat 25s ease-in-out infinite reverse;
}

.orb-3 {
    width: min(400px, 60vw);
    height: min(400px, 60vw);
    background: #f97316;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: orbFloat 15s ease-in-out infinite;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -30px); }
    50% { transform: translate(-20px, 20px); }
    75% { transform: translate(20px, 10px); }
}

.welcome-container {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.welcome-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    backdrop-filter: blur(10px);
    background: rgba(10, 10, 10, 0.7);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.125rem;
    font-weight: 700;
}

.nav-logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.nav-badge {
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Hero Section */
.welcome-hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: calc(100vh - 70px);
}

.hero-content {
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--accent-secondary);
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease both;
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hero-title {
    font-size: clamp(1.75rem, 6vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    animation: fadeInUp 0.6s ease 0.1s both;
}

.gradient-text {
    display: block;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: var(--text-secondary);
    max-width: 550px;
    margin: 0 auto 28px;
    animation: fadeInUp 0.6s ease 0.2s both;
    line-height: 1.6;
}

/* Hero Form */
.hero-form {
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.form-group {
    display: flex;
    flex-direction: row;
    gap: 10px;
    max-width: 450px;
    margin: 0 auto;
    padding: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.form-group:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.form-group input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn-start {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-start:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
}

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

/* Feature Cards */
.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    animation: fadeInUp 0.6s ease 0.4s both;
}

.feature-card {
    padding: 20px;
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-align: left;
    transition: all var(--transition-fast);
}

.feature-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.feature-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    color: var(--accent-secondary);
}

.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.feature-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ==========================================
   Chat Screen
   ========================================== */

#chat-screen {
    background: var(--bg-primary);
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 14px;
    border-bottom: 1px solid var(--border-light);
}

.btn-new-chat {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-new-chat:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-history {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    width: 100%;
}

.history-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.history-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.history-item-icon { flex-shrink: 0; color: var(--text-muted); }
.history-item-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-delete { opacity: 0; padding: 4px; background: transparent; border: none; color: var(--text-muted); cursor: pointer; border-radius: 4px; }
.history-item:hover .history-item-delete { opacity: 1; }
.history-item-delete:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.history-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.mobile-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.mobile-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.chat-messages {
    max-width: var(--message-max-width);
    margin: 0 auto;
    padding: 20px 16px;
}

/* Chat Welcome */
.chat-welcome {
    text-align: center;
    padding: 40px 16px;
}

.chat-welcome-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-bottom: 20px;
}

.chat-welcome h2 {
    font-size: clamp(1.3rem, 4vw, 1.6rem);
    font-weight: 700;
    margin-bottom: 8px;
}

.chat-welcome p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.suggestion-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.btn-suggestion {
    padding: 10px 16px;
    font-size: 0.8rem;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-suggestion:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-light);
    animation: messageIn 0.3s ease;
}

.message:last-child { border-bottom: none; }

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    overflow: hidden;
}

.message.user .message-avatar {
    background: var(--accent-gradient);
    color: white;
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
    padding: 5px;
}

.message.assistant .message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.message-content { flex: 1; min-width: 0; }
.message-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.message-name { font-weight: 600; font-size: 0.875rem; }
.message-time { font-size: 0.7rem; color: var(--text-muted); }
.message-text { font-size: 0.95rem; line-height: 1.7; color: var(--text-primary); word-wrap: break-word; }
.message-text p { margin-bottom: 10px; }
.message-text p:last-child { margin-bottom: 0; }
.message-text code { background: var(--bg-tertiary); padding: 2px 6px; border-radius: 4px; font-family: 'Courier New', monospace; font-size: 0.85em; }
.message-text sup { font-size: 0.7em; vertical-align: super; }
.message-image { max-width: min(300px, 100%); border-radius: var(--radius-md); margin-top: 10px; border: 1px solid var(--border-color); }

/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.thinking-icon {
    animation: spin 1s linear infinite;
    color: var(--accent-primary);
    flex-shrink: 0;
}

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

.thinking-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.input-container {
    max-width: var(--input-max-width);
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 6px 10px;
    transition: all var(--transition-fast);
}

.input-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.btn-upload {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-upload:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

#messageInput {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    max-height: 150px;
    min-height: 24px;
    padding: 6px 0;
}

#messageInput:focus { outline: none; }
#messageInput::placeholder { color: var(--text-muted); }

.btn-send {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-send:hover:not(:disabled) { transform: scale(1.05); }
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }

.input-hint {
    max-width: var(--input-max-width);
    margin: 6px auto 0;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Image Preview */
.image-preview-container {
    display: none;
    padding: 8px 16px;
    background: var(--bg-primary);
}

.image-preview-container.active { display: block; }

.image-preview-wrapper {
    position: relative;
    display: inline-block;
    max-width: min(200px, 50vw);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.image-preview-wrapper img {
    display: block;
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}

.btn-remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

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

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 40;
    backdrop-filter: blur(2px);
}

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

/* ==========================================
   Shop/Order Styles
   ========================================== */

.shop-container {
    max-width: 100%;
    padding: 16px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.product-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-fast);
}

.product-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-secondary);
    margin-bottom: 8px;
}

.product-stock {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.product-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.btn-buy {
    width: 100%;
    padding: 12px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-buy:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
}

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

/* Payment Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

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

.modal-body {
    padding: 20px;
}

.qr-container {
    text-align: center;
    margin-bottom: 20px;
}

.qr-image {
    max-width: 200px;
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.payment-info {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.payment-row:last-child {
    margin-bottom: 0;
}

.payment-label {
    color: var(--text-secondary);
}

.payment-value {
    color: var(--text-primary);
    font-weight: 500;
}

.payment-total {
    font-size: 1.1rem;
    color: var(--accent-secondary);
    font-weight: 700;
}

.payment-timer {
    text-align: center;
    padding: 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    color: var(--warning-color);
    font-size: 0.9rem;
}

.payment-status {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.payment-status.checking {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--accent-secondary);
}

.payment-status.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success-color);
}

.payment-status.expired {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error-color);
}

/* Receipt */
.receipt-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 16px;
}

.receipt-header {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
    margin-bottom: 16px;
}

.receipt-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-secondary);
}

.receipt-body {
    font-size: 0.85rem;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.account-details {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.account-item {
    margin-bottom: 12px;
}

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

.account-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.account-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-all;
}

/* ==========================================
   Responsive - Mobile First
   ========================================== */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }
    
    body {
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        width: min(280px, 85vw);
    }

    .sidebar.open { 
        transform: translateX(0); 
    }
    
    .mobile-header { 
        display: flex; 
    }

    /* Welcome Screen Mobile */
    .hero-features { 
        grid-template-columns: 1fr; 
        gap: 12px;
    }
    
    .feature-card {
        padding: 16px;
    }
    
    .feature-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 12px;
    }
    
    .welcome-nav { 
        padding: 12px 16px; 
    }
    
    .welcome-hero { 
        padding: 16px; 
        min-height: calc(100vh - 60px);
    }
    
    .hero-badge {
        font-size: 0.7rem;
        padding: 6px 12px;
    }
    
    .form-group {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }
    
    .form-group input {
        text-align: center;
        padding: 14px;
    }
    
    .btn-start { 
        width: 100%; 
        padding: 14px 20px;
    }

    /* Chat Screen Mobile */
    .chat-messages {
        padding: 16px 12px;
    }

    .message {
        gap: 10px;
        padding: 14px 0;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .message-text {
        font-size: 0.9rem;
    }

    .chat-welcome {
        padding: 30px 12px;
    }

    .chat-welcome-logo {
        width: 60px;
        height: 60px;
    }

    .suggestion-buttons {
        gap: 6px;
    }

    .btn-suggestion {
        padding: 8px 14px;
        font-size: 0.75rem;
    }

    .chat-input-area {
        padding: 10px 12px;
    }

    .input-container {
        padding: 5px 8px;
    }

    .btn-upload, .btn-send {
        width: 34px;
        height: 34px;
    }

    #messageInput {
        font-size: 0.9rem;
    }

    .input-hint {
        font-size: 0.65rem;
    }

    /* Product Cards Mobile */
    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        padding: 16px;
    }

    /* Modal Mobile */
    .modal-content {
        max-height: 85vh;
        margin: auto;
    }

    .modal-header, .modal-body {
        padding: 16px;
    }

    .qr-image {
        max-width: 180px;
    }
}

@media (max-width: 380px) {
    .splash-logo {
        width: 80px;
        height: 80px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-description {
        font-size: 0.85rem;
    }

    .nav-badge {
        display: none;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-gray-700); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-gray-600); }

::selection { background: var(--accent-primary); color: white; }

/* Prevent text selection on buttons */
button {
    -webkit-user-select: none;
    user-select: none;
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    .chat-input-area {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .mobile-header {
        padding-top: max(10px, env(safe-area-inset-top));
    }
}
