/* UltimateFTP - Modern Premium UI Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Design Tokens --- */
:root {
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --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);
}

/* Dark Theme (Default) */
.theme-dark {
  --bg-body: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #334155;
  --bg-hover: #334155;
  --bg-active: #475569;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  --border-subtle: #334155;
  --border-strong: #475569;
  --border-input: #475569;
  --border-focus: #3b82f6;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-bg: rgba(59, 130, 246, 0.15);
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Light Theme */
.theme-light {
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-active: #cbd5e1;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-input: #cbd5e1;
  --border-focus: #2563eb;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-bg: rgba(37, 99, 235, 0.1);
  
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(148, 163, 184, 0.2);
}

/* --- Base & Resets --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { 
  font-family: var(--font-sans); 
  background-color: var(--bg-body); 
  color: var(--text-main); 
  line-height: 1.5; 
  height: 100vh; 
  overflow: hidden; 
  transition: background-color var(--transition-normal); 
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-hover); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-active); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Components --- */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; font-weight: 500; font-size: 0.95rem;
  border-radius: var(--radius-md); border: none; cursor: pointer;
  transition: all var(--transition-normal); white-space: nowrap; outline: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--text-inverse); box-shadow: 0 4px 14px 0 var(--primary-bg); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-main); border: 1px solid var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--text-muted); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn-icon {
  background: transparent; border: none; color: var(--text-muted);
  width: 36px; height: 36px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition-fast);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-main); }
.text-danger { color: var(--danger) !important; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 16px; background: var(--bg-body);
  border: 1px solid var(--border-input); border-radius: var(--radius-md);
  color: var(--text-main); transition: all var(--transition-normal); outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}
.form-group input:hover, .form-group select:hover { border-color: var(--text-muted); }
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg), inset 0 1px 2px rgba(0, 0, 0, 0.05);
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { margin-bottom: 0; }
.form-group-sm { max-width: 120px; flex: unset !important; width: 120px; }
.form-group-grow { flex: 2; min-width: 200px; }
.form-group-btn { justify-content: flex-end; align-self: flex-end; }
.input-icon { position: relative; width: 100%; }
.input-icon svg { position: absolute; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
[dir="ltr"] .input-icon svg { left: 16px; }
[dir="rtl"] .input-icon svg { right: 16px; }
[dir="ltr"] .input-icon input { padding-left: 48px; }
[dir="rtl"] .input-icon input { padding-right: 48px; }
.color-input { width: 100%; height: 46px; padding: 4px !important; cursor: pointer; border-radius: var(--radius-md); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); font-style: italic; }

/* Spinners */
.spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards & Modals (Glassmorphism) */
.glass-panel {
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg); box-shadow: var(--glass-shadow);
}

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 1;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  width: 90%; max-width: 500px; box-shadow: var(--shadow-xl); overflow: hidden;
  animation: modalScaleIn var(--transition-bounce);
}
@keyframes modalScaleIn { from { transform: scale(0.95) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-main); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 12px; padding: 20px 24px;
  background: var(--bg-elevated); border-top: 1px solid var(--border-subtle);
}

/* Toast */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: var(--radius-full); font-size: 0.9rem; font-weight: 500;
  z-index: 9999; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: toastSlideUp var(--transition-bounce);
}
@keyframes toastSlideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

/* Dropdown Menu */
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 8px; min-width: 200px;
  box-shadow: var(--shadow-lg); display: none; z-index: 200;
  animation: dropdownIn 0.2s ease-out;
}
[dir="rtl"] .dropdown-menu { right: auto; left: 0; }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.dropdown-menu.show { display: block; }
.dropdown-menu a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  color: var(--text-main); border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500;
}
.dropdown-menu a:hover { background: var(--bg-hover); color: var(--primary); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: 6px 0; }

