:root {
    /* Gradient / Vibrant Dark Theme */
    --primary: #8B5CF6;
    /* Violet */
    --primary-hover: #7C3AED;
    --secondary: #EC4899;
    /* Pink */
    --accent: #14B8A6;
    /* Teal */

    --background: #0F172A;
    /* Slate 900 */
    --surface: #1E293B;
    /* Slate 800 */
    --surface-hover: #334155;

    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;

    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(139, 92, 246, 0.2);

    --text-main: #F8FAFC;
    --text-muted: #94A3B8;

    --radius-lg: 16px;
    --radius-md: 8px;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
}

.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.1), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.05), transparent 40%);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.app-layout {
    display: flex;
    height: 100vh;
    padding: 1rem;
    gap: 1.5rem;
}

/* Sidebar */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.project-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
    margin-right: -0.5rem;
    padding-right: 0.5rem;
}

.project-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.project-item.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: #fff;
}

.project-item-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.project-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
}

/* Workspace */
.workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
    border-radius: var(--radius-lg);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    opacity: 0.5;
    margin-bottom: 1rem;
    filter: grayscale(1);
}

/* Project View */
.project-header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.invisible-input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
}

.h2-input {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.p-input {
    font-size: 1rem;
}

.invisible-input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.project-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    flex-grow: 1;
    align-items: start;
}

/* Versions List */
.version-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.version-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

.version-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.version-card.active {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.v-tag {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
}

.v-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.v-msg {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #fff;
}

.v-metrics {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
}

.v-metric {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: var(--text-muted);
}

/* Editor Col */
.editor-col {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.1rem;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 0.25rem;
    cursor: pointer;
    position: relative;
}

.tab:after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transition: 0.2s;
}

.tab:hover {
    color: #fff;
}

.tab.active {
    color: #fff;
}

.tab.active:after {
    transform: scaleX(1);
}

.tab-pane {
    display: none;
    flex-grow: 1;
    flex-direction: column;
}

.tab-pane.active {
    display: flex;
}

.prompt-area {
    flex-grow: 1;
    resize: none;
    background: #0B1120;
    min-height: 300px;
    line-height: 1.5;
    padding: 1.25rem;
}

/* Metrics */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.metric-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
}

.metric-card label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* Diff Viewer */
.diff-viewer {
    background: #0B1120;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 300px;
    white-space: pre-wrap;
}

.diff-viewer del {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    text-decoration: none;
}

.diff-viewer ins {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    text-decoration: none;
}

/* Utilities */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.ml-3 {
    margin-left: 1rem;
}

.py-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.full-width {
    width: 100%;
}

.text-muted {
    color: var(--text-muted);
}

.text-error {
    color: var(--error);
}

.text-sm {
    font-size: 0.85rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-mono {
    font-family: 'Fira Code', monospace;
}

.inline {
    display: inline-flex;
    align-items: center;
}

.inline-auto {
    width: auto;
}

.badge {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'Fira Code', monospace;
}

/* Forms */
.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.input-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-radius: var(--radius-md);
    outline: none;
    transition: 0.2s;
    font-size: 0.95rem;
}

.input-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.input-control.small {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn.small {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.outline-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.outline-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn:hover {
    color: #fff;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 600px;
    max-width: 90%;
    padding: 2rem;
}

@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
        overflow: auto;
        height: auto;
    }

    .sidebar {
        width: 100%;
    }

    .project-content {
        grid-template-columns: 1fr;
    }

    .editor-col {
        min-height: 500px;
    }
}