/* Modern File Manager Styles */
:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #6B7280;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --background: #F9FAFB;
    --surface: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border-color: #E5E7EB;
    --hover-bg: #F3F4F6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    z-index: 1;
}

.search-input {
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 300px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Navigation Bar */
.nav-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-grow: 1;
}

.breadcrumb-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-item:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.breadcrumb-separator {
    color: var(--text-muted);
    margin: 0 0.25rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.view-btn {
    background: var(--surface);
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.view-btn:hover {
    background: var(--hover-bg);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    background: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--hover-bg);
}

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

.btn-danger:hover:not(:disabled) {
    background: #DC2626;
}

.btn-ghost {
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--hover-bg);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

/* File Container */
.file-container {
    display: grid;
    gap: 1rem;
    min-height: 200px;
}

.file-container.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.file-container.list-view {
    grid-template-columns: 1fr;
    gap: 0;
}

/* File Items */
.file-item {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    user-select: none;
}

.file-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.file-item.selected {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.file-item.list-view {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
}

.file-item.list-view:first-child {
    border-top: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.file-item.list-view:last-child {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.file-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

.file-item.list-view .file-icon {
    font-size: 1.5rem;
    margin: 0;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item.list-view .file-meta {
    margin-left: auto;
    gap: 2rem;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Search Results */
.search-results {
    margin-top: 1rem;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.search-header h3 {
    color: var(--text-primary);
}

.search-container-results {
    display: grid;
    gap: 0.5rem;
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-actions {
    display: flex;
    gap: 0.75rem;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 800px;
}

.modal-small {
    max-width: 400px;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem 2rem;
}

.modal-footer {
    padding: 1rem 2rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.upload-area h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Progress Bar */
.upload-progress {
    margin-top: 1rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* Preview Content */
.preview-content {
    max-height: 400px;
    overflow-y: auto;
}

.preview-text {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--border-radius);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

.preview-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

.preview-info {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--border-radius);
    display: grid;
    gap: 0.5rem;
    font-size: 0.875rem;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    min-width: 150px;
    overflow: hidden;
}

.context-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: var(--transition);
}

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

.context-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notification {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    border-color: var(--success-color);
}

.notification.error {
    border-color: var(--danger-color);
}

.notification.warning {
    border-color: var(--warning-color);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}

.notification-close:hover {
    color: var(--text-primary);
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.file-item {
    animation: fadeIn 0.2s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-input {
        width: 200px;
    }
    
    .nav-bar {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .nav-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .file-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .search-input {
        width: 150px;
    }
    
    .file-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .notification {
        min-width: 250px;
    }
}