/* Context Menu */
.context-menu {
  position: fixed; background: var(--glass-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 6px;
  min-width: 220px; box-shadow: var(--shadow-xl); z-index: 1500;
  max-height: calc(100vh - 20px); overflow-y: auto;
  animation: fadeIn 0.15s ease-out;
}
.context-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-main);
  font-size: 0.9rem; font-weight: 500; transition: background var(--transition-fast);
}
.context-item:hover { background: var(--primary); color: #fff; }
.context-item:hover svg { color: #fff; }
.context-item svg { color: var(--text-muted); flex-shrink: 0; transition: color var(--transition-fast); }
.context-danger { color: var(--danger); }
.context-danger svg { color: var(--danger); }
.context-danger:hover { background: var(--danger); color: #fff; }
.context-sep { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* --- Auth Page Layout --- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; overflow: auto; position: relative; }
.auth-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg-body);
}
.auth-bg::before {
  content: ''; position: absolute; width: 600px; height: 600px; background: var(--primary);
  border-radius: 50%; top: -200px; right: -200px; filter: blur(150px); opacity: 0.2;
  animation: pulseBlob 10s infinite alternate;
}
.auth-bg::after {
  content: ''; position: absolute; width: 600px; height: 600px; background: #ec4899;
  border-radius: 50%; bottom: -200px; left: -200px; filter: blur(150px); opacity: 0.15;
  animation: pulseBlob 12s infinite alternate-reverse;
}
@keyframes pulseBlob { 0% { transform: scale(1) translate(0,0); } 100% { transform: scale(1.1) translate(-50px, 50px); } }

.auth-container { position: relative; z-index: 1; width: 100%; max-width: 440px; padding: 24px; }
.auth-card { padding: 48px 40px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), #0ea5e9); color: #fff;
  margin-bottom: 20px; box-shadow: 0 10px 30px -10px var(--primary);
}
.auth-logo h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.5px; }
.auth-subtitle { color: var(--text-muted); font-size: 0.95rem; margin-top: 8px; }

.auth-message { padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.9rem; text-align: center; font-weight: 500; margin-bottom: 20px; }
.auth-message.error { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.auth-message.success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }

.auth-footer { text-align: center; margin-top: 32px; color: var(--text-muted); font-size: 0.9rem; }
.auth-footer a { font-weight: 600; }
.auth-lang { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
.auth-lang a { color: var(--text-muted); font-size: 0.8rem; padding: 6px 12px; border-radius: var(--radius-full); font-weight: 500; background: var(--bg-elevated); border: 1px solid transparent; }
.auth-lang a:hover { color: var(--text-main); border-color: var(--border-strong); }
.auth-lang a.active { color: var(--primary); background: var(--primary-bg); border-color: rgba(99,102,241,0.2); }

/* --- Dashboard Layout --- */
.dashboard-page { overflow: auto; height: 100vh; background-color: var(--bg-elevated); }
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; background: var(--glass-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; z-index: 100;
}
.dash-header-left, .dash-header-right { display: flex; align-items: center; gap: 16px; }
.dash-logo { display: flex; align-items: center; gap: 12px; color: var(--text-main); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.5px; }
.dash-logo svg { color: var(--primary); width: 28px; height: 28px; }
.dash-user-menu { position: relative; }
.dash-user-btn {
  display: flex; align-items: center; gap: 10px; background: var(--bg-surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-full);
  padding: 6px 16px 6px 6px; color: var(--text-main); cursor: pointer; transition: all var(--transition-normal);
  font-weight: 500;
}
.dash-user-btn:hover { border-color: var(--text-muted); box-shadow: var(--shadow-sm); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0ea5e9); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1rem;
}
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; font-size: 0.85rem; }

.dash-main { max-width: 1200px; margin: 0 auto; padding: 40px 32px; }
.dash-section { margin-bottom: 48px; animation: fadeIn 0.4s ease-out; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.section-header h2 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; font-weight: 600; }
.section-header h2 svg { color: var(--primary); }

