/* Global Upload Tray Styles */
.upload-tray-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 360px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1050; /* Above most elements but below modals */
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), height 0.3s ease;
}

.upload-tray-container.visible {
    display: flex;
    animation: slideUpTray 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpTray {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Header */
.upload-tray-header {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.upload-tray-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
}

.upload-tray-title i {
    color: #3b82f6;
}

.upload-tray-actions {
    display: flex;
    gap: 8px;
}

.upload-tray-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-tray-btn:hover {
    color: #334155;
    background: rgba(0, 0, 0, 0.05);
}

/* Body */
.upload-tray-body {
    max-height: 300px;
    overflow-y: auto;
    background: transparent;
    transition: max-height 0.3s ease;
    padding: 0;
}

.upload-tray-container.minimized .upload-tray-body {
    max-height: 0;
    display: none;
}

.upload-tray-container.minimized {
    width: 280px;
}

/* Upload Progress Item */
.upload-progress-item {
    padding: 16px 18px;
}

.upload-progress-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: #475569;
}

.upload-progress-completed {
    font-weight: 600;
    color: #10b981;
}

.upload-progress-in-progress {
    color: #3b82f6;
}

.upload-progress-error {
    color: #ef4444;
}

.upload-progress-bar {
    height: 6px !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-radius: 3px !important;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.upload-tray-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

/* Minimized Floating Button */
.upload-tray-minimized-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1040;
    transition: transform 0.2s ease;
    border: 1px solid rgba(0,0,0,0.05);
}

.upload-tray-minimized-btn:hover {
    transform: scale(1.1);
}

.upload-tray-minimized-btn.visible {
    display: flex;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Active Upload Animation */
.upload-tray-minimized-btn.upload-active {
    border: 2px solid transparent;
    background-clip: padding-box;
}

.upload-tray-minimized-btn.upload-active::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0%, #3b82f6 50%, transparent 100%);
    z-index: -1;
    animation: spinBorder 2s linear infinite;
}

.upload-tray-minimized-btn.upload-active::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border-radius: 50%;
    background: white;
    z-index: -1;
}

@keyframes spinBorder {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.upload-tray-minimized-btn i {
    font-size: 1.5rem;
    color: #3b82f6;
}

.upload-tray-minimized-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid white;
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Resume Prompt inside Tray */
.upload-resume-prompt {
    padding: 20px;
    text-align: center;
}

.upload-resume-icon {
    font-size: 2.5rem;
    color: #3b82f6;
    margin-bottom: 12px;
    opacity: 0.9;
}

.upload-resume-text {
    font-size: 0.95rem;
    color: #334155;
    margin-bottom: 16px;
    line-height: 1.5;
}

.upload-resume-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Tray Footer Actions */
.upload-tray-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.3);
}

.upload-tray-footer-left {
    font-size: 0.8rem;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s;
}

.upload-tray-footer-left:hover {
    color: #3b82f6;
}

.upload-tray-footer-actions {
    display: flex;
    gap: 8px;
}

.btn-tray-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.05);
    background: rgba(255,255,255,0.5);
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-tray-action:hover {
    background: white;
    color: #3b82f6;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-tray-action.danger:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ===== Upload Details Modal ===== */
.upload-details-modal {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.upload-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.upload-details-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-details-title i {
    font-size: 1.5rem;
    color: #3b82f6;
}

.upload-details-title h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

.upload-details-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-upload-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-upload-action.pause {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.btn-upload-action.pause:hover {
    background: rgba(59, 130, 246, 0.2);
}

.btn-upload-action.cancel {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-upload-action.cancel:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-close-modal {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-modal:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

/* Stats Bar */
.upload-stats-bar {
    padding: 16px 24px;
    background: rgba(248, 250, 252, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.upload-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.upload-stat-box {
    padding: 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    text-align: center;
}

.upload-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.upload-stat-value.highlight {
    color: #3b82f6;
}

/* Modal Body */
.upload-details-body {
    padding: 0;
    max-height: 500px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.3);
}

.upload-file-list {
    display: flex;
    flex-direction: column;
}

.upload-modal-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.upload-modal-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.upload-modal-empty p {
    margin: 0;
    font-size: 1rem;
}

/* Upload Sections */
.upload-section {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.upload-section:last-child {
    border-bottom: none;
}

.upload-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(248, 250, 252, 0.8);
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.upload-section-header i {
    color: #3b82f6;
}

.upload-section-header.error i {
    color: #ef4444;
}

.upload-section-list {
    display: flex;
    flex-direction: column;
}

/* Upload File Item */
.upload-file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: background 0.2s ease;
    position: relative;
}

.upload-file-item:hover {
    background: rgba(255, 255, 255, 0.6);
}

.upload-file-item:last-child {
    border-bottom: none;
}

.upload-file-index {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #3b82f6;
    flex-shrink: 0;
}

.upload-file-item.completed .upload-file-index {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.upload-file-item.error .upload-file-index {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.upload-file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.upload-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.upload-file-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-file-progress {
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}

.upload-file-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.2s ease;
}

.upload-file-error {
    font-size: 0.75rem;
    color: #ef4444;
}

.upload-file-size {
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
    text-align: right;
}

.upload-file-cancel {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0;
}

.upload-file-item:hover .upload-file-cancel {
    opacity: 1;
}

.upload-file-cancel:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Mobile Responsiveness */
@media (max-width: 576px) {
    .upload-tray-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
    }
    
    .upload-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .upload-file-size {
        display: none;
    }
}
