:root {
    --bg-dark: #0F172A;
    --bg-card: #1E293B;
    --bg-card-hover: #334155;
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --text-main: #FFFFFF;
    --text-muted: #94A3B8;
    --border-color: rgba(255, 255, 255, 0.1);
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-md: 0 4px 24px rgba(0,0,0,0.15);
    --shadow-float: 0 10px 40px rgba(0,0,0,0.3);
    --font-family: 'Inter', sans-serif;
    --transition: all 0.2s ease;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--primary-hover);
}

/* Navbar */
.navbar {
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.brand-icon {
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-main);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.mobile-nav {
    display: none;
    flex-direction: column;
    padding: 20px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav.active {
    display: flex;
}

.mobile-nav .nav-link {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-align: center;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: white;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Hero Section */
.hero {
    padding: 80px 0;
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 24px;
    background: linear-gradient(to right, #fff, #94A3B8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
}

.prompt-area {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.prompt-textarea {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    font-size: 1.25rem;
    color: var(--text-main);
    resize: none;
    min-height: 150px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #233045;
}

.example-prompts {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 40px;
}

.example-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    width: calc(33.333% - 16px);
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.example-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    background-color: var(--bg-card-hover);
}

.example-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

/* Generate Page Layout */
.generate-container {
    position: relative;
    height: calc(100vh - 70px);
    overflow: hidden;
    background-color: var(--bg-dark);
}

/* Initial View (Mesh Gradient) */
.initial-view {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.4) 0%, transparent 50%),
                radial-gradient(circle at 90% 80%, rgba(239, 68, 68, 0.4) 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.3) 0%, transparent 50%);
    background-color: #0b1120;
    z-index: 10;
    transition: opacity 0.5s ease;
    padding: 20px;
}

.initial-view.hidden {
    opacity: 0;
    pointer-events: none;
}

.connect-tools-pill {
    background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.greeting-text {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 32px;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.floating-prompt-box {
    background-color: #1e1e24;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 700px;
    padding: 16px 24px;
    box-shadow: var(--shadow-float);
    position: relative;
    display: flex;
    flex-direction: column;
}

.floating-textarea {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.125rem;
    resize: none;
    min-height: 60px;
    outline: none;
    font-family: inherit;
    width: 100%;
}

.floating-textarea::placeholder {
    color: rgba(255,255,255,0.4);
}

.floating-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.action-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: var(--transition);
}

.action-icon-btn:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.1);
}

.submit-arrow-btn {
    background-color: var(--primary);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.submit-arrow-btn:hover {
    background-color: var(--primary-hover);
}

/* Workspace View (2 Columns) */
.generate-wrapper {
    display: flex;
    height: 100%;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.generate-panel-left {
    width: 350px;
    background-color: #13141a;
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    z-index: 5;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
}

.log-entry {
    margin-bottom: 24px;
}

.log-title {
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.log-content {
    background-color: #1e1e24;
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 0.875rem;
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.05);
    font-family: monospace;
    white-space: pre-wrap;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background-color: #13141a;
}

.chat-input-box {
    background-color: #1e1e24;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input-box input {
    background: transparent;
    border: none;
    color: #fff;
    flex-grow: 1;
    outline: none;
    font-size: 0.9rem;
}

.generate-panel-right {
    flex-grow: 1;
    background-color: #0b1120;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
}

.preview-area {
    position: relative;
    flex-grow: 1;
    overflow: hidden;
    background-color: #0b1120;
}

.immersive-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #0d1117;
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    will-change: transform, opacity;
}

.immersive-loading-overlay.overlay-hidden {
    transform: translateY(-100%);
    pointer-events: none;
}

#htmlRainCanvas {
    display: none; /* Disabled — was overlapping content */
}

/* Top Bar: mini orbit + status + line count */
.loading-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background-color: #161b22;
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

.loading-top-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.loading-top-right {
    display: flex;
    align-items: center;
}

.code-line-counter {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: #4ADE80;
    background: rgba(74, 222, 128, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(74, 222, 128, 0.2);
}

/* Mini Orbit */
.orbit-system-mini {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.core-aura-mini {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.5) 0%, transparent 70%);
    animation: aura-pulse 2.5s infinite ease-in-out;
}

.core-icon-mini {
    position: relative;
    font-size: 16px;
    z-index: 5;
    animation: core-pulse 2s infinite ease-in-out;
    filter: drop-shadow(0 0 6px rgba(99,102,241,0.8));
}

.orbit-ring-mini {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    animation: ring-spin 4s linear infinite;
}

.orbit-dot-mini {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    margin: -1.5px 0 0 -1.5px;
}