.connect-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm);
}
.connect-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.connect-grid .form-group { min-width: 160px; margin-bottom: 0; }

.connections-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.connection-card {
  display: flex; align-items: center; background: var(--bg-surface);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: 20px 24px; transition: all var(--transition-bounce); position: relative; overflow: hidden;
}
[dir="rtl"] .connection-card { padding-left: 20px; padding-right: 24px; }
.connection-card:hover { border-color: var(--border-focus); transform: translateY(-4px); box-shadow: var(--shadow-md); }
.connection-color { width: 6px; height: 100%; position: absolute; left: 0; top: 0; border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
[dir="rtl"] .connection-color { left: auto; right: 0; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.connection-info { flex: 1; padding: 0 16px; min-width: 0; }
.connection-info h3 { font-size: 1.1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }
.connection-info p { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.connection-user { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); display: inline-block; margin-top: 4px; padding: 2px 6px; background: var(--bg-elevated); border-radius: 4px; }
.connection-actions { display: flex; gap: 8px; flex-shrink: 0; opacity: 0; transition: opacity var(--transition-fast); }
.connection-card:hover .connection-actions { opacity: 1; }
@media (max-width: 768px) { .connection-actions { opacity: 1; } }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); background: var(--bg-surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.empty-state svg { color: var(--border-strong); margin-bottom: 16px; }
.empty-state p { font-size: 1.1rem; font-weight: 500; }

/* --- App Page (File Manager) --- */
.app-page { display: flex; flex-direction: column; height: 100vh; background: var(--bg-body); }
.app-header {
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  height: 54px; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.app-header-left, .app-header-right { display: flex; align-items: center; gap: 12px; }
.app-logo { display: flex; align-items: center; color: var(--primary); padding: 8px; border-radius: var(--radius-sm); transition: background var(--transition-fast); }
.app-logo:hover { background: var(--primary-bg); }

/* Tabs */
.tabs-bar { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding: 0 8px; max-width: calc(100vw - 300px); height: 100%; scrollbar-width: none; }
.tabs-bar::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: transparent; border-radius: var(--radius-md); cursor: pointer;
  font-size: 0.85rem; font-weight: 500; color: var(--text-muted);
  white-space: nowrap; transition: all var(--transition-fast); position: relative; border: 1px solid transparent;
}
.tab.active { background: var(--bg-elevated); color: var(--text-main); border-color: var(--border-subtle); box-shadow: var(--shadow-sm); }
.tab:hover:not(.active) { background: var(--bg-hover); color: var(--text-main); }
.tab-indicator { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tab-close { display: flex; padding: 4px; border-radius: 4px; opacity: 0; transition: all var(--transition-fast); color: var(--text-muted); }
.tab:hover .tab-close, .tab.active .tab-close { opacity: 1; }
.tab-close:hover { background: var(--danger); color: #fff; }

/* Toolbar */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 16px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; gap: 12px; flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 4px; }
.toolbar-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; transition: all var(--transition-fast); white-space: nowrap;
}
.toolbar-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-main); }
.toolbar-btn.active { background: var(--primary-bg); color: var(--primary); }
.toolbar-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.toolbar-btn span { display: none; }
@media(min-width: 1024px) { .toolbar-btn span { display: inline; } }
.toolbar-sep { width: 1px; height: 24px; background: var(--border-strong); margin: 0 8px; }

