/* === Variables === */
:root {
    /* Colors - Dark theme with cyan accents */
    --bg-primary: #0a0f1c;
    --bg-secondary: #111827;
    --bg-card: #1a2234;
    --bg-hover: #243049;
    --bg-input: #0d1320;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #06b6d4;
    --accent-secondary: #22d3ee;
    --accent-glow: rgba(6, 182, 212, 0.3);
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --border-color: #1e293b;
    --border-light: #334155;
    
    /* Typography */
    --font-primary: 'Outfit', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 80px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(6, 182, 212, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(139, 92, 246, 0.1), transparent);
    pointer-events: none;
    z-index: -1;
}

/* === App Layout === */
.app {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.logo span {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: left;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-btn.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.1));
    color: var(--accent-secondary);
    box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.3);
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === Main Content === */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    padding: 32px 40px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: blur(10px);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.content {
    flex: 1;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-normal);
}

.card:hover {
    border-color: var(--border-light);
}

.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

textarea,
input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: var(--transition-fast);
}

textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea::placeholder,
input[type="text"]::placeholder {
    color: var(--text-muted);
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    padding: 14px 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.input-group input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

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

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-muted);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* === Upload Zone === */
.upload-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    transition: var(--transition-normal);
    cursor: pointer;
    margin-bottom: 20px;
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(6, 182, 212, 0.05);
}

.upload-content svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-content p span {
    color: var(--accent-secondary);
    text-decoration: underline;
    cursor: pointer;
}

.upload-content small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.preview-container {
    position: relative;
    display: inline-block;
}

.preview-container img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.remove-btn:hover {
    transform: scale(1.1);
}

/* === Tab Content === */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Results Section === */
.results-section {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-card {
    border-color: var(--accent-primary);
    box-shadow: 0 0 30px var(--accent-glow);
}

.result-block {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-primary);
}

.result-block:last-child {
    margin-bottom: 0;
}

.result-block h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-block h3 svg {
    width: 18px;
    height: 18px;
}

.result-block ul {
    list-style: none;
    padding: 0;
}

.result-block li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.result-block li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

.result-block p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.result-summary {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(139, 92, 246, 0.1));
    border-left-color: var(--accent-secondary);
}

.result-summary p {
    font-size: 1.05rem;
    color: var(--text-primary);
}

/* Score indicator */
.score-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.score-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-secondary);
    font-family: var(--font-mono);
}

.score-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.score-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Scores container */
.result-scores {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(6, 182, 212, 0.05));
}

.scores-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-item .score-label {
    min-width: 180px;
    font-weight: 500;
    color: var(--text-primary);
}

.score-item .score-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-item .score-number {
    min-width: 45px;
    font-weight: 600;
    color: var(--accent-secondary);
    font-family: var(--font-mono);
}

.animation-potential {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
}

.animation-potential.low {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.animation-potential.medium {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.animation-potential.high {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

/* Parsed content display */
.parsed-content {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.parsed-content .label {
    color: var(--accent-primary);
    font-weight: 500;
}

.parsed-content .value {
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-left: 12px;
}

/* === History === */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.history-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.history-item:hover {
    border-color: var(--border-light);
}

.history-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-secondary);
    margin-bottom: 4px;
}

.history-summary {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* === Loading Overlay === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 28, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

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

.spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* === Responsive === */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .logo span,
    .nav-btn span,
    .sidebar-footer span {
        display: none;
    }
    
    .nav-btn {
        justify-content: center;
        padding: 14px;
    }
    
    .main {
        margin-left: 80px;
    }
    
    .content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
    }
    
    .logo,
    .sidebar-footer {
        display: none;
    }
    
    .nav {
        flex-direction: row;
        padding: 8px;
        justify-content: space-around;
    }
    
    .nav-btn {
        flex-direction: column;
        gap: 4px;
        padding: 12px 8px;
        font-size: 0.7rem;
    }
    
    .nav-btn svg {
        width: 24px;
        height: 24px;
    }
    
    .main {
        margin-left: 0;
        margin-bottom: 80px;
    }
    
    .header {
        padding: 20px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .content {
        padding: 16px;
    }
}

/* === Error State === */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--error);
    display: flex;
    align-items: center;
    gap: 12px;
}

.error-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.status-badge {
    margin-top: 14px;
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.running {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
}

.status-badge.stopped {
    background: rgba(100, 116, 139, 0.2);
    color: #cbd5e1;
}

.results-table-wrapper {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th,
.results-table td {
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    padding: 10px 8px;
}

.results-table th {
    color: var(--accent-secondary);
    font-weight: 600;
}

