/* ===================================================================
   Prompt-to-App Generator -- Dark Developer Tool Theme
   Purple-accent-on-dark, monospace, modern IDE aesthetic
   =================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0a0d14;
    --bg-secondary: #0f1420;
    --bg-tertiary: #141a28;
    --bg-card: #181f30;
    --bg-card-hover: #1c2538;
    --bg-input: #0c1018;
    --bg-code: #0a0e16;

    --text-primary: #e2e8f0;
    --text-secondary: #8892a4;
    --text-muted: #505868;
    --text-accent: #a78bfa;

    --purple-primary: #a78bfa;
    --purple-dim: #7c3aed;
    --purple-glow: rgba(167, 139, 250, 0.15);
    --purple-bright: #c4b5fd;

    --green-primary: #34d399;
    --green-dim: #059669;
    --green-glow: rgba(52, 211, 153, 0.15);

    --red-primary: #f87171;
    --red-dim: #dc2626;
    --red-glow: rgba(248, 113, 113, 0.15);

    --orange-primary: #fb923c;
    --orange-dim: #ea580c;
    --orange-glow: rgba(251, 146, 60, 0.15);

    --blue-primary: #60a5fa;
    --blue-dim: #2563eb;
    --blue-glow: rgba(96, 165, 250, 0.15);

    --cyan-primary: #22d3ee;
    --cyan-dim: #0891b2;

    --border-primary: #1e2740;
    --border-accent: #2a3550;

    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px var(--purple-glow);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --transition: all 0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

a { color: var(--purple-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--purple-bright); }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Navigation --- */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand { display: flex; align-items: center; gap: 10px; }

.nav-icon {
    font-size: 1.4rem;
    color: var(--purple-primary);
    font-weight: 700;
    text-shadow: 0 0 10px var(--purple-glow);
}

.nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.nav-links { display: flex; gap: 4px; }

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
    font-family: var(--font-mono);
}

.nav-link:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.nav-link.active { color: var(--purple-primary); background: var(--purple-glow); }

.nav-status { display: flex; align-items: center; gap: 8px; }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-primary);
    box-shadow: 0 0 6px var(--green-primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text { font-size: 0.8rem; color: var(--text-secondary); }

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-primary);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* --- Stat Cards --- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--purple-primary);
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-family: var(--font-sans);
}

/* --- Prompt Input --- */
.prompt-container {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.prompt-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.6;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px var(--purple-glow);
}

.prompt-textarea::placeholder { color: var(--text-muted); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--purple-dim);
    color: white;
}

.btn-primary:hover {
    background: var(--purple-primary);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-accent);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--purple-dim);
}

.btn-danger {
    background: var(--red-dim);
    color: white;
}

.btn-danger:hover {
    background: var(--red-primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Tabs --- */
.tab-bar {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
    color: var(--purple-primary);
    border-bottom-color: var(--purple-primary);
}

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
    font-family: var(--font-sans);
    border-bottom: 1px solid var(--border-primary);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-primary);
}

.data-table tr:hover td { background: var(--bg-card-hover); }

/* --- Method Badges --- */
.method-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.method-GET { background: var(--green-glow); color: var(--green-primary); }
.method-POST { background: var(--blue-glow); color: var(--blue-primary); }
.method-PUT { background: var(--orange-glow); color: var(--orange-primary); }
.method-PATCH { background: var(--orange-glow); color: var(--orange-primary); }
.method-DELETE { background: var(--red-glow); color: var(--red-primary); }

/* --- Status Badges --- */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-completed { background: var(--green-glow); color: var(--green-primary); }
.status-generating { background: var(--blue-glow); color: var(--blue-primary); }
.status-failed { background: var(--red-glow); color: var(--red-primary); }
.status-pending { background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* --- Progress Indicator --- */
.progress-container {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.progress-container.active { display: block; }

.progress-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-accent);
    border-top-color: var(--purple-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.progress-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- Example Suggestions --- */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.suggestion-chip {
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-accent);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-sans);
}

.suggestion-chip:hover {
    background: var(--purple-glow);
    border-color: var(--purple-dim);
    color: var(--purple-bright);
}

/* --- Blueprint Viewer --- */
.blueprint-section {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.blueprint-section h3 {
    font-size: 1rem;
    color: var(--purple-primary);
    margin-bottom: 12px;
    font-family: var(--font-sans);
}

/* --- Folder Tree --- */
.folder-tree {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-code);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    white-space: pre;
    line-height: 1.8;
}

.folder-tree .dir { color: var(--blue-primary); }
.folder-tree .file { color: var(--text-primary); }

/* --- Project List --- */
.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.project-item:hover {
    border-color: var(--purple-dim);
    background: var(--bg-card-hover);
}

.project-title {
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.project-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* --- Footer --- */
.footer {
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    text-align: center;
}

.footer-content {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-sep {
    margin: 0 12px;
    color: var(--border-accent);
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .nav-bar { padding: 0 12px; }
    .main-content { padding: 12px; }
    .nav-links { display: none; }
}
