:root {
    --primary: #3b82f6; /* 科技化藍色 */
    --primary-hover: #2563eb;
    --bg-color: #0f172a; /* 深淵黑背景 */
    --card-bg: rgba(30, 41, 59, 0.85); /* 毛玻璃透明黑 */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 30px;
    overflow-x: hidden;
}

/* 擴增 Container 寬度迎合檔案總管 */
.explorer-container {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
    width: 100%;
    max-width: 900px;
    height: 85vh; /* 佔據螢幕多數 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative; /* 給浮動選單定位靠齊 */
}

/* 頂部工具列 */
.explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid var(--border);
}

.breadcrumb {
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 500;
    flex-wrap: wrap;
    gap: 4px;
}

.breadcrumb-item {
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}

.breadcrumb-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.breadcrumb-item.home-item {
    font-size: 16px;
}

.breadcrumb-separator {
    color: var(--border);
}

.toolbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.auth-box-sm {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.auth-box-sm svg {
    color: var(--text-muted);
}

.auth-box-sm input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    width: 80px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.upload-action-btn {
    background: var(--primary);
    border-color: var(--primary);
}

.upload-action-btn:hover {
    background: var(--primary-hover);
}

/* 主工作區 (圖庫區) */
.gallery-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

.gallery-area::-webkit-scrollbar { width: 8px; }
.gallery-area::-webkit-scrollbar-track { background: transparent; }
.gallery-area::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }
.gallery-area::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding-bottom: 20px;
}

/* 圖片卡片與資料夾卡片 */
.gallery-card {
    position: relative;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
    user-select: none;
    cursor: pointer;
}

.gallery-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* 多選框 (隱藏於預設，Hover或選取時顯示) */
.checkbox-container {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, border-color 0.2s;
}

.check-icon {
    color: white;
    opacity: 0;
    transform: scale(0.5);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s;
}

.gallery-card:hover .checkbox-container {
    opacity: 1;
}

.gallery-card.selected {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 0 2px var(--primary);
}

.gallery-card.selected .checkbox-container {
    opacity: 1;
    background: var(--primary);
    border-color: var(--primary);
}

.gallery-card.selected .check-icon {
    opacity: 1;
    transform: scale(1);
}

/* 內部佈局 */
.gallery-img-wrapper {
    width: 100%;
    height: 120px;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s;
}

.folder-wrapper {
    background: rgba(255, 255, 255, 0.02);
}

.folder-icon {
    color: var(--primary);
}

.gallery-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gallery-name {
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.folder-name {
    text-align: center;
    margin-bottom: 0;
}

.gallery-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.gallery-action-group {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.copy-btn.copy-sm {
    padding: 6px 0;
    flex: 1;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn.copy-sm:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-btn.copied {
    background: var(--success) !important;
}

/* 訊息與空狀態 */
.gallery-message {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state svg {
    color: var(--border);
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 13px;
    color: var(--primary);
    opacity: 0.8;
}

/* 全螢幕拖曳 Overlay */
.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 4px dashed var(--primary);
}

.drag-content {
    text-align: center;
    color: var(--primary);
    pointer-events: none;
}

.drag-content h2 {
    font-size: 28px;
    font-weight: 600;
    color: white;
    margin-top: 20px;
    margin-bottom: 8px;
}

.drag-content p {
    font-size: 16px;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* 上傳進度 Toast */
.upload-progress-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 999;
    min-width: 300px;
}

.toast-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast-content span {
    font-size: 14px;
    font-weight: 500;
    display: block;
    text-align: center;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* 浮動批次操作列 (Action Bar) */
.selection-action-bar {
    position: absolute;
    bottom: -80px; /* 初始隱藏在框外 */
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    padding: 12px 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 100;
    transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.selection-action-bar.show {
    bottom: 0px;
}

.action-info {
    font-size: 14px;
    color: var(--text-muted);
}

.action-info span {
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.batch-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.batch-btn:active {
    transform: scale(0.95);
}

.move-btn {
    background: var(--primary);
    color: white;
}

.move-btn:hover {
    background: var(--primary-hover);
}

.del-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.del-btn:hover {
    background: #ef4444;
    color: white;
}

.cancel-btn {
    background: transparent;
    color: var(--text-muted);
}

.cancel-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}
