:root {
    --primary: #FF8C42;
    --primary-dark: #E6793A;
    --secondary: #FF6B35;
    --accent: #FFB84D;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.2);
    --shadow: rgba(0, 0, 0, 0.3);
    --glow: rgba(255, 140, 66, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 140, 66, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 107, 53, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 1.5rem 2rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.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: headerShine 3s ease-in-out infinite;
}

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

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.header p {
    font-size: 1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 2rem;
    overflow: hidden;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.1);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.message {
    max-width: 75%;
    padding: 1.5rem 2rem;
    border-radius: 20px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    position: relative;
    animation: messageSlide 0.3s ease-out;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
}

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

.user-message {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    box-shadow: 0 8px 32px rgba(255, 140, 66, 0.3);
    border-left: 4px solid rgba(255, 255, 255, 0.3);
}

.user-message::before {
    content: '👤';
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--accent);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(255, 184, 77, 0.4);
}

.assistant-message {
    background: rgba(22, 33, 62, 0.8);
    color: var(--text-primary);
    align-self: flex-start;
    border-left: 4px solid var(--primary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.assistant-message::before {
    content: '🤖';
    position: absolute;
    top: -10px;
    left: -10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px var(--glow);
}

.command-result {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    border-left: 4px solid var(--success);
    padding: 1.5rem;
    margin: 1rem 0;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9em;
    border-radius: 12px;
    position: relative;
    backdrop-filter: blur(10px);
    animation: commandGlow 0.5s ease-out;
}

@keyframes commandGlow {
    from {
        box-shadow: 0 0 0 rgba(16, 185, 129, 0.3);
    }
    to {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    }
}

.command-result::before {
    content: '⚡';
    position: absolute;
    top: -8px;
    left: 15px;
    background: var(--success);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.input-container {
    padding: 2rem;
    background: rgba(22, 33, 62, 0.8);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#userInput {
    width: 100%;
    min-height: 60px;
    max-height: 200px;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border);
    border-radius: 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#userInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--glow);
    background: rgba(255, 255, 255, 0.08);
}

#userInput::placeholder {
    color: var(--text-muted);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

button {
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.3);
}

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 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 140, 66, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: rgba(148, 163, 184, 0.3);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.reset-btn {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    font-size: 14px;
    padding: 0.6rem 1.5rem;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.reset-btn:hover {
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

.loading {
    display: none;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    position: relative;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

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

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

.status-indicator {
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    animation: statusSlide 0.3s ease-out;
    backdrop-filter: blur(10px);
}

@keyframes statusSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.status-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-left: 4px solid var(--success);
}

.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid var(--error);
}

.iteration-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 1rem;
    opacity: 0.8;
}

.show-link {
    background: rgba(255, 140, 66, 0.1);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.show-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 140, 66, 0.1), transparent);
    transition: left 0.5s ease;
}

.show-link:hover::before {
    left: 100%;
}

.show-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--glow);
}

.show-link a {
    color: #FFB84D;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.show-link a:hover {
    color: #FFC970;
}

/* Floating particles animation */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--primary);
    border-radius: 50%;
    animation: float 20s infinite linear;
    opacity: 0.3;
}

@keyframes float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100px) translateX(100px);
        opacity: 0;
    }
}

/* Code block styling */
pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    margin: 1rem 0;
}

code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.9em;
}

/* Glow effects */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px var(--primary), 0 0 10px var(--primary);
    }
    to {
        box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }

    .chat-container {
        padding: 0 1rem;
    }

    .input-container {
        flex-direction: column;
        align-items: stretch;
        padding: 1.5rem;
    }

    .button-group {
        flex-direction: row;
    }

    .message {
        max-width: 95%;
        padding: 1rem 1.5rem;
    }
}
