/* Simple File Manager - Optimized CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Font optimization */
@media (prefers-reduced-motion: no-preference) {
    * {
        font-display: swap;
    }
}

/* Prevent font loading issues */
@supports (font-display: swap) {
    * {
        font-display: swap;
    }
}

/* Font Awesome optimization */
.fas, .far, .fab, .fal, .fad {
    font-display: swap;
    font-feature-settings: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Upload Section */
.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}

.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--bg);
    transition: all 0.2s;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.drop-content i {
    font-size: 2rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.drop-content p {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.file-types {
    color: var(--text-dim);
    font-size: 0.875rem;
}

/* Status */
.status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: center;
}

.status.success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.status.error { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.status.info { background: rgba(59, 130, 246, 0.2); color: var(--primary); }

/* File List */
.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.file-list-section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    margin: 0;
}

/* Header Actions Container */
.header-actions-container {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Advanced Actions */
.advanced-actions {
    position: relative;
}

.advanced-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    position: relative;
}

.advanced-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.advanced-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.advanced-dropdown {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.advanced-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.dropdown-item {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    text-align: center;
    border-radius: 8px;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Selection Mode */
.selection-mode .file-item {
    cursor: pointer;
    position: relative;
}

.selection-mode .file-item {
    padding-right: 3rem;
}

.selection-mode .file-item::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    transition: all 0.2s;
    z-index: 10;
}

.selection-mode .file-item.selected::before {
    background: var(--primary);
    border-color: var(--primary);
}

.selection-mode .file-item.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 11;
}

.selection-mode .file-item.selected {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
}

/* Selection Delete Button */
.selection-delete-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--danger);
    border-radius: 8px;
    background: var(--danger);
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
    position: relative;
}

.selection-delete-btn.show {
    display: flex;
    animation: slideInLeft 0.3s ease;
}

.selection-delete-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.selection-delete-btn .count {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: bold;
    border: 2px solid var(--bg-card);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}



.file-grid {
    display: grid;
    gap: 0.75rem;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: background 0.2s;
}

.file-item:hover {
    background: var(--bg-hover);
}

.file-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1rem;
    color: white;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    word-break: break-all;
}

.file-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.action-btn {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: all 0.2s;
    color: white;
}

.action-btn:hover {
    transform: translateY(-1px);
}

.action-btn.download { background: var(--success); }
.action-btn.info { background: var(--warning); }
.action-btn.delete { background: var(--danger); }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    border: 1px solid var(--border);
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.modal-close {
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* Delete Modal */
.delete-message {
    text-align: center;
    margin-bottom: 1.5rem;
}

.delete-message p {
    margin-bottom: 0.5rem;
}

.warning-text {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

.delete-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn-secondary,
.btn-danger {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text);
}

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

/* File Info */
.file-info-content {
    display: grid;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 4px;
}

.info-label {
    font-weight: 500;
}

.info-value {
    color: var(--text-dim);
    font-family: monospace;
}

/* Loading */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
}

.loading-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border);
}

.loading-spinner i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .file-item {
        padding: 0.75rem;
    }
    
    .file-icon {
        width: 2rem;
        height: 2rem;
        margin-right: 0.75rem;
        font-size: 0.875rem;
    }
    
    .file-name {
        font-size: 0.875rem;
    }
    
    .action-btn {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
    }
    
    .file-actions {
        gap: 0.375rem;
    }
    
    .delete-actions {
        gap: 0.5rem;
    }
    
    .btn-secondary,
    .btn-danger {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
    }
    
    .file-list-header {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .advanced-btn {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.875rem;
    }
    
    .header-actions-container {
        gap: 0.25rem;
    }
    
    .advanced-btn {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.875rem;
    }
    
    .dropdown-item {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.875rem;
    }
    
    .selection-delete-btn {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.875rem;
    }
}