:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-accent: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #707070;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --border-color: #333333;
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr 380px;
    grid-template-rows: 60px 1fr;
    grid-template-areas:
        "header header header"
        "sidebar main preview";
    height: 100vh;
    width: 100vw;
}

/* Header */
.header {
    grid-area: header;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 12px;
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Main Content */
.main-content {
    grid-area: main;
    background: var(--bg-primary);
    overflow-y: auto;
    padding: 24px;
}

/* Preview Panel */
.preview-panel {
    grid-area: preview;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.preview-panel.full-width {
    grid-column: 1 / -1;
    grid-row: 2 / 3;
    width: 100%;
    max-width: 100%;
    position: fixed;
    top: 60px;  
    right: 0;
    bottom: 0;  
    z-index: 200;
    box-shadow: var(--shadow-lg);
}

.preview-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-content {
    flex: 1;
    position: relative;
    background: #000;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-accent);
    border-color: var(--accent-blue);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Input Components */
.input-group {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.input-field {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.textarea-field {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

/* Feature Checklist */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.feature-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.feature-item:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-item.selected {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
}

.feature-item.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--accent-blue);
    font-weight: bold;
}

.feature-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.feature-description {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Progress Tracking */
.progress-tracker {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.progress-stages {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.progress-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.progress-stage:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    z-index: -1;
}

.progress-stage.completed::after {
    background: var(--accent-green);
}

.progress-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.progress-stage.active .progress-indicator {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    animation: pulse 2s infinite;
}

.progress-stage.completed .progress-indicator {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.progress-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Agent Tasks */
.agent-tasks {
    display: grid;
    gap: 12px;
}

.agent-task {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.agent-task.running {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.agent-task.completed {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
}

.agent-task.failed {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.agent-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.agent-info {
    flex: 1;
}

.agent-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.agent-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.agent-progress {
    width: 60px;
    height: 4px;
    background: var(--bg-accent);
    border-radius: 2px;
    overflow: hidden;
}

.agent-progress-bar {
    height: 100%;
    background: var(--accent-blue);
    transition: width 0.3s ease;
}

/* Console Output */
.console {
    background: #000;
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    overflow-y: auto;
}

.console-line {
    margin-bottom: 4px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.console-timestamp {
    color: var(--text-muted);
    flex-shrink: 0;
}

.console-level {
    font-weight: bold;
    flex-shrink: 0;
    width: 60px;
}

.console-level.info { color: var(--accent-blue); }
.console-level.success { color: var(--accent-green); }
.console-level.warning { color: var(--accent-yellow); }
.console-level.error { color: var(--accent-red); }

.console-message {
    flex: 1;
    word-break: break-word;
}

/* Review Output */
.review-panel {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.review-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.review-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.review-severity {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.review-severity.critical { background: var(--accent-red); }
.review-severity.warning { background: var(--accent-yellow); }
.review-severity.info { background: var(--accent-blue); }
.review-severity.success { background: var(--accent-green); }

.review-content {
    flex: 1;
}

.review-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.review-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: calc(50% - 100px);
    left: calc(50% - 100px);
    z-index: 3000;
    width: 300px;
    height: 200px;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    backdrop-filter: blur(5px);
}

.sidebar-section:has(.loading-spinner) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4facfe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    .sidebar,
    .preview-panel {
        display: none;
    }

    .sidebar.mobile-open {
        display: block;
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 200;
        box-shadow: var(--shadow-lg);
    }

    .preview-panel.mobile-open {
        display: flex;
        position: fixed;
        top: 60px;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 400px;
        z-index: 200;
        box-shadow: var(--shadow-lg);
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .main-content {
        max-width: 100%;
    }

    .header-actions .btn span+span {
        display: none;
    }
}

@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .progress-stage::after {
        display: none;
    }

    .main-content {
        padding: 16px;
    }
}

/* Utility Classes */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 18px; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mobile-menu-btn { display: none; }