@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.upload-zone {
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.upload-zone:hover {
    animation: none;
    transform: scale(1.02);
}

.progress-bar {
    transition: width 0.3s ease;
}

/* Grid 容器 - 讓所有卡片等高 */
#fileList {
    align-items: stretch !important;
}

#fileList > * {
    display: flex !important;
}

/* 空狀態文字置中 */
#fileList > .col-span-full {
    grid-column: 1 / -1 !important;
    display: block !important;
    text-align: center !important;
}

.file-card {
    transition: all 0.3s ease;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 340px !important;
    padding: 0.75rem !important;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

/* 預覽區域統一高度，保持比例 */
.preview-container {
    flex-shrink: 0 !important;
    overflow: hidden !important;
    height: 180px !important;
    width: 100% !important;
    background: #f3f4f6;
    border-radius: 0.5rem;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 0.5rem !important;
}

.preview-container img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 0.5rem;
}

.preview-container video {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 0.5rem;
}

.preview-container > div {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.preview-image {
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.05);
}

/* 檔案資訊區域 - 自動增長填充空間 */
.file-info-section {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 80px !important;
}

/* 檔案標題和狀態區域 - 固定高度 */
.file-info-section > .flex {
    flex-shrink: 0 !important;
    min-height: 50px !important;
    margin-bottom: 0.25rem !important;
}

/* 按鈕區域固定在底部 */
.file-actions-section {
    margin-top: auto !important;
    flex-shrink: 0 !important;
    min-height: 36px !important;
    display: flex !important;
    align-items: flex-end !important;
    padding-top: 0.25rem !important;
}

.file-actions-section > * {
    width: 100% !important;
}

.file-actions-section .grid {
    width: 100% !important;
}

.preview-image {
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.1);
}

@keyframes slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification {
    animation: slide-in 0.3s ease forwards;
}

.file-progress {
    transition: width 0.3s ease-in-out;
}

/* 固定的按鈕樣式 - 確保所有按鈕完全一致 */
.file-action-btn,
button.file-action-btn,
a.file-action-btn,
.grid .file-action-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 0 12px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    border: 1px solid !important;
    border-radius: 6px !important;
    background-color: white !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.file-action-btn:hover,
button.file-action-btn:hover,
a.file-action-btn:hover {
    text-decoration: none !important;
}

.file-action-btn.view-btn,
button.file-action-btn.view-btn,
a.file-action-btn.view-btn {
    color: #2563eb !important;
    border-color: #93c5fd !important;
}

.file-action-btn.view-btn:hover,
button.file-action-btn.view-btn:hover,
a.file-action-btn.view-btn:hover {
    background-color: #dbeafe !important;
    color: #1d4ed8 !important;
}

.file-action-btn.download-btn,
button.file-action-btn.download-btn,
a.file-action-btn.download-btn {
    color: #16a34a !important;
    border-color: #86efac !important;
}

.file-action-btn.download-btn:hover,
button.file-action-btn.download-btn:hover,
a.file-action-btn.download-btn:hover {
    background-color: #dcfce7 !important;
    color: #15803d !important;
}

.file-action-btn.delete-btn,
button.file-action-btn.delete-btn {
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

.file-action-btn.delete-btn:hover,
button.file-action-btn.delete-btn:hover {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
}

/* 重試按鈕樣式 */
.file-action-btn.retry-btn,
button.file-action-btn.retry-btn {
    color: #ea580c !important;
    border-color: #fdba74 !important;
}

.file-action-btn.retry-btn:hover,
button.file-action-btn.retry-btn:hover {
    background-color: #fff7ed !important;
    color: #c2410c !important;
}

.status-badge {
    transition: all 0.3s ease;
}

/* 手機優化樣式 */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem !important;
    }
    
    /* 確保觸控目標至少48px */
    button, input[type="file"], .upload-zone {
        min-height: 48px;
        touch-action: manipulation;
    }
    
    /* 防止雙擊縮放 */
    * {
        touch-action: pan-x pan-y;
    }
    
    /* 上傳區域手機優化 */
    .upload-zone {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* 檔案卡片手機優化 */
    .file-card {
        margin-bottom: 0.75rem;
    }
    
    /* 通知在手機上保持右下角 */
    #notifications {
        bottom: 1rem !important;
        right: 1rem !important;
        left: auto !important;
        max-width: calc(100vw - 2rem) !important;
        z-index: 9999 !important;
    }
}

/* 手機上的觸控反饋 */
@media (hover: none) and (pointer: coarse) {
    button:active, .upload-zone:active {
        background-color: rgba(59, 130, 246, 0.1);
        transform: scale(0.98);
    }
}

/* 進度條細條樣式 */
.progress-container {
    background-color: #E5E7EB;
    border-radius: 0.25rem;
    overflow: hidden;
    height: 0.5rem; /* 細條 */
    transition: all 0.3s ease;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #1D4ED8);
    border-radius: 0.25rem;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}