/* Studio Platform — Terminal-inspired design system */
/* GitHub Dark palette, JetBrains Mono, CLI aesthetic */

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

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-terminal: #0a0e14;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --accent-yellow: #d29922;
    --accent-blue: #58a6ff;
    --accent-cyan: #79c0ff;
    --accent-bright: #7ee787;
    --border-color: #30363d;
    --cursor-color: #3fb950;

    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --line-height: 1.6;
}

html, body {
    height: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(63, 185, 80, 0.3);
    color: var(--text-primary);
}

/* === Terminal Screen === */
.terminal-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-primary);
}

.terminal-content {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

/* === Prompt Lines === */
.prompt-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    min-height: 1.6em;
    opacity: 0;
    animation: fadeInLine 0.3s ease forwards;
}

.prompt-line:nth-child(1) { animation-delay: 0s; }
.prompt-line:nth-child(2) { animation-delay: 0.15s; }
.prompt-line:nth-child(3) { animation-delay: 0.3s; }

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

.prompt-sign {
    color: var(--accent-green);
    font-weight: 500;
    user-select: none;
    flex-shrink: 0;
}

.prompt-text {
    color: var(--text-secondary);
    user-select: none;
    flex-shrink: 0;
}

.prompt-value {
    color: var(--accent-green);
}

.prompt-input {
    flex: 1;
    min-width: 200px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    caret-color: var(--accent-green);
    padding: 0;
    margin: 0;
}

.prompt-input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* === Blinking Cursor === */
.cursor-blink {
    display: inline-block;
    width: 0.6em;
    height: 1.3em;
    background: var(--cursor-color);
    animation: cursorBlink 1s step-end infinite;
    vertical-align: text-bottom;
    flex-shrink: 0;
    opacity: 0.9;
}

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

/* === Status Lines === */
.status-line {
    padding: 0.25rem 0;
    margin: 0.75rem 0;
    opacity: 0;
    animation: fadeInLine 0.3s ease forwards;
}

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

.status-success {
    color: var(--accent-green);
}

.status-error {
    color: var(--accent-red);
}

.status-info {
    color: var(--accent-blue);
}

