/* Modern Secure File Share UI */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --error-dark: #dc2626;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-secondary: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

.banner-sandbox {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-dark);
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.banner-sandbox i { color: var(--error-dark); }

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.navbar-brand i {
    font-size: 1.5rem;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-profile i {
    font-size: 1.25rem;
    color: var(--primary);
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Login Section */
.login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 1.5rem;
}

.login-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.btn-login {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-login:active {
    transform: translateY(0);
}

/* Dashboard Section */
.dashboard-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Drive layout */
.drive-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

.drive-sidebar {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.usage-widget { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 0.75rem; margin-bottom: 0.75rem; }
.usage-header { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.usage-bar { height: 8px; background: var(--surface-secondary); border-radius: 999px; overflow: hidden; border: 1px solid var(--border-light); }
.usage-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); width: 0%; transition: width 0.3s ease; }
.usage-text { margin-top: 0.5rem; font-size: 0.75rem; color: var(--text-muted); display: flex; justify-content: space-between; }

.drive-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    appearance: none;
    background: var(--surface-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item.active {
    background: #eef2ff;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-primary.full { width: 100%; }
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-primary:hover { background: var(--primary-dark); }

/* New Folder modal tweaks reuse preview-modal styles */
#newFolderModal .preview-modal-content { 
    max-width: 480px; 
    min-width: 320px; 
}
#newFolderModal .preview-modal-body { 
    padding: 1.5rem; 
}
#newFolderModal .preview-modal-footer { 
    justify-content: flex-end; 
}

/* Move modal sizing */
#moveModal .preview-modal-content { 
    max-width: 560px; 
    min-width: 360px; 
}
#moveModal .preview-modal-body { 
    padding: 1.5rem; 
}
#moveModal .list .list-item { 
    cursor: pointer; 
}
#moveModal .list .list-item:hover { 
    background: var(--surface); 
}

/* Elevate modal sizing */
#elevateModal .preview-modal-content {
    max-width: 480px;
    min-width: 320px;
}
#elevateModal .preview-modal-body {
    padding: 1.5rem;
}

.drive-main { display: flex; flex-direction: column; gap: 1rem; }

.drive-toolbar { display: flex; justify-content: space-between; align-items: center; }

.breadcrumbs { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); font-size: 0.875rem; }
.breadcrumbs .crumb { cursor: pointer; color: var(--primary); }
.breadcrumbs .sep { color: var(--text-muted); }

/* Tabs */
.tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    box-shadow: var(--shadow);
}

