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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

/* 顶部导航 */
.navbar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary {
    background: #667eea;
    color: white;
}
.btn-primary:hover {
    background: #5a6fd6;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-outline {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
}
.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 4px;
}

/* 主容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* 面包屑导航 */
.breadcrumb {
    background: white;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    font-size: 14px;
}

.breadcrumb-item {
    color: #667eea;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.breadcrumb-item:hover {
    background: #eef2ff;
}

.breadcrumb-item.active {
    color: #374151;
    font-weight: 600;
    cursor: default;
}
.breadcrumb-item.active:hover {
    background: transparent;
}

.breadcrumb-separator {
    color: #d1d5db;
    user-select: none;
    font-size: 16px;
}

/* 工具栏 */
.toolbar {
    background: white;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #6b7280;
}

.expires-select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    background: white;
}

.expires-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.current-path {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    word-break: break-all;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 文件列表表格 */
.file-table {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}

.file-table > div {
    overflow: visible;
}

.table-header {
    display: grid;
    grid-template-columns: 44px 1fr 110px 150px 200px;
    padding: 12px 20px;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-items: center;
    min-width: 700px;
}

.table-row {
    display: grid;
    grid-template-columns: 44px 1fr 110px 150px 200px;
    padding: 14px 20px;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
    min-width: 700px;
    position: relative;
    overflow: visible;
}

.table-row:last-child {
    border-bottom: none;
}

.table-row:hover {
    background: #fafbff;
}

.table-row.folder-row {
    cursor: pointer;
    border-left: 3px solid #667eea;
}

.table-row.folder-row:hover {
    background: #eef2ff;
}

.col-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.col-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.col-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
    word-break: break-all;
    min-width: 0;
}

.col-name .folder-name {
    color: #1f2937;
}

.col-name .file-name {
    color: #374151;
}

.col-size {
    font-size: 13px;
    color: #6b7280;
    text-align: right;
    padding-right: 10px;
    white-space: nowrap;
}

.col-date {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
}

.col-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
    position: relative;
    overflow: visible;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-state p {
    font-size: 14px;
    color: #9ca3af;
}

/* 错误提示 */
.error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 14px 20px;
    color: #dc2626;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 下拉菜单 */
.dropdown {
    position: relative;
    display: inline-block;
    overflow: visible;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background: white;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    z-index: 9999;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

/* 桌面端：默认向下展开 */
@media (min-width: 769px) {
    .dropdown-content {
        top: 100%;
        bottom: auto;
        margin-top: 4px;
        margin-bottom: 0;
    }
    
    /* 最后两行向上展开 */
    .table-row:last-child .dropdown-content,
    .table-row:nth-last-child(2) .dropdown-content {
        top: auto;
        bottom: 100%;
        margin-top: 0;
        margin-bottom: 4px;
    }
}

/* 移动端：居中弹出 */
@media (max-width: 768px) {
    .dropdown {
        position: static;
    }
    
    .dropdown-content {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        bottom: auto;
        margin: 0;
        min-width: 140px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }
    
    .dropdown-content.active {
        display: block;
    }
    
    .dropdown:hover .dropdown-content {
        display: none;
    }
    
    .dropdown:hover .dropdown-content.active {
        display: block;
    }
}

.dropdown-content a {
    color: #374151;
    padding: 10px 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    transition: background 0.15s;
    cursor: pointer;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background: #f3f4f6;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    animation: toastIn 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 键盘提示 */
.keyboard-hint {
    font-size: 11px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 4px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .table-header,
    .table-row {
        grid-template-columns: 36px 1fr 80px 100px 160px;
        padding: 10px 12px;
        gap: 4px;
        font-size: 12px;
        min-width: 600px;
    }

    .table-header {
        font-size: 10px;
    }

    .col-size {
        font-size: 11px;
        padding-right: 4px;
    }

    .col-date {
        font-size: 11px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }

    .btn-xs {
        padding: 3px 6px;
        font-size: 10px;
    }

    .col-actions {
        gap: 3px;
    }

    .navbar {
        padding: 0 12px;
    }

    .navbar-brand {
        font-size: 16px;
    }

    .breadcrumb {
        padding: 10px 14px;
        font-size: 13px;
    }

    .toolbar {
        padding: 10px 14px;
    }
    
    .dropdown-content a {
        padding: 12px 16px;
        font-size: 14px;
        justify-content: center;
    }
}