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

:root {
    /* Futuristic Professional Color Palette */
    --primary-gradient: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 25%, #16213e 50%, #0f3460 100%);
    --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #0099cc 50%, #0066ff 100%);
    --secondary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --neural-gradient: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff, #06ffa5);

    /* Background & Surface Colors */
    --background-color: #0a0a0f;
    --surface-primary: rgba(26, 26, 46, 0.95);
    --surface-secondary: rgba(22, 33, 62, 0.8);
    --surface-tertiary: rgba(15, 15, 35, 0.9);

    /* Text Colors */
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-accent: #00d4ff;
    --text-neural: #06ffa5;

    /* Interactive Elements */
    --border-primary: rgba(0, 212, 255, 0.3);
    --border-active: rgba(0, 212, 255, 0.8);
    --shadow-primary: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-active: 0 16px 64px rgba(0, 212, 255, 0.3);
    --shadow-neural: 0 0 30px rgba(6, 255, 165, 0.4);

    /* Animation Variables */
    --transition-fast: 0.2s ease-out;
    --transition-medium: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.dark-theme {
    --background-color: #000000;
    --surface-primary: rgba(10, 10, 15, 0.98);
    --surface-secondary: rgba(15, 15, 25, 0.9);
    --text-primary: #ffffff;
    --border-primary: rgba(0, 212, 255, 0.5);
}

/* Base Styles */
body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background-color);
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(103, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(6, 255, 165, 0.05) 0%, transparent 50%);
    min-height: 100vh;
    color: var(--text-primary);
    transition: all var(--transition-medium);
    position: relative;
    overflow-x: hidden;
}

/* Animated Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(90deg, transparent 98%, rgba(0, 212, 255, 0.03) 100%),
        linear-gradient(0deg, transparent 98%, rgba(0, 212, 255, 0.03) 100%);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Login Page Styles */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--primary-gradient);
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    animation: pulseBackground 4s ease-in-out infinite;
}

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

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--surface-primary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-primary);
    border-radius: 24px;
    box-shadow: var(--shadow-primary), var(--shadow-active);
    overflow: hidden;
    position: relative;
    animation: slideInUp 0.8s ease-out;
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    background: var(--accent-gradient);
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.login-header h1 {
    font-size: 2.8em;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

.login-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.login-tabs {
    display: flex;
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--border-primary);
}

.tab-button {
    flex: 1;
    padding: 18px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all var(--transition-medium);
    position: relative;
}

.tab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.tab-button.active {
    border-bottom-color: var(--text-accent);
    color: var(--text-accent);
    background: rgba(0, 212, 255, 0.1);
}

.tab-button.active::before {
    opacity: 0.1;
}

.auth-form {
    padding: 40px 30px;
}

.input-group {
    margin-bottom: 24px;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 18px 24px;
    border: 2px solid var(--border-primary);
    border-radius: 16px;
    font-size: 1em;
    background: var(--surface-tertiary);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-medium);
    position: relative;
}

.input-group input::placeholder {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.input-group input:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.1), var(--shadow-active);
    transform: translateY(-2px);
}

.input-group input:focus::placeholder {
    color: var(--text-accent);
}

.auth-button {
    width: 100%;
    padding: 18px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.auth-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-medium);
}

.auth-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-active);
}

.auth-button:hover::before {
    left: 100%;
}

.auth-button:active {
    transform: translateY(-1px);
}

/* Chat Container */
.container {
    background: var(--surface-primary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-primary);
    border-radius: 24px;
    box-shadow: var(--shadow-primary);
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: fadeInScale 0.8s ease-out;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Chat Header */
.chat-header {
    background: var(--primary-gradient);
    padding: 24px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-primary);
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
    animation: headerShine 4s linear infinite;
}

@keyframes headerShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.header-left h1 {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 6px;
    background: var(--neural-gradient);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.username {
    color: var(--text-secondary);
    font-size: 0.95em;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.anonymous-info {
    color: var(--text-accent);
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 6px;
    display: block;
    position: relative;
    z-index: 1;
    animation: pulse 2s ease-in-out infinite;
}

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

/* Header Buttons */
.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.theme-toggle, .logout-button, .register-button {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-button,
.register-button {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    margin-left: 8px;
}

.login-button:hover,
.register-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-active);
}

.login-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.logout-button {
    background: linear-gradient(135deg, #ff4757, #c44569);
    color: white;
}

.theme-toggle:hover, .logout-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-active);
}

/* Chat Box */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--background-color);
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(0, 212, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(103, 126, 234, 0.03) 0%, transparent 50%);
    position: relative;
}