.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg-elevated); border: 1px solid transparent; border-radius: var(--radius-full); padding: 6px 14px; transition: all var(--transition-fast); }
.search-box:focus-within { background: var(--bg-surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.search-box input { border: none; background: none; color: var(--text-main); outline: none; width: 160px; font-size: 0.85rem; }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }

/* Breadcrumb */
.breadcrumb-bar { padding: 10px 20px; background: var(--bg-body); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; overflow-x: auto; scrollbar-width: none; font-family: var(--font-mono); }
.breadcrumb::-webkit-scrollbar { display: none; }
.breadcrumb-item { padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-muted); transition: all var(--transition-fast); white-space: nowrap; }
.breadcrumb-item:hover { background: var(--bg-elevated); color: var(--text-main); }
.breadcrumb-item.active { color: var(--text-main); font-weight: 600; background: var(--bg-surface); border: 1px solid var(--border-subtle); }
.breadcrumb-sep { color: var(--border-strong); font-size: 0.8rem; }

/* File List */
.fm-container { flex: 1; overflow: hidden; display: flex; padding: 0 20px 20px 20px; }
.fm-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); border-top-left-radius: 0; border-top-right-radius: 0; box-shadow: var(--shadow-sm); }
.fm-list-header {
  display: flex; align-items: center; padding: 0 16px; height: 40px;
  background: var(--bg-elevated); border-bottom: 1px solid var(--border-strong);
  font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; flex-shrink: 0; user-select: none;
}
.fm-col { display: flex; align-items: center; gap: 6px; cursor: pointer; transition: color var(--transition-fast); }
.fm-col:hover { color: var(--text-main); }
.fm-col-check { width: 40px; flex-shrink: 0; justify-content: center; }
.fm-col-check input { cursor: pointer; accent-color: var(--primary); width: 16px; height: 16px; }
.fm-col-name { flex: 1; min-width: 200px; }
.fm-col-size { width: 100px; flex-shrink: 0; justify-content: flex-end; text-align: right; }
.fm-col-modified { width: 160px; flex-shrink: 0; justify-content: flex-end; text-align: right; }
.fm-col-perms { width: 90px; flex-shrink: 0; justify-content: center; text-align: center; }
.fm-list { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* File Row */
.fm-row {
  display: flex; align-items: center; padding: 0 16px; height: 46px;
  border-bottom: 1px solid var(--border-subtle); cursor: pointer;
  transition: background var(--transition-fast); font-size: 0.9rem; font-weight: 500;
}
.fm-row:last-child { border-bottom: none; }
.fm-row:hover { background: var(--bg-hover); }
.fm-row.selected { background: var(--primary-bg); }
.fm-row.cut { opacity: 0.5; }
.fm-row .fm-col-check input { cursor: pointer; accent-color: var(--primary); width: 16px; height: 16px; }
.fm-row .fm-col-name { display: flex; align-items: center; gap: 12px; overflow: hidden; }
.fm-row .fm-col-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-row .fm-col-size { color: var(--text-muted); font-size: 0.85rem; font-family: var(--font-mono); }
.fm-row .fm-col-modified { color: var(--text-muted); font-size: 0.85rem; }
.fm-row .fm-col-perms { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; }
.fm-icon { width: 24px; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.fm-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; color: var(--text-muted); gap: 16px; height: 100%; }

/* Grid View */
.fm-list.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; padding: 20px; }
.fm-list.grid-view .fm-row {
  flex-direction: column; height: auto; padding: 20px 12px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); text-align: center; gap: 12px; position: relative;
}
.fm-list.grid-view .fm-row:hover { border-color: var(--border-focus); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.fm-list.grid-view .fm-row.selected { border-color: var(--primary); border-width: 2px; padding: 19px 11px; }
.fm-list.grid-view .fm-row .fm-col-check { position: absolute; top: 8px; left: 8px; }
[dir="rtl"] .fm-list.grid-view .fm-row .fm-col-check { left: auto; right: 8px; }
.fm-list.grid-view .fm-row .fm-col-name { flex-direction: column; width: 100%; }
.fm-list.grid-view .fm-row .fm-col-name span { font-size: 0.85rem; max-width: 100%; text-align: center; margin-top: 8px; }
.fm-list.grid-view .fm-icon { width: 48px; height: 48px; }
.fm-list.grid-view .fm-icon svg { width: 48px; height: 48px; }
.fm-list.grid-view .fm-col-size, .fm-list.grid-view .fm-col-modified, .fm-list.grid-view .fm-col-perms { display: none; }

/* Status Bar */
.status-bar {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 20px;
  height: 36px; background: var(--bg-elevated); border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; font-weight: 500;
}
.status-left, .status-right { display: flex; align-items: center; gap: 12px; }
.status-sep { color: var(--border-strong); }

/* Upload Overlay & Panel */
.upload-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 500; border: 4px dashed var(--primary); margin: 20px; border-radius: var(--radius-lg);
}
.upload-overlay-inner { text-align: center; color: #fff; padding: 40px; }
.upload-overlay-inner svg { color: var(--primary); margin-bottom: 20px; animation: bounce 2s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.upload-overlay-inner p { font-size: 1.5rem; font-weight: 600; }

.upload-panel {
  position: fixed; bottom: 40px; right: 40px; width: 400px;
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); z-index: 400; overflow: hidden;
}
[dir="rtl"] .upload-panel { right: auto; left: 40px; }
.upload-panel-header {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 20px;
  background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle); font-weight: 600; font-size: 0.9rem;
}
.upload-panel-list { max-height: 250px; overflow-y: auto; }
.upload-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; font-size: 0.85rem; border-bottom: 1px solid var(--border-subtle); }
.upload-item:last-child { border-bottom: none; }
.upload-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.upload-item-progress { width: 80px; }
.upload-item-progress progress { width: 100%; height: 6px; border-radius: 3px; appearance: none; }
.upload-item-progress progress::-webkit-progress-bar { background: var(--bg-hover); border-radius: 3px; }
.upload-item-progress progress::-webkit-progress-value { background: var(--primary); border-radius: 3px; }
.upload-item-status { font-size: 0.8rem; color: var(--success); font-weight: 600; min-width: 30px; text-align: right; }
.upload-item-status.error { color: var(--danger); }

