/* assets/style.css */
:root {
    --primary: #007AFF;
    --primary-hover: #0056b3;
    --bg-body: #F5F7FA;
    --bg-card: #FFFFFF;
    --text-main: #333333;
    --text-meta: #888888;
    --border: #E1E4E8;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --header-height: 60px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    padding-top: var(--header-height);
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.brand {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn:hover {
    background: #f0f0f0;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Main Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Breadcrumb */
.breadcrumb {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    color: var(--text-meta);
    cursor: pointer;
}

.breadcrumb li:not(:last-child) span:last-child:hover {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb li:last-child {
    color: var(--text-main);
    font-weight: 500;
    cursor: default;
}

.divider {
    margin: 0 8px;
    color: #ccc;
}

/* File List (List View) */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 10px 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    border: 1px solid var(--border);
    position: relative;
    height: 60px;
    /* Fixed height for list items */
}

/* Mobile optimization: maintain list view but perhaps smaller padding */
@media (max-width: 600px) {
    .file-item {
        padding: 5px 10px;
        height: 50px;
    }
}

.file-item:hover {
    transform: none;
    /* No jump in list view */
    box-shadow: var(--shadow);
    border-color: var(--primary);
    background-color: #fafaff;
}

.file-preview,
.file-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    /* Fixed width */
    margin-right: 15px;
    margin-bottom: 0;
    /* Reset margin */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-color: #f9f9f9;
    font-size: 1.5rem;
    color: var(--text-meta);
}

.file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.file-name {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-meta {
    font-size: 0.8rem;
    color: var(--text-meta);
}

/* Actions always visible on mobile, hover on desktop */
.file-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 1;
    /* Always visible for better UX in list view */
    position: static;
    /* Reset absolute */
}

.btn-icon {
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-meta);
    cursor: pointer;
    box-shadow: none;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.btn-icon.delete-btn:hover {
    color: #FF3B30;
    background: rgba(255, 59, 48, 0.1);
}

/* Obsolete actions styles removed */

.btn-icon {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FF3B30;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Upload Area (Hidden by default, shown on drag) */
#upload-area {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 122, 255, 0.1);
    backdrop-filter: blur(2px);
    z-index: 200;
    display: none;
    /* Controlled by class */
    align-items: center;
    justify-content: center;
    border: 4px dashed var(--primary);
    margin: 20px;
    border-radius: 20px;
    pointer-events: none;
    /* Let events fall through to body handler */
}

#upload-area.drag-active {
    display: flex;
}

#upload-area::after {
    content: "释放以上传文件到当前目录";
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 600;
    background: white;
    padding: 20px 40px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.2);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: var(--shadow);
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.auth-input {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
}

.auth-input:focus {
    border-color: var(--primary);
}

/* Utilities */
.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: white;
    opacity: 0;
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-error {
    background: #FF3B30;
}

/* Admin Visibility */
.admin-only {
    display: none !important;
}

body.is-admin .admin-only {
    display: inline-flex !important;
}

/* Upload Queue Panel */
.upload-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: var(--bg-card);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: var(--radius);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s;
}

.upload-panel.hidden {
    display: none !important;
}

.upload-panel.minimized {
    transform: translateY(calc(100% - 40px));
}

.panel-header {
    background: var(--bg-body);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.panel-header h4 {
    margin: 0;
    font-size: 0.95rem;
}

.panel-controls span {
    cursor: pointer;
    margin-left: 10px;
    color: var(--text-meta);
}

.panel-controls span:hover {
    color: var(--text-main);
}

.queue-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 0;
}

.queue-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.queue-item:last-child {
    border-bottom: none;
}

.q-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.q-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.q-status {
    font-size: 0.75rem;
    color: var(--text-meta);
}

.q-progress-bg {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.q-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s;
}

.q-progress-bar.error {
    background: #FF3B30;
}

.q-progress-bar.success {
    background: #34C759;
}

#upload-progress {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.2s;
}

#upload-progress-container {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 999;
}

#upload-progress-container.hidden {
    display: none;
}

/* Lock Styles */
.file-item.locked .file-preview,
.file-item.locked .file-icon {
    opacity: 0.5;
}

.lock-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #333;
    z-index: 2;
}