.message {
    margin-bottom: 20px;
    display: flex;
    animation: messageSlideIn 0.5s ease-out;
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.message-content {
    max-width: 75%;
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 1em;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
    backdrop-filter: blur(10px);
    transition: all var(--transition-medium);
}

.user-message .message-content {
    background: var(--secondary-gradient);
    color: white;
    border-bottom-right-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-primary);
}

.assistant-message .message-content {
    background: var(--surface-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-bottom-left-radius: 6px;
    box-shadow: var(--shadow-primary);
    position: relative;
}

.assistant-message .message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
}

.message-content:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-active);
}

/* Input Container */
.input-container {
    padding: 24px;
    background: var(--surface-secondary);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-primary);
}

.input-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

#user-input {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid var(--border-primary);
    border-radius: 16px;
    font-size: 1em;
    background: var(--surface-tertiary);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-medium);
}

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

#user-input:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.1), var(--shadow-active);
    transform: translateY(-1px);
}

#user-input.recording {
    border-color: #ff4757 !important;
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
    animation: recordingPulse 1.5s infinite;
}

@keyframes recordingPulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
    }
    50% { 
        box-shadow: 0 0 30px rgba(255, 71, 87, 0.8);
    }
}

/* Icon Buttons */
.icon-button {
    padding: 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 14px;
    transition: all var(--transition-medium);
    width: 52px;
    height: 52px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.icon-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-medium);
}

.icon-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-active);
}

.icon-button:hover::before {
    left: 100%;
}

.icon-button:disabled,
.icon-button[style*="not-allowed"] {
    background: linear-gradient(135deg, #666, #999) !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.icon-button.recording {
    background: linear-gradient(135deg, #ff4757, #c44569);
    animation: recordingButtonPulse 1.5s infinite;
    box-shadow: 0 0 30px rgba(255, 71, 87, 0.6);
}

@keyframes recordingButtonPulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 30px rgba(255, 71, 87, 0.6);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(255, 71, 87, 0.9);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 30px rgba(255, 71, 87, 0.6);
    }
}

/* Send Button */
#send-button {
    padding: 16px 24px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
}

#send-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-medium);
}

#send-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-active);
}

#send-button:hover::before {
    left: 100%;
}

#send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Image Preview */
#image-preview {
    margin-top: 16px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

#image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    border: 2px solid var(--border-primary);
    box-shadow: var(--shadow-primary);
    transition: all var(--transition-medium);
}

#image-preview img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-active);
}

.remove-image {
    background: linear-gradient(135deg, #ff4757, #c44569);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    margin-left: 12px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all var(--transition-medium);
}

.remove-image:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
}

/* Loading Animation */
.loading {
    padding: 20px;
    text-align: center;
    color: var(--text-primary);
    background: var(--surface-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    animation: fadeIn 0.5s ease-out;
}

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

.typing-indicator span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-gradient);
    animation: typingBounce 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; }

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

/* Payment Styles */
.payment-info {
    padding: 30px;
    text-align: center;
}

.payment-info h3 {
    color: var(--text-primary);
    font-size: 1.5em;
    margin-bottom: 20px;
    font-weight: 600;
}