/* Editor Panel */
.editor-panel { position: fixed; inset: 0; background: var(--bg-body); z-index: 2000; display: flex; flex-direction: column; animation: fadeIn 0.2s ease-out; }
.editor-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--bg-surface); border-bottom: 1px solid var(--border-subtle); box-shadow: var(--shadow-sm); z-index: 10; }
.editor-info { display: flex; align-items: center; gap: 16px; }
.editor-info span:first-child { font-weight: 600; font-family: var(--font-mono); font-size: 0.95rem; }
.editor-status { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.editor-actions { display: flex; gap: 12px; }
.editor-body { flex: 1; overflow: hidden; }
.editor-body .CodeMirror { height: 100%; font-family: var(--font-mono); font-size: 14px; }
.theme-light .editor-body .CodeMirror { background: var(--bg-body); }

/* Chmod Modal Grid */
.chmod-grid { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 12px; align-items: center; margin-bottom: 20px; background: var(--bg-elevated); padding: 16px; border-radius: var(--radius-md); }
.chmod-grid label { font-size: 0.85rem; font-weight: 500; }
.chmod-grid input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.chmod-header { font-weight: 600; font-size: 0.8rem; text-align: center; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.chmod-label { font-weight: 600; }

/* Responsive Adjustments */
@media(max-width: 900px) {
  .connect-grid { flex-direction: column; }
  .connect-grid .form-group { width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
  .connections-grid { grid-template-columns: 1fr; }
  .fm-col-modified, .fm-col-perms { display: none; }
  .tabs-bar { max-width: calc(100vw - 120px); }
  .toolbar { gap: 8px; padding: 8px; }
  .search-box input { width: 100px; }
  .dash-main { padding: 20px 16px; }
  .dash-header { padding: 12px 16px; }
  .upload-panel { width: 100%; right: 0; left: 0; bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .fm-container { padding: 0; }
  .fm-main { border-radius: 0; border-left: none; border-right: none; }
}