/* === HTMX Loading === */
.htmx-indicator {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

.dots-loading::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

/* === Footer === */
.terminal-footer {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.version-info {
    color: #6e7681;
    font-size: var(--font-size-sm);
    user-select: none;
}

/* === Dashboard Layout === */
.dashboard-page .terminal-screen {
    justify-content: flex-start;
    padding-top: 2rem;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-content {
    flex: 1;
}

/* Push footer to bottom when content is short */
.dashboard-page .terminal-footer {
    margin-top: auto;
    padding-top: 1.5rem;
}

/* === Dashboard Stats Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    min-height: 80px;
}

.stat-value {
    font-size: var(--font-size-lg);
    color: var(--accent-green);
    font-weight: 500;
}

.stat-label {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-top: 0.25rem;
}

/* === Dashboard Table === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: var(--font-size-sm);
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.data-table tr:hover td {
    background: var(--bg-secondary);
}

/* === Links === */
.terminal-link {
    color: var(--accent-cyan);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.terminal-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent-cyan);
}

/* Channel name link on dashboard — underline on hover */
.channel-link {
    color: var(--accent-green);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-bottom-color 0.15s;
}

.channel-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent-green);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === Pipeline Action Chips === */
.pipeline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pipeline-chip {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    font-size: var(--font-size-sm);
    color: #808080;
    border: 1px solid #30363d;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}

.pipeline-chip:hover {
    color: #E0E0E0;
    border-color: #E0E0E0;
}

a.pipeline-chip:hover {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

/* === Pipeline Stats (system-log style) === */
.pipeline-stats {
    font-size: 12px;
    color: #505050;
    border-top: 1px solid #21262d;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

/* === Footer Links === */
.footer-link {
    color: #808080;
    text-decoration: none;
    transition: color 0.15s;
    margin-left: 0.75rem;
}

.footer-link:hover {
    color: #E0E0E0;
}

/* === YouTube Config Options === */
.yt-option {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0.25rem 0.65rem;
    font-size: var(--font-size-sm);
    color: #808080;
    border: 1px solid #30363d;
    transition: color 0.15s, border-color 0.15s;
    font-family: var(--font-mono);
    background: none;
    user-select: none;
}

.yt-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.yt-option-label {
    cursor: pointer;
}

.yt-option:hover {
    color: #E0E0E0;
    border-color: #E0E0E0;
}

.yt-option input:checked + .yt-option-label {
    color: var(--accent-green);
}

.yt-run-btn {
    color: var(--accent-green);
    border-color: var(--accent-green);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    background: none;
}

.yt-run-btn:hover {
    color: #E0E0E0;
    border-color: #E0E0E0;
}

/* === YouTube Demand Table === */
.yt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    margin: 0.5rem 0;
}

.yt-table th {
    color: #808080;
    font-weight: 500;
    text-align: left;
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
}

.yt-table td {
    padding: 0.45rem 0.4rem;
    border-bottom: 1px solid #21262d;
    vertical-align: middle;
}

.yt-table tbody tr:hover td {
    background: #161b22;
}

.col-rank { width: 2rem; text-align: right; padding-right: 0.6rem !important; }
.col-title { min-width: 220px; }
.col-metric { width: 5.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.col-score { width: 4rem; text-align: right; font-variant-numeric: tabular-nums; }
.col-tier { width: 5rem; text-align: center; }
.col-pub { width: 7rem; }

.yt-link {
    color: #E0E0E0;
    text-decoration: none;
    transition: color 0.15s;
}

.yt-link:hover {
    color: var(--accent-green);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.text-bright {
    color: #E0E0E0;
    font-weight: 500;
}

/* === Tier Badges === */
.tier-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tier-legendary { color: #3fb950; }
.tier-viral { color: #79c0ff; }
.tier-strong { color: #d29922; }
.tier-solid { color: #808080; }
.tier-modest { color: #30363d; }

/* === YouTube Filter Toggle Chips === */
.yt-tog {
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-family: var(--font-mono);
    user-select: none;
    transition: opacity 0.1s;
    opacity: 1;
}

.yt-tog:hover {
    opacity: 0.7;
}

/* === Bracket Input === */
.yt-bracket-input {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.yt-term-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    width: 5rem;
    outline: none;
    padding: 0;
    margin: 0;
    caret-color: var(--accent-green);
}

/* === Limit Chips === */
.yt-lim {
    cursor: pointer;
    color: #808080;
    font-size: var(--font-size-sm);
    font-family: var(--font-mono);
    user-select: none;
    transition: color 0.1s;
}

.yt-lim:hover {
    color: #E0E0E0;
}

/* === YouTube Filter Bar === */
.yt-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.6rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #21262d;
}

.yt-flt {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-family: var(--font-mono);
    user-select: none;
}

.yt-flt input {
    accent-color: var(--accent-green);
    cursor: pointer;
}

.yt-flt-input {
    background: transparent;
    border: 1px solid #30363d;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    padding: 0.1rem 0.3rem;
    width: 5rem;
}

/* === Chip States === */
.chip-active {
    color: #E0E0E0 !important;
    border-color: #E0E0E0 !important;
    cursor: default;
}

.chip-disabled {
    opacity: 0.4;
    cursor: default;
}

.chip-disabled:hover {
    color: #808080 !important;
    border-color: #30363d !important;
}

/* === Research Navigation === */
.research-nav-primary {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #21262d;
    padding-bottom: 0.5rem;
}

.research-nav-link {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: var(--font-size-sm);
    color: #808080;
    text-decoration: none;
    font-family: var(--font-mono);
    border: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.research-nav-link:hover {
    color: #E0E0E0;
    border-color: #30363d;
}

.research-nav-link.research-nav-active {
    color: #E0E0E0;
    border-color: #30363d;
    background: #161b22;
}

.research-nav-secondary {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

.research-nav-sublink {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: var(--font-size-sm);
    color: #808080;
    text-decoration: none;
    font-family: var(--font-mono);
    transition: color 0.15s;
}

.research-nav-sublink:hover {
    color: #E0E0E0;
}

.research-nav-sublink.research-nav-active {
    color: var(--accent-green);
}