.payment-info ul {
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

.payment-info li {
    padding: 12px 0;
    color: var(--text-primary);
    font-size: 1.1em;
    position: relative;
    padding-left: 30px;
}

.payment-info li::before {
    content: '✨';
    position: absolute;
    left: 0;
    top: 12px;
    font-size: 1.2em;
}

.price {
    font-size: 2.5em;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 24px 0;
    animation: priceGlow 2s ease-in-out infinite;
}

@keyframes priceGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

@keyframes fadeInOut {
    0% { 
        opacity: 0; 
        transform: translateX(10px) scale(0.8); 
    }
    50% { 
        opacity: 1; 
        transform: translateX(0) scale(1.1); 
    }
    100% { 
        opacity: 0; 
        transform: translateX(-10px) scale(0.8); 
    }
}

@keyframes creditPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Credits Display */
.credits-info {
    color: var(--text-accent);
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.credits-info:hover {
    transform: scale(1.05);
}

.credits-button {
    padding: 8px 16px;
    background: var(--secondary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    margin-right: 8px;
}

.credits-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-active);
}

/* Credits Page Styles */
.credits-page-container {
    background: var(--surface-primary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-primary);
    border-radius: 24px;
    box-shadow: var(--shadow-primary);
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    margin: 20px auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: fadeInScale 0.8s ease-out;
}

.credits-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.credits-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.credits-container h2 {
    text-align: center;
    color: var(--text-primary);
    font-size: 2.5em;
    margin-bottom: 10px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.credits-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2em;
    margin-bottom: 40px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.pricing-card {
    background: var(--surface-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    position: relative;
    transition: all var(--transition-medium);
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-active);
    border-color: var(--text-accent);
}

.pricing-card.featured {
    border-color: var(--text-accent);
    background: linear-gradient(135deg, var(--surface-secondary) 0%, rgba(64, 224, 255, 0.1) 100%);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-gradient);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
}

.pricing-card h3 {
    color: var(--text-primary);
    font-size: 1.5em;
    margin-bottom: 16px;
}

.credit-amount {
    color: var(--text-accent);
    font-size: 1.8em;
    font-weight: 700;
margin-bottom: 12px;
}

.pricing-card .price {
    font-size: 2.5em;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 20px 0;
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

.pricing-card li {
    color: var(--text-secondary);
    padding: 8px 0;
    font-size: 0.95em;
}

.paypal-button-container {
    margin-top: 24px;
    min-height: 50px;
}

.pricing-info {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
}

.pricing-info h3 {
    color: var(--text-primary);
    font-size: 1.5em;
    margin-bottom: 20px;
}

.pricing-info ul {
    list-style: none;
    padding: 0;
    max-width: 400px;
    margin: 0 auto;
}

.pricing-info li {
    color: var(--text-secondary);
    padding: 12px 0;
    font-size: 1.1em;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pricing-info li:last-child {
    border-bottom: none;
}

/* Credit pulse animation */
@keyframes creditPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Footer Styles */
.app-footer {
    background: var(--surface-secondary);
    border-top: 1px solid var(--border-primary);
    padding: 20px 0;
    margin-top: auto;
}

.footer-content {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.6;
}

.footer-copyright {
    font-weight: 500;
    margin-bottom: 4px;
}

.footer-brand {
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-links {
    margin-top: 12px;
}

.footer-link {
    color: var(--text-accent);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all var(--transition-medium);
    display: inline-block;
}

.footer-link:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-1px);
}

/* Terms Page Styles */
.terms-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.terms-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.terms-modal-content {
    background: var(--surface-secondary);
    border: 2px solid var(--border-active);
    border-radius: 24px;
    box-shadow: var(--shadow-active), 0 0 60px rgba(0, 212, 255, 0.3);
    position: relative;
    animation: modalSlideIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.terms-header {
    background: var(--primary-gradient);
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.terms-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
    animation: headerShine 3s linear infinite;
}

.terms-header h2 {
    font-size: 3em;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--neural-gradient);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.terms-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.3em;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.terms-body {
    padding: 40px 30px;
    background: var(--background-color);
    max-height: 60vh;
    overflow-y: auto;
}

.terms-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.terms-section {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 24px;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
    animation: cardFadeInUp 0.6s ease-out backwards;
}

.terms-section:nth-child(odd) { animation-delay: 0.1s; }
.terms-section:nth-child(even) { animation-delay: 0.2s; }

.terms-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.terms-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-active);
    border-color: var(--text-accent);
}

.terms-section:hover::before {
    opacity: 1;
}

.section-icon {
    font-size: 2em;
    margin-bottom: 16px;
    display: block;
}

.terms-section h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 16px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.terms-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.terms-section ul {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.terms-section li {
    color: var(--text-secondary);
    padding: 6px 0;
    font-size: 0.95em;
    position: relative;
    padding-left: 20px;
}

.terms-section li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 6px;
    font-size: 0.8em;
    color: var(--text-accent);
    font-weight: bold;
}

.terms-footer {
    background: var(--surface-secondary);
    padding: 40px 30px;
    text-align: center;
    border-top: 1px solid var(--border-primary);
}

.terms-back-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 18px 40px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow-primary);
}

.terms-back-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-medium);
}

.terms-back-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-active);
}

.terms-back-btn:hover::before {
    left: 100%;
}

.terms-note {
    color: var(--text-secondary);
    font-size: 1em;
    margin: 0;
    font-style: italic;
    line-height: 1.6;
}

/* Mobile Responsive for Terms */
@media (max-width: 768px) {
    .terms-header {
        padding: 30px 20px;
    }
    
    .terms-header h2 {
        font-size: 2.2em;
    }
    
    .terms-body {
        padding: 30px 20px;
        max-height: 50vh;
    }
    
    .terms-section {
        padding: 20px;
    }
    
    .terms-footer {
        padding: 30px 20px;
    }
    
    .terms-back-btn {
        width: 100%;
        padding: 16px;
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .terms-header h2 {
        font-size: 1.8em;
    }
    
    .terms-header p {
        font-size: 1.1em;
    }
    
    .section-icon {
        font-size: 1.8em;
    }
    
    .terms-section h3 {
        font-size: 1.2em;
    }
}

/* Success Page Styles */
.success-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 60px 20px;
    text-align: center;
}

