/* ==============================================
   Upload Sheet Styles
   Bottom sheet drawer for file uploads
   ============================================== */

/* ==============================================
   Upload Sheet Overlay & Container
   ============================================== */

.upload-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-overlay-light);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    z-index: var(--z-nav);
}

.upload-overlay.visible {
    opacity: 1;
    pointer-events: none;
}

.upload-sheet {
    --sheet-bottom: calc(var(--space-3) + var(--sa-bottom));

    display: flex;
    flex-direction: column;
    position: fixed;
    left: 50%;
    bottom: var(--sheet-bottom);
    max-width: 600px;
    width: calc(100% - var(--space-6));
    max-height: 70vh;
    overflow: hidden;

    /* Glassmorphism - matches filter-sheet */
    background: rgba(20, 20, 22, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);

    /* Hidden by default, slides up */
    visibility: hidden;
    transform: translateX(-50%) translateY(calc(100% + var(--sheet-bottom)));
    transition: transform 0.2s ease, visibility 0s 0.2s;
    z-index: calc(var(--z-nav) + 3);
}

.upload-sheet.visible {
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition: transform 0.2s ease, visibility 0s;
}


/* ==============================================
   Upload Sheet Header
   ============================================== */

.upload-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.upload-sheet-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.upload-sheet-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.upload-sheet-close span {
    transform: translateY(-1px);
    display: inline-block;
}

/* Desktop hover */
@media (hover: hover) and (pointer: fine) {
    .upload-sheet-close:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--color-text-primary);
    }
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
    .upload-sheet-close:active {
        background: rgba(255, 255, 255, 0.12);
        transform: scale(0.92);
        transition: transform 0.06s ease-out;
    }
}

.upload-sheet-close:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}


/* ==============================================
   Upload Sheet Content
   ============================================== */

.upload-sheet-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-4);
    -webkit-overflow-scrolling: touch;
}


/* ==============================================
   Placeholder (empty state)
   ============================================== */

.upload-placeholder {
    padding: var(--space-4) var(--space-4);
    text-align: center;
}

.upload-placeholder-icon {
    font-size: 40px;
    color: var(--color-accent);
    margin-bottom: var(--space-3);
    opacity: 0.7;
}

.upload-placeholder-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
}

.upload-placeholder-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    line-height: 1.5;
}


/* ==============================================
   File List
   ============================================== */

.upload-file-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.upload-file-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    transition: background var(--transition-fast);
}

.upload-file-item:hover {
    background: rgba(0, 0, 0, 0.3);
}

.upload-file-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 18px;
}

.upload-file-info {
    flex: 1;
    min-width: 0;
}

.upload-file-name {
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.upload-file-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.upload-file-size {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.upload-file-status {
    font-size: var(--font-size-xs);
}

.upload-file-status.pending {
    color: var(--color-text-muted);
}

.upload-file-status.uploading {
    color: var(--color-accent);
    font-weight: var(--font-weight-medium);
}

.upload-file-status.success {
    color: var(--color-success, #34c759);
}

.upload-file-status.error {
    color: var(--color-error, #ff3b30);
}

.upload-error-clickable {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.upload-error-clickable:hover {
    text-decoration-style: solid;
}


/* ==============================================
   Retry Button (inline in list)
   ============================================== */

.upload-retry-btn {
    font-size: var(--font-size-xs);
    color: var(--color-accent);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.upload-retry-btn:hover {
    color: var(--color-accent-hover, #0066cc);
}


/* ==============================================
   Progress Bar (inline in list)
   ============================================== */

.upload-progress-bar {
    flex: 1;
    max-width: 100px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: var(--radius-full);
    transition: width 0.15s ease;
}




/* ==============================================
   Remove Button
   ============================================== */

.upload-file-remove {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition-fast);
}

.upload-file-item:hover .upload-file-remove,
.upload-file-item:focus-within .upload-file-remove {
    opacity: 1;
}

/* Always show on touch devices */
@media (hover: none) and (pointer: coarse) {
    .upload-file-remove {
        opacity: 1;
    }
}

.upload-file-remove:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}


/* ==============================================
   Upload Sheet Footer
   ============================================== */

.upload-sheet-footer {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4) var(--space-4);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.upload-sheet-footer .core-btn {
    flex: 1;
}


/* ==============================================
   Empty State (when drop zone is shown)
   ============================================== */

.upload-empty {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}


/* ==============================================
   Responsive Adjustments
   ============================================== */

@media (max-width: 480px) {
    .upload-sheet {
        max-height: 80vh;
    }

    .upload-sheet-content {
        padding: var(--space-3);
    }

    .upload-sheet-footer {
        padding: var(--space-3);
    }

    .upload-file-name {
        font-size: var(--font-size-xs);
    }
}

/* Desktop - slightly larger bottom spacing */
@media (min-width: 768px) {
    .upload-sheet {
        --sheet-bottom: calc(var(--space-4) + var(--sa-bottom));
        max-height: 60vh;
    }
}


/* ==============================================
   Reduced Motion Support
   ============================================== */

@media (prefers-reduced-motion: reduce) {
    .upload-sheet,
    .upload-overlay {
        transition: none;
    }
}
