:root {
    --bg-color: #f3f4f6;
    --panel-bg: #ffffff;
    --panel-border: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --gradient: linear-gradient(135deg, #3b82f6, #60a5fa);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(96, 165, 250, 0.05) 0%, transparent 50%);
}

.top-navbar {
    background: #1e40af;
    border-bottom: none;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin-right: auto;
}

.nav-link {
    text-decoration: none;
    color: #cbd5e1;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.app-container {
    display: flex;
    min-height: calc(100vh - 64px);
    padding: 16px;
    gap: 16px;
    align-items: flex-start;
}

.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Sidebar */
.sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: transform 0.3s ease;
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.sidebar-header h2 {
    font-weight: 600;
    font-size: 1.2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.search-box input {
    width: 100%;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.scripts-list {
    flex: 1;
    overflow-y: auto;
}

.script-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.script-item:hover {
    background: #f3f4f6;
}

.script-item.active {
    background: #eff6ff;
    border-left: 3px solid var(--accent);
}

.script-name {
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-all;
}

.script-path {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.top-bar {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.primary-btn {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.primary-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.secondary-btn {
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
}

.secondary-btn:not(:disabled):hover {
    background: #e5e7eb;
}

.content-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Comments Section */
.comments-section {
    padding: 24px;
}

.comments-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

textarea {
    width: 100%;
    min-height: 50px;
    background: #f9fafb;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    outline: none;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--accent);
}

.status-msg {
    margin-left: 12px;
    font-size: 0.85rem;
    color: #10b981;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Terminal Section */
.terminal-section {
    display: flex;
    flex-direction: column;
}

.terminal-header {
    padding: 12px 20px;
    background: #f3f4f6;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.window-controls {
    display: flex;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.red { background: #ef4444; }
.yellow { background: #f59e0b; }
.green { background: #10b981; }

.terminal-body {
    padding: 20px;
    background: #000;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #a3a3a3;
    overflow-y: auto;
    max-height: 800px;
    min-height: 400px;
    white-space: pre-wrap;
}

.log-info { color: #3b82f6; }
.log-success { color: #10b981; }
.log-error { color: #ef4444; }

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Folder View */
.folder {
    margin-bottom: 4px;
}
.folder-header {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.2s;
}
.folder-header:hover {
    background: #f3f4f6;
}
.folder-icon {
    color: #fcd34d;
    font-size: 1.1rem;
}
.folder-content {
    margin-left: 16px;
    border-left: 1px solid var(--panel-border);
    padding-left: 8px;
    display: none;
}
.folder.open > .folder-content {
    display: block;
}
.script-file {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    margin-bottom: 2px;
}
.script-file:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}
.script-file.active {
    background: #eff6ff;
    color: var(--text-primary);
    border-left: 3px solid var(--accent);
}
.file-icon {
    color: #60a5fa;
}

/* Outputs Section */
#outputs-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}
.outputs-gallery {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: 24px;
}
.output-img-card {
    background: #f9fafb;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.output-img-card img, .output-img-card iframe {
    width: 100%;
    height: 800px;
    object-fit: contain;
    background: #ffffff;
    border: none;
}
.output-img-card .img-name {
    padding: 8px;
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.outputs-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.output-file-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f3f4f6;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s;
    border: 1px solid var(--panel-border);
}
.output-file-link:hover {
    background: #e5e7eb;
    border-color: var(--accent);
}

