/**
 * Video Downloader Styles
 * App-specific styles for dl.johnsen.ai
 * Design system loaded from https://johnsen.ai/assets/css/
 * @version 3.0.0
 */

/* ==========================================================================
   APP THEME - Using main site design system
   ========================================================================== */

.app-video {
    /* Use blue accent for video/download app */
    --app-accent: var(--color-blue-600);
    --app-accent-light: var(--color-blue-400);
    --app-accent-dark: var(--color-blue-700);
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.app-video {
    background: var(--bg-primary);
    min-height: 100vh;
}

.video-main {
    padding-top: var(--spacing-lg);
}

.video-container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* ==========================================================================
   VIDEO HEADER
   ========================================================================== */

.video-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.video-header__title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.video-header__subtitle {
    color: var(--text-secondary);
    font-size: var(--font-size-md);
}

/* ==========================================================================
   FORM SECTION
   ========================================================================== */

.form-section {
    margin-bottom: var(--spacing-xl);
}

.download-form {
    width: 100%;
}

.input-group {
    display: flex;
    gap: var(--spacing-sm);
}

.url-input {
    flex: 1;
    padding: var(--spacing-md);
    font-size: var(--font-size-md);
    font-family: var(--font-family-base);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.url-input:focus {
    border-color: var(--app-accent);
    box-shadow: var(--shadow-focus);
}

.url-input::placeholder {
    color: var(--text-muted);
}

.submit-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-base);
    background: var(--color-interactive-primary);
    color: var(--color-interactive-primary-text);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.submit-btn:hover:not(:disabled) {
    background: var(--color-interactive-primary-hover);
}

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

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.form-error {
    margin-top: var(--spacing-sm);
    color: var(--color-error);
    font-size: var(--font-size-sm);
}

/* ==========================================================================
   STORAGE SECTION
   ========================================================================== */

.storage-section {
    margin-bottom: var(--spacing-lg);
}

.storage-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.storage-bar__fill {
    height: 100%;
    background: var(--app-accent);
    border-radius: var(--radius-sm);
    transition: width var(--transition-normal);
    width: 0%;
}

.storage-bar__fill--warning {
    background: var(--color-warning);
}

.storage-bar__fill--critical {
    background: var(--color-error);
}

.storage-text {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-align: center;
}

/* ==========================================================================
   SECTION TITLES
   ========================================================================== */

.section-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   DOWNLOAD CARD
   ========================================================================== */

.download-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.download-card--active {
    border-color: var(--app-accent);
}

.download-card--mine {
    border-color: var(--color-success);
}

.download-card__header {
    margin-bottom: var(--spacing-md);
}

.download-card__title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    word-break: break-word;
}

.download-card__meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: var(--spacing-sm);
}

/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--app-accent);
    border-radius: var(--radius-sm);
    transition: width var(--transition-normal);
    width: 0%;
}

/* ==========================================================================
   QUEUE & COMPLETED LISTS
   ========================================================================== */

.queue-list,
.completed-list {
    list-style: none;
}

.queue-item,
.completed-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-item__position {
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
}

.queue-item__time {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* ==========================================================================
   COMPLETED ITEM
   ========================================================================== */

.completed-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.completed-item__info {
    width: 100%;
}

.completed-item__title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    word-break: break-word;
    margin-bottom: var(--spacing-xs);
}

.completed-item__meta {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    display: flex;
    gap: var(--spacing-md);
}

.completed-item__actions {
    width: 100%;
    display: flex;
    gap: var(--spacing-sm);
}

.completed-item__source {
    width: 100%;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.completed-item__source-title {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
    word-break: break-word;
}

.completed-item__source-url {
    font-size: var(--font-size-xs);
    color: var(--color-text-link);
    text-decoration: none;
    word-break: break-all;
    display: block;
}

.completed-item__source-url:hover {
    color: var(--color-text-link-hover);
    text-decoration: underline;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.download-btn {
    flex: 1;
    display: block;
    padding: var(--spacing-md);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-base);
    background: var(--color-success);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.download-btn:hover {
    opacity: 0.9;
}

.delete-btn {
    padding: var(--spacing-md);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-base);
    background: transparent;
    color: var(--color-error);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.delete-btn:hover {
    background: var(--color-error);
    color: white;
}

/* ==========================================================================
   STATUS BADGES
   ========================================================================== */

.status-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.status-badge--queued {
    background: var(--color-warning);
    color: black;
}

.status-badge--downloading {
    background: var(--app-accent);
    color: white;
}

.status-badge--complete {
    background: var(--color-success);
    color: white;
}

.status-badge--failed {
    background: var(--color-error);
    color: white;
}

/* ==========================================================================
   SECTIONS
   ========================================================================== */

.active-section,
.queue-section,
.my-download-section,
.completed-section {
    margin-bottom: var(--spacing-xl);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.video-footer {
    text-align: center;
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.video-footer p {
    margin-bottom: var(--spacing-sm);
}

.video-footer a {
    color: var(--color-text-link);
    text-decoration: none;
}

.video-footer a:hover {
    color: var(--color-text-link-hover);
    text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 480px) {
    .video-container {
        padding: var(--spacing-md);
    }

    .input-group {
        flex-direction: column;
    }

    .submit-btn {
        width: 100%;
    }

    .download-card__meta {
        flex-wrap: wrap;
    }
}