.tab-btn {
    appearance: none;
    background: var(--surface-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eef2ff;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.tab-content {
    animation: fadeIn 0.2s ease;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-secondary);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Files toolbar */
.files-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-input {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem 0.25rem 2rem;
}

.search-input i {
    position: absolute;
    left: 0.5rem;
    color: var(--text-muted);
}

.search-input input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 0.5rem 0.25rem;
    width: 220px;
}

.view-toggle {
    display: inline-flex;
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.view-btn {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    cursor: pointer;
}

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

/* Upload Card */
.upload-card .card-header {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    border-bottom: none;
}

.upload-card .card-header h2,
.upload-card .card-header p {
    color: white;
}

.upload-area {
    padding: 2rem;
}

.upload-quick .file-preview { 
    margin-top: 1rem; 
    margin-bottom: 1rem;
}
.upload-quick .upload-settings { 
    margin-bottom: 1rem;
}
.upload-quick .btn-upload { 
    margin-bottom: 1rem;
    width: 100%;
}
.upload-quick .file-link input { 
    min-width: 0; 
    width: 100%; 
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--surface-secondary);
    margin-bottom: 2rem;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgb(99 102 241 / 0.05);
    transform: translateY(-2px);
}

.drop-zone.has-files {
    border-color: var(--success);
    background: rgb(16 185 129 / 0.05);
}

.drop-zone.has-files .drop-zone-content h3 {
    color: var(--success);
}

.drop-zone.has-files .drop-zone-content p {
    color: var(--success);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.drop-zone-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.drop-zone-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-browse {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-browse:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* File Preview */
.file-preview {
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: slideDown 0.3s ease;
    overflow: hidden;
    max-width: 100%;
}

.file-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.file-preview-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-clear-file {
    background: var(--error);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-clear-file:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    min-width: 0;
}

.file-icon-preview {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.file-details-preview {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.file-name-preview {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 1rem;
    line-height: 1.4;
    max-height: 2.8em; /* Limit to 2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.file-meta-preview {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    overflow: hidden;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload Settings */
.upload-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--surface-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-select,
.form-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.input-with-unit input {
    flex: 1;
    min-width: 0;
}

.input-with-unit span {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 3rem;
    flex-shrink: 0;
}

.btn-upload {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.btn-upload:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

/* Upload Progress */
.upload-progress {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--surface-secondary);
    border-radius: var(--radius);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.progress-bar {
    height: 0.5rem;
    background: var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: var(--radius-sm);
}

.progress-details {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-speed {
    font-weight: 500;
}

.progress-time {
    font-style: italic;
}

/* Upload Result */
.upload-result {
    margin-top: 1.5rem;
    padding: 2rem;
    background: rgb(16 185 129 / 0.1);
    border: 1px solid rgb(16 185 129 / 0.2);
    border-radius: var(--radius);
    max-width: 100%;
    overflow: hidden;
}

.upload-result-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgb(16 185 129 / 0.2);
}

.upload-result-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.file-details {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.file-details p {
    margin: 0.5rem 0;
    word-break: break-word;
}

.upload-result h3 {
    color: var(--success);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-link {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid var(--border-light);
}

.file-link-input-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
}

.file-link input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.75rem;
    background: var(--surface-secondary);
    word-break: break-all;
    overflow-wrap: break-word;
}

.file-link-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.copy-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.copy-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.file-link .btn-secondary {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Files Card */
.files-content {
    padding: 2rem;
}

/* Simple divider */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: 1.25rem 0;
}

/* Utility: grid for admin form */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Settings */
#tabSettings .files-content {
    max-width: 800px;
}

/* Admin list */
.list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

/* Logs list formatting */
#tabLogs .list-item {
    align-items: flex-start;
}
#tabLogs .list-main {
    flex-direction: column;
    align-items: flex-start;
}

.list-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.list-main i {
    color: var(--primary);
}

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

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.muted {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    width: 4rem;
    height: 4rem;
    background: var(--surface-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

.file-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.file-item.folder.dragover {
    outline: 2px dashed var(--primary);
}
.file-item.back.dragover {
    outline: 2px dashed var(--primary);
}

.file-icon {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.125rem;
    flex-shrink: 0;
}

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

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

.file-meta {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.file-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
    align-items: center;
}

/* Grid view */
.files-list[data-view="grid"] {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.files-list[data-view="grid"] .file-item {
    flex-direction: column;
    align-items: stretch;
}

.files-list[data-view="grid"] .file-info {
    margin-top: 0.5rem;
}

.files-list[data-view="grid"] .file-actions {
    margin-top: 0.5rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* Context menu */
.context-menu {
    position: fixed;
    z-index: 1100;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.25rem;
}

.context-menu .ctx-action {
    width: 100%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.context-menu .ctx-action:hover {
    background: var(--surface-secondary);
}

.context-menu .ctx-action.danger {
    color: var(--error);
}

.file-link-btn,
.btn-refresh {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.file-link-btn:hover,
.btn-refresh:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-danger {
    background: var(--error);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-preview {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-preview:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Preview Modal */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.preview-modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 60vw;
    max-height: 70vh;
    width: 100%;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

.preview-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.preview-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.close-preview-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.close-preview-btn:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.preview-modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-content {
    flex: 1;
    overflow: auto;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 450px;
}

.preview-content img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    max-height: 400px;
}

.preview-content video {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: var(--radius-sm);
}

.preview-content audio {
    width: 100%;
    max-width: 400px;
}

.preview-content iframe {
    width: 100%;
    height: 400px;
    border: none;
    border-radius: var(--radius-sm);
}

.preview-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    background: var(--surface-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    min-width: 300px;
    animation: slideIn 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.toast.error {
    border-left-color: var(--error);
}

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

.toast button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    margin-left: 1rem;
}

.toast button:hover {
    color: var(--text-secondary);
}

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

/* Error Messages */
.error-message {
    background: rgb(239 68 68 / 0.1);
    color: var(--error);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgb(239 68 68 / 0.2);
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .navbar {
        padding: 1rem;
    }
    
    .navbar-brand span {
        display: none;
    }
    
    .login-card {
        padding: 2rem;
    }
    
    .card-header {
        padding: 1rem 1.5rem;
    }
    
    .upload-area {
        padding: 1.5rem;
    }
    
    .upload-settings {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .files-content {
        padding: 1.5rem;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .toast-container {
        left: 1rem;
        right: 1rem;
    }
    
    .toast {
        min-width: auto;
    }

    .drive-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .login-card {
        padding: 1.5rem;
    }
    
    .drop-zone {
        padding: 2rem 1rem;
    }
    
    .upload-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }
    
    .file-item {
        padding: 1rem;
    }
    
    .file-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .preview-modal {
        padding: 1rem;
    }
    
    .preview-modal-content {
        max-width: 95vw;
        max-height: 80vh;
        min-width: 300px;
    }
    
    .preview-modal-header {
        padding: 0.75rem 1rem;
    }
    
    .preview-content {
        padding: 0.5rem;
        min-height: 200px;
    }
    
    .preview-modal-footer {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .preview-content img {
        max-height: 250px;
    }
    
    .preview-content video {
        max-height: 250px;
    }
    
    .preview-content iframe {
        height: 250px;
    }
    
    .preview-content audio {
        max-width: 300px;
    }
    
    .upload-result {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .file-link {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .file-link-input-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .file-link input {
        font-size: 0.7rem;
        padding: 0.5rem 0.75rem;
    }
    
    .file-link-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .copy-btn,
    .file-link .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
        font-size: 0.8rem;
    }
}