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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.nav-main h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-main nav {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.search-section {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.random-btn {
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s;
}

.random-btn:hover {
    transform: scale(1.05);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Panel */
.left-panel {
    width: 30%;
    background: #1a1a1a;
    color: white;
    padding: 2rem;
    overflow-y: auto;
    border-right: 2px solid #333;
}

.ai-avatar-section {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #333;
    border-radius: 12px;
}

.ai-avatar {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: float 3s ease-in-out infinite;
}

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

.ai-avatar-section h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #4dabf7;
}

.status {
    color: #69db7c;
    font-size: 0.9rem;
}

/* Prompt Section */
.prompt-section {
    margin-bottom: 2rem;
}

.prompt-input {
    width: 100%;
    background: #333;
    color: white;
    border: 2px solid #444;
    padding: 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.prompt-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.input-footer {
    margin: 0.5rem 0;
    text-align: right;
}

.char-counter {
    font-size: 0.8rem;
    color: #999;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.send-btn {
    flex: 2;
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.send-btn.loading {
    background: linear-gradient(45deg, #ffa500, #ff8c00);
    animation: pulse 1.5s infinite;
}

.send-btn.success {
    background: linear-gradient(45deg, #28a745, #20c997);
}

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

.clear-btn {
    flex: 1;
    background: #dc3545;
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #c82333;
}

/* Examples Section */
.examples-section {
    margin-bottom: 2rem;
}

.examples-toggle {
    width: 100%;
    background: #333;
    color: white;
    border: 1px solid #444;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.examples-toggle:hover {
    background: #444;
}

.examples-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.examples-content.expanded {
    max-height: 300px;
}

.example-item {
    background: #444;
    margin: 0.5rem 0;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.example-item:hover {
    background: #555;
    transform: translateX(5px);
}

/* History Section */
.history-section h4 {
    margin-bottom: 1rem;
    color: #4dabf7;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    background: #333;
    margin: 0.5rem 0;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    background: #444;
    transform: translateX(5px);
}

.history-prompt {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.history-time {
    font-size: 0.8rem;
    color: #999;
}

/* Right Panel */
.right-panel {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
}

.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#p5-container {
    width: 100%;
    height: 100%;
}

#p5-container canvas {
    display: block;
    margin: 0 auto;
}

/* Canvas Controls */
.canvas-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 45px;
    height: 45px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Code Modal */
.code-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.code-modal.hidden {
    display: none;
}

.code-modal-content {
    background: #1a1a1a;
    color: white;
    border-radius: 12px;
    max-width: 80vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid #333;
}

.close-btn {
    background: none;
    color: #999;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: white;
}

.code-display {
    flex: 1;
    background: #0e0e0e;
    color: #f8f8f2;
    padding: 2rem;
    margin: 0;
    overflow: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.copy-code-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 1rem 2rem;
    margin: 1rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-code-btn:hover {
    background: #0056b3;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .left-panel {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-bottom: 2px solid #333;
    }
    
    .right-panel {
        height: 60vh;
    }
    
    .nav-main {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-section {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .canvas-controls {
        bottom: 1rem;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #333;
}

::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #888;
}