/* ============================================================
   FileVault - CSS Stylesheet
   ============================================================ */

/* --- Custom Properties / Theme --- */
:root {
  --color-primary: #2c3e50;
  --color-primary-light: #34495e;
  --color-primary-dark: #1a252f;
  --color-accent: #3498db;
  --color-accent-hover: #2980b9;
  --color-success: #27ae60;
  --color-warning: #f39c12;
  --color-danger: #e74c3c;
  --color-danger-hover: #c0392b;
  --color-grey: #95a5a6;
  --color-grey-light: #ecf0f1;
  --color-grey-dark: #7f8c8d;
  --color-bg: #f5f6fa;
  --color-bg-card: #ffffff;
  --color-text: #2c3e50;
  --color-text-secondary: #7f8c8d;
  --color-border: #dcdde1;
  --color-header-bg: #2c3e50;
  --color-header-text: #ffffff;
  --color-sidebar-bg: #ffffff;
  --color-sidebar-border: #e0e0e0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --sidebar-width: 280px;
  --header-height: 56px;
  --transition: 0.2s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

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

.text-center {
  text-align: center;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}

.login-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  margin: 20px;
}

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 8px;
  text-align: center;
}

.login-card .login-subtitle {
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 32px;
  font-size: 14px;
}

.login-card .form-group {
  margin-bottom: 20px;
}

.login-card label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: 13px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color var(--transition);
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.login-card .login-error {
  color: var(--color-danger);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 20px;
}

.login-card .btn-login {
  width: 100%;
  padding: 12px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  transition: background var(--transition);
}

.login-card .btn-login:hover {
  background: var(--color-accent-hover);
}

.login-card .btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Header --- */
.header {
  height: var(--header-height);
  background: var(--color-header-bg);
  color: var(--color-header-text);
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: var(--shadow-sm);
  z-index: 100;
  flex-shrink: 0;
}

.header-logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-right: 24px;
  white-space: nowrap;
}

.header-usage {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 13px;
  white-space: nowrap;
}

.usage-bar-container {
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.usage-bar-fill.warning {
  background: var(--color-warning);
}

.usage-bar-fill.danger {
  background: var(--color-danger);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 24px;
}

.header-user .username {
  font-weight: 500;
}

.btn-logout {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background var(--transition);
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-hamburger {
  display: none;
  background: none;
  color: #fff;
  font-size: 22px;
  margin-right: 12px;
  padding: 4px;
}

/* --- Body (sidebar + main) --- */
.dashboard-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 16px 20px 12px;
  font-weight: 700;
  font-size: 13px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header .btn-new-folder {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.sidebar-header .btn-new-folder:hover {
  background: var(--color-accent-hover);
}

.sidebar-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* --- Folder Tree --- */
.tree-node {
  user-select: none;
}

.tree-node-label {
  display: flex;
  align-items: center;
  padding: 6px 16px 6px calc(16px + var(--depth, 0) * 20px);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 13px;
  gap: 6px;
  border-radius: 0;
}

.tree-node-label:hover {
  background: var(--color-grey-light);
}

.tree-node-label.active {
  background: rgba(52, 152, 219, 0.1);
  color: var(--color-accent);
  font-weight: 600;
}

.tree-node-label .tree-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.tree-node-label .tree-toggle {
  font-size: 10px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  color: var(--color-grey-dark);
  transition: transform var(--transition);
}

.tree-node-label .tree-toggle.expanded {
  transform: rotate(90deg);
}

.tree-node-label .tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-children {
  overflow: hidden;
}

.tree-children.collapsed {
  display: none;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg);
}

/* --- Toolbar --- */
.toolbar {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-card);
  flex-wrap: wrap;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 13px;
}

.breadcrumb-item {
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.breadcrumb-item:hover {
  color: var(--color-accent);
  background: rgba(52, 152, 219, 0.06);
}

.breadcrumb-item.current {
  color: var(--color-text);
  font-weight: 600;
  cursor: default;
}

.breadcrumb-item.current:hover {
  background: none;
}

.breadcrumb-sep {
  color: var(--color-grey);
  font-size: 11px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-toolbar {
  padding: 7px 14px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color var(--transition), background var(--transition);
}

.btn-toolbar:hover {
  border-color: var(--color-accent);
  background: rgba(52, 152, 219, 0.04);
}

.btn-toolbar.primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.btn-toolbar.primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* --- File Area --- */
.file-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* --- Drag & Drop Zone --- */
.drop-zone {
  position: relative;
  min-height: 100%;
}

.drop-zone.drag-over::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(52, 152, 219, 0.08);
  border: 2px dashed var(--color-accent);
  border-radius: var(--radius-md);
  z-index: 50;
  pointer-events: none;
}

.drop-zone-placeholder {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
  text-align: center;
}

.drop-zone-placeholder.visible {
  display: flex;
}

.drop-zone-placeholder .drop-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.drop-zone-placeholder .drop-text {
  font-size: 16px;
  margin-bottom: 8px;
}

.drop-zone-placeholder .drop-hint {
  font-size: 13px;
  color: var(--color-grey);
}

/* --- File Grid View --- */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.file-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

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

.file-card .file-icon {
  font-size: 40px;
  margin-bottom: 10px;
  line-height: 1;
}

.file-card .file-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.file-card .file-name {
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
  max-height: 2.8em;
  overflow: hidden;
  line-height: 1.4;
  margin-bottom: 6px;
  width: 100%;
}

.file-card .file-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.file-card .file-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}

.file-card:hover .file-actions {
  opacity: 1;
}

.file-card .file-actions .btn-action {
  padding: 4px 6px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-text-secondary);
  transition: color var(--transition);
}

