:root {
    --primary-color: #00d4ff;
    --secondary-color: #ff6b9d;
    --accent-color: #ffd93d;
    --background-dark: #0a0a1a;
    --background-medium: #1a1a2e;
    --background-light: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --success-color: #00ff88;
    --warning-color: #ffaa00;
    --error-color: #ff4757;
    --border-color: #333344;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-medium) 100%);
    color: var(--text-primary);
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon {
    font-size: 1.8rem;
    background: none;
    -webkit-text-fill-color: initial;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ai-status {
    padding: 0.5rem 1rem;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.ai-status.loading {
    background: rgba(255, 170, 0, 0.1);
    border-color: var(--warning-color);
    animation: pulse 1.5s infinite;
}

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

/* Mobile Menu Toggles */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    background: var(--primary-color);
    color: var(--background-dark);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.hamburger-toggle {
    top: 1rem;
    left: 1rem;
}

.kebab-toggle {
    top: 1rem;
    right: 1rem;
    background: var(--secondary-color);
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
}

.hamburger-toggle:hover {
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
}

.kebab-toggle:hover {
    box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    width: 300px;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.left-sidebar {
    border-right: none;
}

.right-sidebar {
    border-left: none;
}

.panel {
    padding: 1.5rem;
}

.panel h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel h4 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem 0;
    color: var(--text-secondary);
}

/* Input Groups */
.input-group {
    margin-bottom: 1rem;
}

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

.prompt-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.prompt-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.model-select {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), #0099cc);
    color: var(--background-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
}

.btn-success {
    background: linear-gradient(45deg, var(--success-color), #00cc66);
    color: var(--background-dark);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.4);
}

.btn-danger {
    background: linear-gradient(45deg, var(--error-color), #cc3838);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 71, 87, 0.4);
}

.btn-secondary {
    background: rgba(176, 176, 176, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(176, 176, 176, 0.2);
    transform: translateY(-1px);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-mini {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Code Examples */
.code-examples {
    margin: 1rem 0;
}

.code-examples summary {
    cursor: pointer;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.examples-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.example-btn {
    background: rgba(255, 107, 157, 0.1);
    color: var(--secondary-color);
    border: 1px solid rgba(255, 107, 157, 0.3);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 0.9rem;
}

.example-btn:hover {
    background: rgba(255, 107, 157, 0.2);
    transform: translateX(4px);
}

/* Code Display */
.code-section {
    margin-top: 1.5rem;
}

.code-editor-container {
    margin: 0.5rem 0 1rem 0;
}

.code-display {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

/* Syntax highlighting */
.keyword { color: #ff6b9d; }
.threejs { color: #00d4ff; }
.string { color: #ffd93d; }
.comment { color: #888; }
.number { color: #00ff88; }

/* 3D Viewport */
.viewport {
    flex: 1;
    position: relative;
    background: var(--background-dark);
}

.scene-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.viewport-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
    pointer-events: none;
}

.performance-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Object Management */
.objects-list {
    max-height: 200px;
    overflow-y: auto;
}

.object-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.object-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.empty-state {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.object-inspector {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.inspector-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quick-actions {
    margin-top: 1.5rem;
}

.quick-actions .btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Bottom Toolbar (Mobile) */
.bottom-toolbar {
    display: none;
    padding: 1rem;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
    justify-content: center;
}

/* Footer */
.footer {
    background: rgba(10, 10, 26, 0.9);
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 10px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    border: 1px solid var(--border-color);
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--error-color);
}

.notification-warning {
    border-left: 4px solid var(--warning-color);
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .title {
        font-size: 1.2rem;
    }

    .main-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        width: 90vw;
        max-width: 320px;
        z-index: 999;
        transform: translateX(-100%);
    }

    .left-sidebar {
        left: 0;
    }

    .right-sidebar {
        right: 0;
        transform: translateX(100%);
    }

    .sidebar.mobile-visible {
        transform: translateX(0);
    }

    .viewport {
        height: calc(100vh - 140px);
    }

    .bottom-toolbar {
        display: flex;
    }

    .header-controls {
        gap: 0.5rem;
    }

    .ai-status {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }

    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100vw;
    }

    .panel {
        padding: 1rem;
    }

    .prompt-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .viewport-overlay {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
}

/* Smooth animations */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}