.success-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.success-container h2 {
    color: var(--text-primary);
    font-size: 2.5em;
    margin-bottom: 20px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.success-message {
    color: var(--text-secondary);
    font-size: 1.2em;
    margin-bottom: 16px;
}

.balance-info {
    color: var(--text-accent);
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 40px;
}

.success-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.primary-button, .secondary-button {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    min-width: 160px;
}

.primary-button {
    background: var(--accent-gradient);
    color: white;
}

.secondary-button {
    background: transparent;
    color: var(--text-accent);
    border: 2px solid var(--text-accent);
}

.primary-button:hover, .secondary-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-active);
}

/* Scrollbar Styling */
.chat-box::-webkit-scrollbar,
.credits-content::-webkit-scrollbar {
    width: 8px;
}

.chat-box::-webkit-scrollbar-track,
.credits-content::-webkit-scrollbar-track {
    background: var(--surface-tertiary);
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb,
.credits-content::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: all var(--transition-medium);
}

.chat-box::-webkit-scrollbar-thumb:hover,
.credits-content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-gradient);
}

/* Error Message */
.error-message {
    padding: 20px 30px;
    background: linear-gradient(135deg, #ff4757, #c44569);
    color: white;
    text-align: center;
    border-radius: 0 0 24px 24px;
    animation: slideInDown 0.5s ease-out;
}

@keyframes slideInDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        width: 98%;
        height: 95vh;
        margin: 10px auto;
        border-radius: 16px;
    }

    .chat-header {
        padding: 20px;
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .chat-header h1 {
        font-size: 2em;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    .message-content {
        max-width: 85%;
        font-size: 0.95em;
    }

    .input-container {
        padding: 16px;
    }

    .input-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    #user-input {
        font-size: 16px;
        flex: 1;
        min-width: 200px;
    }

    .icon-button {
        width: 48px;
        height: 48px;
        font-size: 1.1em;
    }

    .login-container {
        padding: 16px;
    }

    .login-header {
        padding: 30px 20px;
    }

    .login-header h1 {
        font-size: 2.2em;
    }

    .auth-form {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .container {
        height: 100vh;
        width: 100%;
        border-radius: 0;
        margin: 0;
    }

    .chat-header h1 {
        font-size: 1.8em;
    }

    .message-content {
        max-width: 90%;
    }

    .input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .icon-button {
        width: 100%;
        height: 48px;
        border-radius: 12px;
    }

    #send-button {
        width: 100%;
    }
}

/* Special Effects */
@keyframes neuralPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(6, 255, 165, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(6, 255, 165, 0.6);
    }
}

.neural-active {
    animation: neuralPulse 2s ease-in-out infinite;
}

/* High Performance Animations */
* {
    will-change: auto;
}

.container,
.message,
.icon-button,
.auth-button,
#send-button {
    transform: translateZ(0);
}

/* Dark Mode */
body.dark-theme {
    --background-color: #0D1117;
    --surface-primary: rgba(22, 27, 34, 0.95);
    --surface-secondary: rgba(33, 38, 45, 0.8);
    --surface-tertiary: rgba(48, 54, 61, 0.6);
    --text-primary: #E6EDF3;
    --text-secondary: #8B949E;
    --text-accent: #58A6FF;
    --border-primary: rgba(240, 246, 252, 0.1);
    --shadow-primary: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-active: 0 12px 48px rgba(0, 0, 0, 0.6);
}

/* Copy Button Styles */
.copy-message-btn, .copy-code-btn {
    padding: 8px 12px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.copy-message-btn::before, .copy-code-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-medium);
}

.copy-message-btn:hover, .copy-code-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-active);
}

.copy-message-btn:hover::before, .copy-code-btn:hover::before {
    left: 100%;
}

.copy-message-btn:active, .copy-code-btn:active {
    transform: translateY(0);
}

.message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.message-wrapper .message-content {
    flex: 1;
}

/* Code Block Styles */
.code-block {
    background: var(--surface-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    margin: 12px 0;
    overflow: hidden;
    box-shadow: var(--shadow-primary);
}

.code-header {
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-language {
    color: var(--text-accent);
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
}

.code-block pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    background: var(--background-color);
}

.code-block code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--text-primary);
}

.inline-code {
    background: var(--surface-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

/* Copy Feedback */
.copy-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent-gradient);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: var(--shadow-active);
    z-index: 1000;
    animation: copyFeedbackSlide 2s ease-out;
}

