/* Tube Archivarix — Styles */

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #252833;
    --text: #e4e6eb;
    --text-muted: #8b8d94;
    --accent: #5b8def;
    --accent-hover: #4a7de0;
    --success: #4caf50;
    --error: #ef5350;
    --warning: #ffa726;
    --border: #2d3040;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}
.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Search form */
.search-form {
    margin-bottom: 1.5rem;
}
.search-row {
    display: flex;
    gap: 0.5rem;
}
#search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
#search-input:focus {
    border-color: var(--accent);
}
#search-input::placeholder {
    color: var(--text-muted);
}
#search-btn {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
#search-btn:hover {
    background: var(--accent-hover);
}
#search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.input-hint {
    display: none;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--accent);
    padding-left: 0.25rem;
}

/* Service indicators */
.services {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}
.service-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}
.service-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}
.service-indicator.pending .dot { background: var(--text-muted); }
.service-indicator.running .dot {
    background: var(--warning);
    animation: pulse 0.8s infinite alternate;
}
.service-indicator.success .dot { background: var(--success); }
.service-indicator.failed .dot { background: var(--error); }

@keyframes pulse {
    from { opacity: 0.5; }
    to   { opacity: 1; }
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}
.count {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Video info */
.video-details {
    display: flex;
    gap: 1.25rem;
}
.video-thumb img {
    max-width: 320px;
    border-radius: 6px;
}
.video-meta h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}
.video-meta dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    font-size: 0.9rem;
}
.video-meta dt {
    color: var(--text-muted);
    font-weight: 500;
}
.video-description {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-alive     { background: rgba(76,175,80,0.15); color: var(--success); }
.status-deleted   { background: rgba(239,83,80,0.15); color: var(--error); }
.status-private   { background: rgba(255,167,38,0.15); color: var(--warning); }
.status-unavailable { background: rgba(255,167,38,0.15); color: var(--warning); }
.status-unknown   { background: rgba(139,141,148,0.15); color: var(--text-muted); }
.status-dead      { background: rgba(239,83,80,0.15); color: var(--error); }

/* Channel info */
.channel-details {
    display: flex;
    gap: 1.25rem;
}
.channel-thumb img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}
.channel-meta h3 { margin-bottom: 0.25rem; }
.channel-handle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.channel-meta dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 0.75rem;
    font-size: 0.9rem;
}
.channel-meta dt { color: var(--text-muted); }

/* Archives table */
.archives-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.archives-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.archives-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(45,48,64,0.5);
}
.archives-table tr:hover td {
    background: rgba(91,141,239,0.05);
}
.archives-table a {
    color: var(--accent);
    text-decoration: none;
}
.archives-table a:hover {
    text-decoration: underline;
}
.archives-table small {
    color: var(--text-muted);
}
.service-cell {
    white-space: nowrap;
}
.date-cell {
    white-space: nowrap;
}

/* Channel videos list */
.channel-videos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}
.channel-video-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: var(--bg);
}
.mini-thumb {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.cv-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.cv-info a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cv-info a:hover { color: var(--accent); }
.cv-info small { color: var(--text-muted); font-size: 0.75rem; }

/* Timing */
.timing {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.75rem;
}

/* Error message */
.error-message {
    background: rgba(239,83,80,0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    padding: 1rem;
    color: var(--error);
    text-align: center;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container { padding: 1rem; }
    .header h1 { font-size: 1.5rem; }
    .search-row { flex-direction: column; }
    .video-details, .channel-details { flex-direction: column; }
    .video-thumb img { max-width: 100%; }
    .archives-table { font-size: 0.8rem; }
    .archives-table th, .archives-table td { padding: 0.4rem 0.5rem; }
    .channel-videos-list { grid-template-columns: 1fr; }
}