.file-card .file-actions .btn-action:hover {
  color: var(--color-accent);
}

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

.file-list-header {
  display: grid;
  grid-template-columns: 40px 1fr 100px 100px 120px 100px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--color-border);
}

.file-row {
  display: grid;
  grid-template-columns: 40px 1fr 100px 100px 120px 100px;
  padding: 10px 16px;
  align-items: center;
  background: var(--color-bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 13px;
}

.file-row:hover {
  background: var(--color-grey-light);
}

.file-row .file-icon {
  font-size: 20px;
}

.file-row .file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .file-size,
.file-row .file-date {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.file-row .file-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.file-row:hover .file-row-actions {
  opacity: 1;
}

.file-row .btn-action {
  padding: 4px 6px;
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.file-row .btn-action:hover {
  color: var(--color-accent);
  background: rgba(52, 152, 219, 0.08);
}

/* ============================================================
   ACCESS BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.6;
}

.badge-public {
  background: rgba(39, 174, 96, 0.12);
  color: var(--color-success);
}

.badge-temporary {
  background: rgba(243, 156, 18, 0.12);
  color: var(--color-warning);
}

.badge-private {
  background: rgba(231, 76, 60, 0.12);
  color: var(--color-danger);
}

.badge-expired {
  background: rgba(149, 165, 166, 0.15);
  color: var(--color-grey);
}

/* ============================================================
   CATALOG CHECKBOX (inline)
   ============================================================ */
.catalog-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-secondary);
  cursor: pointer;
  margin-left: 6px;
}

.catalog-toggle input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--color-accent);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  margin: 20px;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  font-size: 22px;
  color: var(--color-grey-dark);
  padding: 4px;
  transition: color var(--transition);
}

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

.modal-body {
  padding: 20px 24px;
}

.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
}

.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}

.modal-body input:focus,
.modal-body select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.modal-body .checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body .checkbox-group input[type="checkbox"] {
  accent-color: var(--color-accent);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--color-border);
}

.btn-modal {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition);
}

.btn-modal.cancel {
  background: var(--color-grey-light);
  color: var(--color-text);
}

