/* CSS Variables - Dark Theme (Default) */
:root {
    --primary: #f6821f;
    --primary-hover: #e5750f;
    --bg-dark: #0f1419;
    --bg-sidebar: #1a1f2e;
    --bg-card: #1e2433;
    --bg-hover: #252b3b;
    --text-primary: #ffffff;
    --text-secondary: #8b95a5;
    --text-muted: #5c6575;
    --border: #2a3142;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --transition: all 0.2s ease;
}

/* Light Theme */
.theme-light {
    --primary: #f6821f;
    --primary-hover: #e5750f;
    --bg-dark: #f5f7fa;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f0f2f5;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(246, 130, 31, 0.1);
    color: var(--primary);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.storage-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.storage-icon {
    color: var(--primary);
}

.developer-info {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-link:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cache-badge {
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 32px;
}

/* Section */
.section {
    margin-bottom: 32px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* File Grid (for folders) */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.file-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.file-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.folder-icon {
    color: var(--primary);
    margin-bottom: 12px;
}

.file-info {
    text-align: center;
}

.file-card .file-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-all;
}

.file-card .file-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.file-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.file-item .file-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(246, 130, 31, 0.1);
    border-radius: var(--radius-sm);
    color: var(--primary);
    flex-shrink: 0;
}

/* File Type Colors */
.file-type-image { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.file-type-video { color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.file-type-audio { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }
.file-type-pdf { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.file-type-doc { color: #3b82f6; background: rgba(59, 130, 246, 0.1); }
.file-type-xls { color: #22c55e; background: rgba(34, 197, 94, 0.1); }
.file-type-ppt { color: #f97316; background: rgba(249, 115, 22, 0.1); }
.file-type-code { color: #06b6d4; background: rgba(6, 182, 212, 0.1); }
.file-type-archive { color: #a855f7; background: rgba(168, 85, 247, 0.1); }
.file-type-apk { color: #22c55e; background: rgba(34, 197, 94, 0.1); }
.file-type-exe { color: #64748b; background: rgba(100, 116, 139, 0.1); }
.file-type-text { color: #94a3b8; background: rgba(148, 163, 184, 0.1); }
.file-type-default { color: var(--text-secondary); background: var(--bg-hover); }

.file-details {
    flex: 1;
    min-width: 0;
}

.file-details .file-name {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta-row {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-1px);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* Error Message */
.error-message {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    color: var(--error);
}

.error-message svg {
    flex-shrink: 0;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        z-index: 1001;
        border: none;
    }
    
    .sidebar.open {
        display: flex !important;
    }
    
    .app-container {
        display: block;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .top-bar {
        padding: 12px 16px;
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        min-height: auto;
    }
    
    .mobile-menu-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        padding: 4px;
        color: var(--text-secondary);
        cursor: pointer;
        flex-shrink: 0;
        width: 32px;
        height: 32px;
        border-radius: 4px;
        margin: 0;
        box-sizing: border-box;
        align-self: center;
    }
    
    .mobile-menu-btn:hover {
        background: var(--bg-hover);
        color: var(--primary);
    }
    
    .mobile-menu-btn svg {
        width: 18px;
        height: 18px;
        display: block;
    }
    
    .breadcrumb {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        line-height: 1;
    }
    
    .breadcrumb-link,
    .breadcrumb-current {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        white-space: nowrap;
        vertical-align: middle;
        line-height: 1;
    }
    
    .top-actions {
        flex-shrink: 0;
    }
    
    .cache-badge {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-area {
        padding: 12px;
        padding-top: 4px;
    }
    
    .section {
        margin-bottom: 20px;
    }
    
    .section-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
        padding-bottom: 0;
    }
    
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .file-item {
        flex-wrap: wrap;
    }
    
    .file-actions {
        width: 100%;
        margin-top: 12px;
    }
    
    .btn {
        flex: 1;
        justify-content: center;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Mobile Menu Button (hidden on desktop) */
.mobile-menu-btn {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: inline-flex !important;
    }
}

.sidebar-overlay {
    display: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

/* File Detail */
.file-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* File Preview */
.file-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-height: 100px;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.preview-video {
    max-width: 100%;
    max-height: 300px;
}

.preview-audio {
    width: 100%;
    max-width: 400px;
}

.preview-pdf,
.preview-text {
    width: 100%;
    height: 300px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

/* Light theme iframe fix */
.theme-light .preview-pdf,
.theme-light .preview-text {
    background: #ffffff;
    color-scheme: light;
}

/* Dark theme iframe fix */
.theme-dark .preview-pdf,
.theme-dark .preview-text {
    background: #1e2433;
    color-scheme: dark;
}

.file-detail-icon {
    display: flex;
    justify-content: center;
    color: var(--primary);
}

.file-detail-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.detail-path {
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
}

.file-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-large {
    padding: 12px 20px;
    font-size: 1rem;
    justify-content: center;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
}

/* ==================== 拖拽上传样式 ==================== */

/* 拖拽覆盖层 */
.drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(246, 130, 31, 0.15);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.drop-overlay.show {
    display: flex;
}

.drop-overlay-content {
    text-align: center;
    color: var(--primary);
    padding: 40px;
    background: var(--bg-card);
    border: 3px dashed var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: pulse 1.5s ease-in-out infinite;
}

.drop-overlay-content svg {
    margin-bottom: 16px;
    opacity: 0.9;
}

.drop-overlay-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.drop-overlay-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* 上传进度 */
.upload-progress {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 1001;
    transition: transform 0.3s ease;
}

.upload-progress.show {
    transform: translateX(-50%) translateY(0);
}

.upload-progress-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 24px;
    box-shadow: var(--shadow);
    min-width: 300px;
}

.upload-progress-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
    font-weight: 500;
}

.upload-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Toast warning 类型 */
.toast.warning {
    border-color: var(--warning);
}
