@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #000000;
  --surface: #0c0c0c;
  --surface-raised: #1c1c1c;
  --line: #2e2e2e;
  --text: #ffffff;
  --text-dim: #8f8f8f;
  --accent: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.1);
  --danger: #ffffff;
  --danger-soft: rgba(255, 255, 255, 0.1);
  --success: #ffffff;
  --success-soft: rgba(255, 255, 255, 0.1);
  --radius: 8px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Elementy wspolne ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--text);
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn:hover {
  border-color: var(--text-dim);
}
.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

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

.btn-danger {
  color: var(--text);
}
.btn-danger:hover {
  border-color: var(--text);
  background: var(--text);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-raised);
  border-color: var(--line);
}

.btn-icon {
  padding: 7px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input[type='text'],
input[type='password'] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input[type='text']:focus,
input[type='password']:focus {
  border-color: var(--accent);
  outline: none;
}

select {
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* ---------- Strona logowania ---------- */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 36px 32px;
}

.login-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.login-wordmark .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.login-tagline {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 28px;
}

.login-error {
  display: none;
  background: var(--text);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.login-error.visible {
  display: block;
}

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

.login-card .btn-primary {
  justify-content: center;
  padding: 11px 16px;
}

/* ---------- Uklad aplikacji ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px;
}
.wordmark .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.upload-btn {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-dim);
  background: transparent;
  border: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.nav-item:hover {
  background: var(--surface-raised);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Miernik pojemnosci - element sygnaturowy */
.gauge {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.gauge-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.gauge-label .used {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.gauge-label .max {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.gauge-rack {
  display: flex;
  gap: 3px;
  height: 34px;
}
.gauge-segment {
  flex: 1;
  border-radius: 2px;
  background: var(--line);
}
.gauge-segment.filled {
  background: var(--accent);
}
.gauge-segment.warn {
  background: transparent;
  border: 1.5px solid var(--text);
}
.gauge-caption {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.logout-btn {
  width: 100%;
  justify-content: flex-start;
  color: var(--text-dim);
}

/* ---------- Glowna tresc ---------- */

.main {
  padding: 24px 32px 60px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}
.breadcrumb button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 3px 5px;
  border-radius: 4px;
}
.breadcrumb button:hover {
  background: var(--surface-raised);
  color: var(--text);
}
.breadcrumb button.current {
  color: var(--text);
}
.breadcrumb .sep {
  color: var(--line);
}

.toolbar {
  display: flex;
  gap: 8px;
}

.selection-bar {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
}
.selection-bar.visible {
  display: flex;
}
.selection-bar .count {
  font-size: 13px;
  color: var(--text-dim);
  margin-right: auto;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.file-table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 500;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
}
.file-table th.col-size,
.file-table td.col-size {
  text-align: right;
  width: 100px;
}
.file-table th.col-modified,
.file-table td.col-modified {
  width: 150px;
}
.file-table th.col-select,
.file-table td.col-select {
  width: 34px;
}
.file-table th.col-actions,
.file-table td.col-actions {
  width: 150px;
}

.file-row td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.file-row:hover {
  background: var(--surface);
}
.file-row.selected {
  background: var(--accent-soft);
}

.file-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.file-name button.open {
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row .icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--text-dim);
}
.file-row .icon.folder {
  color: var(--accent);
}

.file-table td.col-size,
.file-table td.col-modified {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
}

.row-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
}
.file-row:hover .row-actions,
.file-row:focus-within .row-actions {
  opacity: 1;
}

.empty-state {
  text-align: center;
  padding: 90px 20px;
  color: var(--text-dim);
}
.empty-state .icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  opacity: 0.5;
}
.empty-state h3 {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 17px;
  margin: 0 0 6px;
}
.empty-state p {
  margin: 0;
  font-size: 13.5px;
}

/* ---------- Panel udostepnionych ---------- */

.shares-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.share-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
}
.share-item .info {
  min-width: 0;
  flex: 1;
}
.share-item .name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-item .meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 3px;
}
.share-item .meta.expired {
  color: var(--text);
  font-weight: 600;
}
.share-item .actions {
  display: flex;
  gap: 6px;
  flex: none;
}

/* ---------- Modale ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-backdrop.visible {
  display: flex;
}
.modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
.modal h2 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0 0 18px;
}
.modal .field {
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.share-link-row {
  display: flex;
  gap: 8px;
}
.share-link-row input {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* ---------- Powiadomienia (toast) ---------- */

.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
}
.toast {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.18s ease;
}
.toast.error {
  background: var(--text);
  border-color: var(--text);
  color: var(--ink);
  font-weight: 500;
}
.toast.success {
  border-color: var(--success);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Pasek postepu przesylania ---------- */

.upload-progress-card {
  width: 260px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.18s ease;
}
.upload-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 9px;
}
.upload-progress-label .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-progress-pct {
  font-family: var(--font-mono);
  color: var(--text);
  flex: none;
}
.upload-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--text);
  border-radius: 2px;
  transition: width 0.12s ease;
}

/* ---------- Strefa przeciagania plikow ---------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  border: 2px dashed var(--accent);
  margin: 14px;
  border-radius: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  pointer-events: none;
}
.drop-overlay.visible {
  display: flex;
}
.drop-overlay span {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--accent);
}

/* ---------- Responsywnosc ---------- */

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 16px;
  }
  .wordmark {
    padding: 0;
  }
  .upload-btn {
    width: auto;
    order: 2;
  }
  .nav {
    flex-direction: row;
    order: 3;
  }
  .gauge {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    order: 4;
    flex: 1 1 100%;
  }
  .logout-btn {
    width: auto;
    order: 5;
  }
  .main {
    padding: 18px 16px 110px;
  }
  .file-table th.col-modified,
  .file-table td.col-modified {
    display: none;
  }
  .file-table th.col-size,
  .file-table td.col-size {
    width: 58px;
    font-size: 11px;
  }
  .file-table th.col-actions,
  .file-table td.col-actions {
    width: 128px;
  }

  /* Ikony akcji przy pliku dzialaly tylko na hover, ktorego telefon nie ma -
     na mobile maja byc widoczne od razu, z wieksza strefa dotyku. */
  .row-actions {
    opacity: 1;
    gap: 0;
  }
  .row-actions .btn-icon {
    padding: 9px 7px;
  }

  /* Pasek zaznaczenia jako przypiety dol ekranu, zamiast wypychac przyciski
     poza widoczna szerokosc - tekst licznika ląduje na osobnej linii. */
  .selection-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 70;
    flex-wrap: wrap;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  }
  .selection-bar .count {
    flex: 1 1 100%;
    order: -1;
    margin-right: 0;
    margin-bottom: 4px;
  }
  .selection-bar .btn-icon {
    flex: 1;
    justify-content: center;
    padding: 11px 7px;
  }

  /* Powiadomienia i pasek postepu na gorze ekranu - u dolu na czesci
     przegladarek mobilnych potrafi je zaslaniac pasek narzedzi. */
  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: auto;
    top: 12px;
  }
  .upload-progress-card {
    width: auto;
  }
}