.btn-modal.cancel:hover {
  background: #dfe4ea;
}

.btn-modal.confirm {
  background: var(--color-accent);
  color: #fff;
}

.btn-modal.confirm:hover {
  background: var(--color-accent-hover);
}

.btn-modal.danger {
  background: var(--color-danger);
  color: #fff;
}

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

/* --- Folder Picker inside Modal --- */
.folder-picker {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 0;
}

.folder-picker-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition);
}

.folder-picker-item:hover {
  background: var(--color-grey-light);
}

.folder-picker-item.selected {
  background: rgba(52, 152, 219, 0.1);
  color: var(--color-accent);
  font-weight: 600;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--color-primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  max-width: 380px;
  pointer-events: auto;
  animation: toast-in 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.toast.error {
  background: var(--color-danger);
}

.toast.warning {
  background: var(--color-warning);
  color: var(--color-primary);
}

.toast.removing {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(60px);
  }
}

/* ============================================================
   UPLOAD PROGRESS BAR
   ============================================================ */
.upload-progress-container {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 1500;
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 16px 20px;
  min-width: 320px;
  max-width: 400px;
}

.upload-progress-container.hidden {
  display: none;
}

.upload-progress-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.upload-progress-item {
  margin-bottom: 10px;
}

.upload-progress-item:last-child {
  margin-bottom: 0;
}

.upload-progress-name {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-grey-light);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width 0.2s ease;
  width: 0%;
}

.progress-bar-fill.done {
  background: var(--color-success);
}

.progress-bar-fill.error {
  background: var(--color-danger);
}

/* ============================================================
   FILE ICONS
   ============================================================ */
