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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  line-height: 1.5;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Tabs */
.nav-tabs {
  display: inline-flex;
  gap: 8px;
  margin-left: 20px;
}

.tab {
  background: rgba(255,255,255,0.06);
  color: #e6eef9;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 6px 18px rgba(2,6,23,0.15);
}

/* Sync (clipboard) styles */
.sync-container {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.sync-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, rgba(59,130,246,0.06), rgba(99,102,241,0.04));
  border-radius: 8px;
}

.status-indicator { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #ccc; display: inline-block; }
.status-dot.connected { background: #28a745; }
.status-dot.disconnected { background: #dc3545; }
.status-dot.connecting { background: #ffc107; }
.user-count { color: #64748b; }

.sync-textarea {
  flex: 1;
  width: 100%;
  min-height: 420px;
  padding: 1rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  border: 2px solid #e6eef9;
  border-radius: 12px;
  resize: none;
  box-sizing: border-box;
  background: linear-gradient(180deg,#ffffff,#fbfdff);
}

.sync-textarea:focus { outline: none; border-color: #3b82f6; }
.sync-textarea.remote-update { background: #fff7e6; }

/* Breadcrumb Navigation */
#breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 12px;
}

#breadcrumbs { display:flex; align-items:center; gap:6px; }
#breadcrumbs button {
  background: transparent;
  border: none;
  color: #0f172a;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#breadcrumbs button:hover { background: rgba(15,23,42,0.04); }

#breadcrumbs span { color: #64748b; margin: 0 4px; }

/* Main Container */
.container {
  display: flex;
  gap: 20px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

/* File Browser */
.browser {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* Parent Directory Button */
.parent-dir-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 2px dashed #cbd5e1;
  color: #475569;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  width: 100%;
  justify-content: center;
  transition: all 0.2s ease;
}

.parent-dir-btn:hover {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border-color: #94a3b8;
  color: #1e293b;
}

.parent-dir-btn .icon {
  font-size: 18px;
}

/* File List */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Empty state */
.empty-state {
  padding: 28px 20px;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
  background: #fbfdff;
  color: #64748b;
  text-align: center;
  font-size: 14px;
}

/* Upload form (small, inline) */
#upload-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

#upload-form input[type="file"] {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: #0f172a;
}

#upload-form button {
  padding: 8px 14px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

#upload-form button:hover {
  filter: brightness(0.95);
}

#upload-status { color: #475569; font-size: 13px; }

/* Custom file input UI */
#upload-file { position: absolute; left: -9999px; }
.upload-choose {
  padding: 8px 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.upload-filename { color: #475569; margin-left: 8px; font-size: 13px; }
.upload-actions { display: inline-flex; align-items: center; gap: 8px; }
.upload-file-list { list-style: none; padding: 0; margin: 0; display: inline-block; }
.upload-file-list li { display: inline-block; margin-left: 8px; color: #475569; font-size: 13px; }
.upload-file-item { display: block; }

/* Upload container */
.upload-container { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.upload-action {
  padding: 8px 12px;
  background: linear-gradient(135deg,#3b82f6 0%,#2563eb 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.upload-action .icon { font-size: 14px; }
.upload-action[disabled] { opacity: 0.6; cursor: not-allowed; }

.upload-file-list { margin-left: 6px; max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-list li { display: inline-block; margin-left: 0; margin-right: 10px; }

/* Alert box for upload status */
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; display: none; align-items: center; gap: 8px; }
.alert.visible { display: flex; }
.alert .msg { flex: 1; }
.alert .close { background: transparent; border: none; cursor: pointer; color: inherit; font-weight: 700; }
.alert.error { background: #fff1f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #bbf7d0; }

/* small spinner */
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); border-top-color: rgba(255,255,255,0.9); animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  background: #fff;
}

.file-row:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.file-row .icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 20px;
}

.file-row.dir .icon {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.file-row.file .icon {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.file-row .name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: #1e293b;
}

.file-row .meta {
  color: #64748b;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* hide original parent-dir-btn styles; kept in case but not used */
.parent-dir-btn { display: none; }

.file-row .meta .count {
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #64748b;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    padding: 16px;
  }
  
  .topbar {
    padding: 12px 16px;
  }
  
  #breadcrumbs {
    font-size: 12px;
    margin-bottom: 8px;
  }
  
  .file-row {
    padding: 12px;
  }
}

/* Login Modal */
#login-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#login-modal.visible {
  display: flex;
}

/* Inline auth-required notice when directory is protected */
.auth-required {
  padding: 20px;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
  background: #fffaf8;
  color: #92400e;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.auth-required .meta { color: #92400e; font-weight: 600; }
.auth-required button {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg,#3b82f6 0%,#2563eb 100%);
  color: #fff;
  font-weight: 600;
}
.auth-required button + button { background: #64748b; margin-left: 8px; }

.login-box {
  background: #fff;
  padding: 32px 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 380px;
}

.login-box h2 {
  margin-bottom: 24px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: #0f172a;
}

.login-box input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.login-box input:focus {
  outline: none;
  border-color: #3b82f6;
}

.login-box button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.login-box button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.login-error {
  color: #ef4444;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  display: none;
}

.login-error.visible {
  display: block;
}

#logout-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

#logout-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* user display styling */
#user-display { display: flex; align-items: center; gap: 8px; }
#username-display { color: #fff; font-weight: 600; }
#user-action { background: transparent; border: 1px solid rgba(255,255,255,0.1); color: #e2e8f0; padding: 6px 10px; border-radius: 6px; cursor: pointer; }

/* Toast notification (bottom-right bubble) */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #10b981;
  color: #fff;
  padding: 14px 20px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
  font-size: 14px;
  font-weight: 500;
  max-width: 320px;
  word-break: break-word;
  z-index: 2000;
  animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.fadeOut {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}
