/* 基本變數繼承自 root 或 minimal.css */

/* 遮罩層動畫 */
.file-browser-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-browser-overlay.active {
    display: flex;
    opacity: 1;
}

/* 瀏覽器視窗 */
.file-browser-window {
    width: 900px;
    height: 650px;
    background: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #333;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 標題列 */
.browser-header {
    height: 50px;
    background: #252525;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    user-select: none;
}

.browser-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
}

.browser-close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    transition: all 0.2s;
}

.browser-close-btn:hover {
    background: #c0392b;
    color: white;
}

/* 工具列 */
.browser-toolbar {
    height: 48px;
    background: #2a2a2a;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
}

.toolbar-btn {
    background: #333;
    border: 1px solid #444;
    color: #eee;
    height: 32px;
    min-width: 32px;
    padding: 0 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    /* 修正圖示與文字間距 */
    transition: all 0.2s;
    font-size: 13px;
    line-height: normal;
    /* 確保垂直置中 */
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.toolbar-btn:hover:not(:disabled) {
    background: #444;
    border-color: #555;
    transform: translateY(-1px);
}

.toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 貼上按鈕特殊樣式 */
#pasteBtn {
    background: #e67e22;
    border-color: #d35400;
    color: white;
}

#pasteBtn:hover {
    background: #d35400;
}

/* 麵包屑導航 */
.breadcrumb {
    flex: 1;
    background: #1a1a1a;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    margin-left: 8px;
    overflow-x: auto;
    white-space: nowrap;
    border: 1px solid #333;
    font-size: 13px;
    color: #aaa;
}

.breadcrumb-item {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    color: #3498db;
}

.breadcrumb-item:hover {
    background: rgba(52, 152, 219, 0.1);
    color: #5dade2;
}

.breadcrumb-item.active {
    color: #eee;
    cursor: default;
}

.breadcrumb-separator {
    color: #666;
    margin: 0 4px;
    font-size: 12px;
}

/* Scrollbar styling */
.breadcrumb::-webkit-scrollbar {
    height: 4px;
}

.breadcrumb::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}

/* 檔案列表區域 */
.file-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: #181818;
}

.file-list-header {
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #333;
    font-size: 12px;
    color: #888;
    background: #202020;
    user-select: none;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* 列表欄位 */
.col-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.col-size {
    width: 100px;
    text-align: right;
}

.col-modified {
    width: 150px;
    text-align: right;
    padding-left: 20px;
}

/* 檔案項目 */
.file-item {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #282828;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
    color: #ddd;
}

.file-item:hover {
    background: #2a2a2a;
}

.file-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.is-directory .file-name {
    color: #f1c40f;
    font-weight: 500;
}

.is-file .file-name {
    color: #ecf0f1;
}

/* 狀態 */
.loading-state,
.empty-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    gap: 12px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #333;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.empty-state {
    font-size: 14px;
}

.empty-state p:first-child {
    font-size: 48px;
    margin: 0;
}

.error-state p:first-child {
    font-size: 48px;
    margin: 0;
    color: #e74c3c;
}

.error-msg {
    font-size: 12px;
    color: #e74c3c;
    max-width: 80%;
    text-align: center;
}

/* 底部狀態列 */
.browser-footer {
    height: 30px;
    background: #252525;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 11px;
    color: #666;
}

/* 右鍵選單 Context Menu */
.context-menu {
    position: fixed;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    padding: 4px 0;
    min-width: 160px;
    z-index: 2000;
    display: none;
    animation: fadeIn 0.1s ease;
}

.menu-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #eee;
    transition: background 0.1s;
}

.menu-item:hover {
    background: #3498db;
    color: white;
}

.menu-divider {
    height: 1px;
    background: #444;
    margin: 4px 0;
}

.menu-danger {
    color: #e74c3c;
}

.menu-danger:hover {
    background: #c0392b;
}

/* 圖片預覽模態框 Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.image-modal-caption {
    color: #fff;
    margin-top: 10px;
    font-size: 14px;
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    background: none;
    border: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}