@keyframes copyFeedbackSlide {
    0% {
        opacity: 0;
        transform: translateX(100px);
    }
    10%, 90% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Typing Cursor */
.typing-cursor {
    color: var(--text-accent);
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    10%, 80% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(50px);
    }
}

/* Disclaimer */
.disclaimer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85em;
    padding: 16px;
    opacity: 0.7;
    font-style: italic;
}

/* Dark theme code blocks */
body.dark-theme .code-block {
    background: #161B22;
    border-color: #30363D;
}

body.dark-theme .code-header {
    background: #21262D;
    border-color: #30363D;
}

body.dark-theme .inline-code {
    background: #21262D;
    border-color: #30363D;
    color: #F0F6FC;
}

/* Introduction Modal Styles */
.intro-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: modalFadeIn 0.8s ease-out;
    padding: 20px;
    box-sizing: border-box;
}

@keyframes modalFadeIn {
    0% {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    100% {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

.intro-content {
    background: var(--surface-primary);
    border: 2px solid var(--border-active);
    border-radius: 24px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-active), 0 0 60px rgba(0, 212, 255, 0.3);
    position: relative;
    animation: modalSlideIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.intro-header {
    background: var(--primary-gradient);
    padding: 40px 30px;
    text-align: center;
    position: relative;
    border-radius: 22px 22px 0 0;
    overflow: hidden;
}

.intro-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
    animation: headerShine 3s linear infinite;
}

.intro-header h2 {
    font-size: 3em;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--neural-gradient);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.intro-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.3em;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.intro-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.8em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-medium);
    backdrop-filter: blur(10px);
    z-index: 2;
}

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

.intro-body {
    padding: 40px 30px;
    background: var(--background-color);
}

.abilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.ability-card {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 24px;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
    animation: cardFadeInUp 0.6s ease-out backwards;
}

.ability-card:nth-child(1) { animation-delay: 0.1s; }
.ability-card:nth-child(2) { animation-delay: 0.2s; }
.ability-card:nth-child(3) { animation-delay: 0.3s; }
.ability-card:nth-child(4) { animation-delay: 0.4s; }
.ability-card:nth-child(5) { animation-delay: 0.5s; }
.ability-card:nth-child(6) { animation-delay: 0.6s; }
.ability-card:nth-child(7) { animation-delay: 0.7s; }
.ability-card:nth-child(8) { animation-delay: 0.8s; }
.ability-card:nth-child(9) { animation-delay: 0.9s; }

@keyframes cardFadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.ability-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.ability-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-active);
    border-color: var(--text-accent);
}

.ability-card:hover::before {
    opacity: 1;
}

.ability-icon {
    font-size: 2.5em;
    margin-bottom: 16px;
    display: block;
}

.ability-card h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 16px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ability-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ability-card li {
    color: var(--text-secondary);
    padding: 6px 0;
    font-size: 0.95em;
    position: relative;
    padding-left: 20px;
}

.ability-card li::before {
    content: '✨';
    position: absolute;
    left: 0;
    top: 6px;
    font-size: 0.8em;
}

.intro-footer {
    background: var(--surface-secondary);
    padding: 40px 30px;
    text-align: center;
    border-radius: 0 0 22px 22px;
    border-top: 1px solid var(--border-primary);
}

.intro-start-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 18px 40px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow-primary);
}

.intro-start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--transition-medium);
}

.intro-start-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-active);
}

.intro-start-btn:hover::before {
    left: 100%;
}

.intro-note {
    color: var(--text-secondary);
    font-size: 1em;
    margin: 0;
    font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .intro-modal {
        padding: 10px;
    }
    
    .intro-content {
        max-height: 95vh;
    }
    
    .intro-header {
        padding: 30px 20px;
    }
    
    .intro-header h2 {
        font-size: 2.2em;
    }
    
    .intro-body {
        padding: 30px 20px;
    }
    
    .abilities-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .ability-card {
        padding: 20px;
    }
    
    .intro-footer {
        padding: 30px 20px;
    }
    
    .intro-start-btn {
        width: 100%;
        padding: 16px;
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .intro-header h2 {
        font-size: 1.8em;
    }
    
    .intro-header p {
        font-size: 1.1em;
    }
    
    .ability-icon {
        font-size: 2em;
    }
    
    .ability-card h3 {
        font-size: 1.2em;
    }
    
    .intro-close {
        width: 40px;
        height: 40px;
        font-size: 1.5em;
        top: 15px;
        right: 15px;
    }
}