/* ─── Modern Design Tokens ───────────────────────────────────────────── */
:root {
  --bg-main: #0c0f17;
  --bg-card: rgba(22, 28, 45, 0.75);
  --bg-card-hover: rgba(30, 39, 63, 0.85);
  --bg-input: rgba(15, 20, 33, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(66, 153, 225, 0.4);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.25);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at center, rgba(6, 182, 212, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px;
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ─── Header ─────────────────────────────────────────────────────────── */
.header {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(12, 15, 23, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  transition: var(--transition-fast);
}

.back-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-highlight);
  transform: translateX(-2px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35em;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
  color: #fff;
  font-size: 1.1em;
}

.brand-name {
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82em;
  font-weight: 500;
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.fallback {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ─── Main Container ─────────────────────────────────────────────────── */
.main-content {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 35px 20px 60px;
  flex: 1;
}

/* ─── Auth Card (Login) ──────────────────────────────────────────────── */
.auth-wrapper {
  min-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: center;
  animation: slide-up 0.4s ease-out;
}

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

.auth-icon {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8em;
  color: var(--accent-cyan);
  margin-bottom: 22px;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

.auth-title {
  font-size: 1.6em;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.92em;
  line-height: 1.45;
  margin-bottom: 28px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  position: relative;
}

.auth-input {
  width: 100%;
  padding: 13px 44px 13px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 1em;
  transition: var(--transition-fast);
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: rgba(15, 20, 33, 0.95);
}

.input-toggle-pw {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1em;
  padding: 4px;
}

.input-toggle-pw:hover {
  color: var(--text-main);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #2563eb);
  color: #fff;
  border: none;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.98em;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
  filter: brightness(1.1);
}

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

.auth-hint {
  font-size: 0.85em;
  color: var(--text-dim);
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

.auth-hint code {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ─── Upload Dropzone ────────────────────────────────────────────────── */
.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-bottom: 35px;
  position: relative;
  overflow: hidden;
}

.upload-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan), var(--accent-purple));
}

.dropzone {
  border: 2px dashed rgba(66, 153, 225, 0.35);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  background: rgba(15, 20, 33, 0.4);
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.06);
  transform: scale(1.005);
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.15);
}

.dropzone-icon {
  font-size: 3.2em;
  color: var(--accent-blue);
  margin-bottom: 14px;
  transition: transform 0.3s ease;
  display: inline-block;
}

.dropzone:hover .dropzone-icon,
.dropzone.dragover .dropzone-icon {
  transform: translateY(-6px) scale(1.1);
  color: var(--accent-cyan);
}

.dropzone-title {
  font-size: 1.25em;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.dropzone-desc {
  font-size: 0.9em;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.dropzone-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.paste-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84em;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 14px;
  border-radius: 20px;
  margin-top: 16px;
  border: 1px solid var(--border-color);
}

.paste-tip kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9em;
  color: var(--accent-cyan);
}

/* ─── Upload Progress ────────────────────────────────────────────────── */
.progress-panel {
  display: none;
  margin-top: 20px;
  padding: 16px;
  background: rgba(15, 20, 33, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9em;
}

.progress-filename {
  font-weight: 500;
  color: #fff;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-percent {
  color: var(--accent-cyan);
  font-weight: 600;
}

.progress-bar-container {
  height: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  border-radius: 10px;
  transition: width 0.15s ease-out;
}

/* ─── Files Section ──────────────────────────────────────────────────── */
.files-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title {
  font-size: 1.35em;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  font-size: 0.82em;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.88em;
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px 12px 8px 34px;
  font-size: 0.88em;
  font-family: inherit;
  outline: none;
  width: 200px;
  transition: var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent-blue);
  width: 240px;
}

.sort-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 0.88em;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.btn-icon {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  color: #fff;
  border-color: var(--border-highlight);
  background: rgba(255, 255, 255, 0.06);
}

.btn-icon.spinning i {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── Files Grid / List ──────────────────────────────────────────────── */
.files-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition-fast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.file-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.file-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.file-type-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3em;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Typy ikon */
.icon-pdf { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.icon-word { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.icon-excel { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.icon-powerpoint { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.icon-archive { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.icon-image { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }
.icon-video { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.icon-audio { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.icon-code { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.3); }
.icon-generic { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }

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

.file-name {
  font-weight: 600;
  color: #fff;
  font-size: 1em;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82em;
  color: var(--text-muted);
}

.file-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-action {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86em;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.btn-download-direct {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.25);
}

.btn-download-direct:hover {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.4);
}

.btn-download-server {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-download-server:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-highlight);
}

.btn-copy-link {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.2);
}

.btn-copy-link:hover {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.4);
}

.btn-delete {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-delete:hover {
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

/* ─── Empty State ────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 3.5em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.empty-title {
  font-size: 1.25em;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 0.9em;
  color: var(--text-muted);
}

/* ─── Toast Notifications ────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 20, 33, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: #fff;
  font-size: 0.9em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease-out;
  pointer-events: auto;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); color: #34d399; }
.toast.error { border-color: rgba(239, 68, 68, 0.4); color: #f87171; }
.toast.info { border-color: rgba(59, 130, 246, 0.4); color: #60a5fa; }

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

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header {
    padding: 0 16px;
  }
  .file-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .file-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 10px;
  }
  .section-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-right {
    flex-wrap: wrap;
  }
  .search-input {
    width: 100%;
  }
  .search-input:focus {
    width: 100%;
  }
}