.orbit-dot-mini.dot-m1 { transform: rotate(0deg) translateX(16px); background: #6366F1; box-shadow: 0 0 6px 2px #6366F1; }
.orbit-dot-mini.dot-m2 { transform: rotate(90deg) translateX(16px); background: #8B5CF6; box-shadow: 0 0 6px 2px #8B5CF6; }
.orbit-dot-mini.dot-m3 { transform: rotate(180deg) translateX(16px); background: #06B6D4; box-shadow: 0 0 6px 2px #06B6D4; }
.orbit-dot-mini.dot-m4 { transform: rotate(270deg) translateX(16px); background: #4FA8FA; box-shadow: 0 0 6px 2px #4FA8FA; }

/* Code Stream Area */
.code-stream-area {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
    z-index: 2;
    padding: 0;
    background-color: #0d1117;
}

.code-stream-pre {
    margin: 0;
    padding: 20px 24px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.65;
    color: #e6edf3;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 100%;
}

/* Syntax-like color for the streaming code */
.code-stream-pre::selection {
    background: rgba(99, 102, 241, 0.3);
}

/* Scrollbar styling */
.code-stream-area::-webkit-scrollbar {
    width: 8px;
}
.code-stream-area::-webkit-scrollbar-track {
    background: #0d1117;
}
.code-stream-area::-webkit-scrollbar-thumb {
    background: #21262d;
    border-radius: 4px;
}
.code-stream-area::-webkit-scrollbar-thumb:hover {
    background: #30363d;
}

@keyframes ring-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes core-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes aura-pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.3); }
}

/* Status Text */
.loading-status-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #94A3B8;
    letter-spacing: 0.02em;
    transition: opacity 0.4s ease, color 0.3s ease;
}

.loading-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: rgba(255,255,255,0.05);
    z-index: 3;
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366F1, #8B5CF6, #06B6D4);
    transition: width 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.progress-shimmer {
    position: absolute;
    top: 0; left: 0; bottom: 0; width: 60px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
    animation: shimmer-slide 1.5s infinite linear;
}

@keyframes shimmer-slide {
    0% { transform: translateX(-60px); }
    100% { transform: translateX(calc(100vw)); }
}

.loading-overlay-error {
    animation: flash-error 0.6s ease;
}

@keyframes flash-error {
    0%, 100% { background-color: #0F172A; }
    25%, 75% { background-color: rgba(239, 68, 68, 0.15); }
}

.try-again-btn {
    margin-top: 20px;
    animation: bounce-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce-in {
    0% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.generate-btn {
    position: relative;
    overflow: hidden;
}

.generate-btn:active {
    transform: scale(0.96);
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: #0b1120;
    transition: opacity 0.5s ease, transform 0.5s ease, filter 0.3s ease;
}

.preview-iframe.iframe-hidden {
    opacity: 0;
    transform: scale(0.97);
}

.preview-iframe.iframe-blurred {
    filter: blur(4px);
    opacity: 0.4;
}

.action-toolbar-item {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.action-toolbar-hidden {
    transform: translateY(20px) !important;
    opacity: 0 !important;
}

.toolbar {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background-color: var(--bg-card);
}

.device-toggles {
    display: flex;
    gap: 8px;
}

.device-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.device-btn.active, .device-btn:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.preview-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    background-color: #000; /* Darker bg for preview contrast */
    overflow: hidden;
    padding: 20px;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    background-color: white; /* Actual websites are usually light */
    border: none;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    transition: width 0.3s ease;
}

/* Layout Utilities */
.main-content {
    flex-grow: 1;
}

.footer {
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Advanced Options */
.advanced-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin: 20px 0;
    color: var(--text-muted);
}

.advanced-content {
    display: none;
    margin-bottom: 20px;
}

.advanced-content.active {
    display: block;
}

/* Spin keyframe used by various components */
@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Auth Pages */
.auth-container {
    max-width: 450px;
    margin: 80px auto;
    background-color: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.project-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--text-muted);
}

.project-thumb {
    height: 160px;
    background-color: #2a3441;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.project-info {
    padding: 20px;
}

.project-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Pricing */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 60px;
}

.pricing-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    text-align: center;
}

.pricing-card.popular {
    border-color: var(--primary);
    position: relative;
    transform: scale(1.05);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.price {
    font-size: 3rem;
    font-weight: 800;
    margin: 20px 0;
}

.price span {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.pricing-features {
    list-style: none;
    margin: 30px 0;
    text-align: left;
}

.pricing-features li {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

/* Media Queries */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-menu-btn { display: block; }
    
    .example-prompts { flex-direction: column; }
    .example-card { width: 100%; }
    
    .generate-wrapper { flex-direction: column; height: auto; }
    .generate-panel-left { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); }
    .generate-panel-right { width: 100%; height: 600px; }
    
    .pricing-card.popular { transform: none; }
}