.icon-folder { color: #f39c12; }
.icon-image { color: #8e44ad; }
.icon-video { color: #e74c3c; }
.icon-audio { color: #e67e22; }
.icon-pdf { color: #c0392b; }
.icon-document { color: #2980b9; }
.icon-archive { color: #7f8c8d; }
.icon-code { color: #27ae60; }
.icon-html { color: #e44d26; }
.icon-text { color: #34495e; }
.icon-file { color: #95a5a6; }

/* ============================================================
   SHARE PAGE
   ============================================================ */
.share-page {
  min-height: 100vh;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.share-header {
  width: 100%;
  background: var(--color-header-bg);
  color: var(--color-header-text);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-header .share-logo {
  font-size: 16px;
  font-weight: 700;
}

.share-container {
  width: 100%;
  max-width: 95vw;
  padding: 16px 8px;
  flex: 1;
}

.share-file-info {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.share-file-info .file-icon {
  font-size: 36px;
}

.share-file-info .file-details {
  flex: 1;
}

.share-file-info .file-details h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-word;
}

.share-file-info .file-details .file-meta {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.share-file-info .btn-download {
  padding: 10px 24px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition);
  white-space: nowrap;
}

.share-file-info .btn-download:hover {
  background: var(--color-accent-hover);
}

.share-preview {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 200px;
}

.share-preview iframe {
  width: 100%;
  min-height: 600px;
  border: none;
}

/* HTML preview: full-page mode */
.share-html-mode {
  height: 100vh;
}

.share-html-mode .share-container {
  max-width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.share-html-mode .share-file-info {
  padding: 8px 16px;
  margin-bottom: 0;
  border-radius: 0;
  font-size: 13px;
  gap: 10px;
}

.share-html-mode .share-file-info .file-icon {
  font-size: 20px !important;
}

.share-html-mode .share-file-info .file-details h2 {
  font-size: 14px;
  margin-bottom: 0;
}

.share-html-mode .share-file-info .file-details .file-meta {
  font-size: 11px;
}

.share-html-mode .share-file-info .btn-download {
  padding: 6px 14px;
  font-size: 12px;
}

.share-html-mode .share-preview {
  flex: 1;
  border-radius: 0;
  min-height: 0;
}

.share-html-mode .share-preview iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.share-preview img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.share-preview video {
  width: 100%;
  max-height: 80vh;
  display: block;
}

.share-preview audio {
  width: 100%;
  display: block;
  padding: 32px 24px;
  min-height: 80px;
}

.share-preview embed {
  width: 100%;
  min-height: 600px;
}

.share-preview .no-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--color-text-secondary);
}

.share-preview .no-preview .no-preview-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.share-preview .no-preview p {
  font-size: 15px;
}

.share-error {
  text-align: center;
  padding: 80px 24px;
}

.share-error .error-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.share-error h2 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--color-text);
}

.share-error p {
  color: var(--color-text-secondary);
  font-size: 15px;
}

/* ============================================================
   CATALOG PAGE
   ============================================================ */
.catalog-page {
  min-height: 100vh;
  background: var(--color-bg);
}

.catalog-header {
  background: var(--color-header-bg);
  color: var(--color-header-text);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.catalog-header h1 {
  font-size: 18px;
  font-weight: 700;
}

.catalog-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
}

.filter-btn {
  padding: 7px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--color-text);
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--color-accent);
}

.filter-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding: 8px 24px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.catalog-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}

.catalog-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.catalog-card .card-thumb {
  width: 100%;
  height: 160px;
  background: var(--color-grey-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  overflow: hidden;
}

.catalog-card .card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-card .card-body {
  padding: 14px 16px;
}

.catalog-card .card-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-card .card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.catalog-card .card-meta .card-owner {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-load-more {
  text-align: center;
  padding: 24px;
}

.btn-load-more {
  padding: 10px 32px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition);
}

.btn-load-more:hover {
  background: var(--color-accent-hover);
}

.catalog-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--color-text-secondary);
  font-size: 15px;
}

/* ============================================================
   ADMIN LOGIN LINK (on catalog page)
   ============================================================ */
.admin-login-link {
  position: fixed;
  bottom: 16px;
  right: 16px;
  color: rgba(0, 0, 0, 0.15);
  font-size: 12px;
  text-decoration: none;
  z-index: 10;
  transition: color 0.2s;
}

.admin-login-link:hover {
  color: rgba(0, 0, 0, 0.4);
  text-decoration: none;
}

/* ============================================================
   DRAG & DROP BETWEEN FOLDERS
   ============================================================ */
.file-card.drag-over,
.file-row.drag-over,
.tree-node-label.drag-over {
  outline: 2px dashed var(--color-accent);
  background: rgba(52, 152, 219, 0.1);
}

/* ============================================================
   RESPONSIVE (Mobile < 768px)
   ============================================================ */
@media (max-width: 768px) {
  .btn-hamburger {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-height);
    background: rgba(0, 0, 0, 0.3);
    z-index: 89;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .header-usage {
    display: none;
  }

  .toolbar {
    padding: 10px 16px;
  }

  .file-area {
    padding: 16px;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .file-list-header {
    display: none;
  }

  .file-row {
    grid-template-columns: 32px 1fr 80px;
  }

  .file-row .file-size,
  .file-row .file-date,
  .file-row .file-row-actions {
    display: none;
  }

  .modal {
    max-width: 100%;
    margin: 10px;
  }

  .upload-progress-container {
    left: 16px;
    right: 16px;
    min-width: auto;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    max-width: 100%;
  }

  .share-file-info {
    flex-direction: column;
    text-align: center;
  }

  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 8px 16px 32px;
  }

  .catalog-filters {
    padding: 12px 16px;
  }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ============================================================
   CONTEXT MENU (right-click on files)
   ============================================================ */
.context-menu {
  position: fixed;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  min-width: 180px;
  padding: 6px 0;
}

.context-menu-item {
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition);
}

.context-menu-item:hover {
  background: var(--color-grey-light);
}

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

.context-menu-sep {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}
