/* ═══════════════════════════════════════════════════════════════════════════
   XFS Manager — File Manager Styles (MEGA.nz dual view)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Breadcrumb ─── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    flex-wrap: wrap;
}
.crumb {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
}
.crumb:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.crumb i { font-size: 16px; }
.crumb-sep {
    color: var(--text-muted);
    font-size: var(--fs-xs);
}
.crumb:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

/* ─── Files Grid View ─── */
.files-container {
    min-height: 300px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--sp-3);
}

.file-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--sp-4) var(--sp-3);
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    overflow: hidden;
}
.file-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.file-card.selected {
    border-color: var(--accent-primary);
    background: var(--accent-primary-muted);
    box-shadow: 0 0 0 2px var(--accent-primary-muted);
}
.file-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.file-card-check {
    position: absolute;
    top: var(--sp-2);
    left: var(--sp-2);
    width: 20px; height: 20px;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.file-card:hover .file-card-check,
.file-card.selected .file-card-check {
    opacity: 1;
}
.file-card.selected .file-card-check {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.file-card-star {
    position: absolute;
    top: var(--sp-2);
    right: var(--sp-2);
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0;
    transition: all var(--transition-fast);
}
.file-card:hover .file-card-star,
.file-card-star.active {
    opacity: 1;
}
.file-card-star.active {
    color: var(--warning);
}

.file-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 28px;
    margin-bottom: var(--sp-3);
    transition: all var(--transition-base);
}

/* File type colors */
.file-icon.folder  { background: rgba(99, 102, 241, 0.15); color: #6366f1; }
.file-icon.video   { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.file-icon.audio   { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.file-icon.archive { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.file-icon.image   { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.file-icon.document{ background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.file-icon.default { background: var(--bg-tertiary); color: var(--text-tertiary); }

.file-card .file-name {
    font-size: var(--fs-xs);
    font-weight: 500;
    text-align: center;
    color: var(--text-primary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.file-card .file-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: var(--sp-1);
}

/* ─── Files List View ─── */
.files-list {
    display: flex;
    flex-direction: column;
}

.file-row {
    display: grid;
    grid-template-columns: 32px 1fr 100px 120px 80px;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}
.file-row:hover {
    background: var(--bg-hover);
}
.file-row.selected {
    background: var(--accent-primary-muted);
}

.file-row-header {
    color: var(--text-tertiary);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: default;
    border-bottom: 1px solid var(--border-primary);
}
.file-row-header:hover {
    background: transparent;
}

.file-row-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.file-row-icon.folder  { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.file-row-icon.video   { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.file-row-icon.audio   { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.file-row-icon.archive { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.file-row-icon.image   { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.file-row-icon.document{ background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.file-row-icon.default { background: var(--bg-tertiary); color: var(--text-tertiary); }

.file-row-name {
    font-size: var(--fs-sm);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-row-size {
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}
.file-row-date {
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
}
.file-row-source {
    font-size: var(--fs-xs);
}

/* ─── Selection Bar ─── */
.selection-bar {
    position: fixed;
    bottom: var(--sp-5);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 100;
    backdrop-filter: blur(12px);
}
.selection-count {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--accent-primary);
}
.selection-actions {
    display: flex;
    gap: var(--sp-1);
}

/* ─── Downloads List ─── */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.dl-item {
    display: grid;
    grid-template-columns: 1fr 100px 100px 120px;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--gradient-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}
.dl-item:hover {
    border-color: var(--border-hover);
}
.dl-name {
    font-size: var(--fs-sm);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dl-url {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dl-progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: var(--sp-1);
}
.dl-progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}
.dl-error {
    font-size: 10px;
    color: var(--danger, #ef4444);
    margin-top: var(--sp-1);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dl-item.error-glow {
    border-color: rgba(239, 68, 68, 0.35);
}
.btn-retry {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent, #3b82f6);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px 8px;
    font-size: 14px;
    transition: all var(--transition-fast);
}
.btn-retry:hover { background: rgba(59, 130, 246, 0.3); }
.btn-cancel {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger, #ef4444);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px 8px;
    font-size: 14px;
    transition: all var(--transition-fast);
}
.btn-cancel:hover { background: rgba(239, 68, 68, 0.3); }

/* ─── Status dots (colored circles like the Telegram bot) ─── */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}
.status-dot.dot-done       { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.status-dot.dot-error      { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
.status-dot.dot-downloading { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.5); animation: dot-pulse 1.5s ease-in-out infinite; }
.status-dot.dot-uploading  { background: #a855f7; box-shadow: 0 0 6px rgba(168, 85, 247, 0.5); animation: dot-pulse 1.5s ease-in-out infinite; }
.status-dot.dot-queued     { background: #9ca3af; box-shadow: 0 0 4px rgba(156, 163, 175, 0.3); }
.status-dot.dot-resolving  { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); animation: dot-pulse 1.5s ease-in-out infinite; }
@keyframes dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ─── Scraper Grid ─── */
.scraper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--sp-4);
}
.scraper-card {
    display: flex;
    flex-direction: column;
    background: var(--gradient-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}
.scraper-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.scraper-cover {
    height: 140px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.scraper-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.scraper-cover i {
    font-size: 40px;
    color: var(--text-muted);
}
.scraper-info {
    padding: var(--sp-3) var(--sp-4);
    flex: 1;
}
.scraper-title {
    font-size: var(--fs-sm);
    font-weight: 600;
    margin-bottom: var(--sp-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.scraper-detail {
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--sp-1);
}
.scraper-site {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}
.scraper-site.foresta  { background: var(--success-muted); color: var(--success); }
.scraper-site.hditalia { background: var(--accent-secondary-muted); color: var(--accent-secondary); }
.scraper-links {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: var(--sp-2);
}

/* ─── Drag & Drop overlay ─── */
.drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(99, 102, 241, 0.1);
    border: 3px dashed var(--accent-primary);
    border-radius: var(--radius-lg);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
}
.drop-overlay.active {
    display: flex;
}
.drop-overlay-text {
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--accent-primary);
}
