/* App-specific styles — built on top of Slate UI */

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* Auth pages centered layout */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
}

/* Table base styles */
table th,
table td {
    text-align: left;
}

table th {
    font-weight: 500;
}

/* ─── Download card expand ─── */
.dl-result-area {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--duration-slow) var(--ease-out);
}

.dl-result-area.open {
    grid-template-rows: 1fr;
}

.dl-result-inner {
    overflow: hidden;
}

.dl-result-inner hr {
    margin-top: var(--space-6);
    margin-bottom: var(--space-4);
}

/* Individual job row */
.dl-job {
    padding: var(--space-4);
    background: var(--surface-0);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
}

.dl-job + .dl-job {
    margin-top: var(--space-2);
}

/* File list items inside a job */
.dl-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    animation: fade-in var(--duration-normal) var(--ease-out) both;
}

.dl-file-item + .dl-file-item {
    margin-top: var(--space-2);
}

/* Per-job remove button */
.dl-job-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--duration-normal), background var(--duration-fast), color var(--duration-fast);
}

.dl-job:hover .dl-job-remove,
.dl-job-remove:focus-visible {
    opacity: 1;
}

.dl-job-remove:hover {
    background: var(--surface-2);
    color: var(--text-danger, var(--slate-danger));
}

/* Slide-out animation for individual removal */
@keyframes slide-out {
    to {
        opacity: 0;
        transform: translateX(30px);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 0;
        overflow: hidden;
    }
}

.animate-slide-out {
    animation: slide-out .25s var(--ease-out) forwards;
}

/* Expired link inline */
.dl-link-expired {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* Download ready link pulse */
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(110, 148, 119, 0); }
    50%      { box-shadow: 0 0 12px 2px rgba(110, 148, 119, 0.25); }
}

.dl-ready-link {
    animation: glow-pulse 2s var(--ease-out) 1;
}

/* ─── Slots indicator ─── */
.slots-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--surface-0);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
}

.slots-dots {
    display: flex;
    gap: 5px;
}

.slot-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border-color, rgba(255,255,255,.06));
    transition: background var(--duration-fast);
}

.slot-dot.active {
    background: var(--slate-accent);
    border-color: var(--slate-accent);
    box-shadow: 0 0 6px rgba(110, 148, 119, .35);
}

.slots-label {
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.slots-label.slots-full {
    color: var(--slate-warning);
}

/* ─── Hosters grid ─── */
.hosters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: var(--space-2);
}

.hoster-card {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-0);
    border: var(--border-subtle);
    border-radius: var(--radius-md);
    transition: opacity var(--duration-fast);
}

.hoster-card.offline {
    opacity: .45;
}

.hoster-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hoster-dot.online {
    background: var(--slate-success);
    box-shadow: 0 0 5px rgba(110, 148, 119, .4);
}

.hoster-dot.offline {
    background: var(--slate-danger);
}

.hoster-icon {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    flex-shrink: 0;
    object-fit: contain;
}

.hoster-card.offline .hoster-icon {
    opacity: .5;
    filter: grayscale(1);
}

.hoster-name {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hoster-card.offline .hoster-name {
    color: var(--text-muted);
}

/* Responsive nav */
@media (max-width: 768px) {
    nav .container {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    nav .flex.items-center.gap-4 {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .slots-indicator {
        margin-top: var(--space-2);
    }

    .hosters-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
