/* ============================================
   MiniDrive – Global CSS Design System
   Dark mode, premium UI
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── TOKENS ──────────────────────────────── */
:root {
  --bg-900: #0d0f14;
  --bg-800: #13161e;
  --bg-700: #1a1e28;
  --bg-600: #21263a;
  --bg-500: #2a3048;

  --accent: #4f8ef7;
  --accent-hover: #6aa3ff;
  --accent-glow: rgba(79,142,247,.25);

  --success: #22c55e;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #38bdf8;

  --text-100: #f0f4ff;
  --text-300: #9aa3b8;
  --text-500: #5a6480;

  --border: rgba(255,255,255,.07);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,.45);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);

  --sidebar-w: 240px;
  --topbar-h: 60px;
}

/* ── RESET ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-900);
  color: var(--text-100);
  min-height: 100%;
  line-height: 1.6;
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, svg { display: block; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; }

/* ── SCROLLBAR ───────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-800); }
::-webkit-scrollbar-thumb { background: var(--bg-500); border-radius: 99px; }

/* ── LAYOUT ──────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── TOPBAR ──────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: var(--bg-800);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-100);
  width: var(--sidebar-w);
  flex-shrink: 0;
}
.topbar-logo svg { color: var(--accent); }
.topbar-search {
  flex: 1;
  position: relative;
  max-width: 480px;
}
.topbar-search input {
  width: 100%;
  padding: 8px 16px 8px 40px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-100);
  font-size: 13px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.topbar-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-500);
  pointer-events: none;
  width: 16px; height: 16px;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  position: relative;
}
.avatar-menu {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  width: 200px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  z-index: 100;
}
.avatar-menu.open { display: block; }
.avatar-menu a, .avatar-menu button {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--text-100);
  font-size: 13px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.avatar-menu a:hover, .avatar-menu button:hover { background: var(--bg-600); }
.avatar-menu hr { border: none; border-top: 1px solid var(--border); }
.avatar-name { font-size: 12px; padding: 10px 16px; color: var(--text-300); border-bottom: 1px solid var(--border); }

/* ── SIDEBAR ──────────────────────────────── */
.sidebar {
  background: var(--bg-800);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-500);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 8px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-300);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-700); color: var(--text-100); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item .badge {
  margin-left: auto;
  background: var(--bg-600);
  color: var(--text-300);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 99px;
}

/* ── MAIN ─────────────────────────────────── */
.main-content {
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--bg-900);
}

/* ── PAGE HEADER ──────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  flex: 1;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-300);
  margin-bottom: 4px;
}
.breadcrumb a { color: var(--text-300); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb svg { width: 12px; height: 12px; }

/* ── BUTTONS ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-300); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-700); color: var(--text-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ── CARDS ────────────────────────────────── */
.card {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title svg { width: 18px; height: 18px; color: var(--accent); }

/* ── FILE GRID ────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.file-card {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px 16px;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  text-align: center;
}
.file-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.file-card .file-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.file-card .file-icon svg { width: 32px; height: 32px; }
.file-card .file-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-100);
  word-break: break-word;
  line-height: 1.4;
}
.file-card .file-meta {
  font-size: 11px;
  color: var(--text-500);
}
.file-card .file-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: none;
  gap: 4px;
}
.file-card:hover .file-actions { display: flex; }
.file-card .file-actions button {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-600);
  border: 1px solid var(--border);
  color: var(--text-300);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.file-card .file-actions button:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.file-card .file-actions button svg { width: 14px; height: 14px; }

/* ── FILE LIST ────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 2px; }
.file-row {
  display: grid;
  grid-template-columns: 36px 1fr 120px 100px 120px 100px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.file-row:hover { background: var(--bg-800); border-color: var(--border); }
.file-row .row-icon { color: var(--accent); }
.file-row .row-icon svg { width: 22px; height: 22px; }
.file-row .row-name { font-size: 13px; font-weight: 500; min-width: 0; }
.file-row .row-name a { color: var(--text-100); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .row-meta { font-size: 12px; color: var(--text-500); }
.file-row .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── TABLE ────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-700);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-500);
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: var(--bg-700); }
td { padding: 12px 14px; font-size: 13px; vertical-align: middle; }
td .actions { display: flex; gap: 6px; }

/* ── BADGES ───────────────────────────────── */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge-admin { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-zarzad { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-pracownik { background: rgba(79,142,247,.15); color: var(--accent); }
.badge-active { background: rgba(34,197,94,.15); color: var(--success); }
.badge-inactive { background: rgba(239,68,68,.1); color: var(--danger); }

/* ── FORMS ────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text-300); }
.form-control {
  padding: 10px 14px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-100);
  font-size: 13px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  width: 100%;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-500); }
select.form-control option { background: var(--bg-700); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── DROP ZONE ────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-500);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}
.drop-zone svg { width: 48px; height: 48px; margin: 0 auto 12px; }
.drop-zone p { font-size: 14px; font-weight: 500; }
.drop-zone span { font-size: 12px; }

/* ── ALERTS ───────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border-left: 3px solid;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.alert-success { background: rgba(34,197,94,.1); border-color: var(--success); color: var(--success); }
.alert-danger  { background: rgba(239,68,68,.1);  border-color: var(--danger);  color: var(--danger); }
.alert-info    { background: rgba(56,189,248,.1);  border-color: var(--info);    color: var(--info); }
.alert-warning { background: rgba(245,158,11,.1);  border-color: var(--warning); color: var(--warning); }

/* ── MODAL ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  transform: scale(.96);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; flex: 1; }
.modal-header button { background: none; border: none; color: var(--text-300); cursor: pointer; padding: 4px; transition: color .15s; }
.modal-header button:hover { color: var(--text-100); }
.modal-header button svg { width: 18px; height: 18px; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── STATS ────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-content {}
.stat-value { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-300); margin-top: 4px; }

/* ── LOGIN PAGE ───────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-900);
  background-image: radial-gradient(ellipse at 20% 30%, rgba(79,142,247,.08) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 70%, rgba(124,58,237,.06) 0%, transparent 60%);
  padding: 24px;
}
.login-card {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-size: 22px;
  font-weight: 700;
}
.login-logo svg { color: var(--accent); width: 32px; height: 32px; }
.login-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.login-card p { color: var(--text-300); font-size: 13px; margin-bottom: 28px; }

/* ── UPLOAD PROGRESS ──────────────────────── */
.upload-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.upload-item { background: var(--bg-700); border-radius: var(--radius-sm); padding: 12px 14px; }
.upload-item-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.progress-bar { height: 4px; background: var(--bg-600); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* ── FOLDER COLOR DOTS ────────────────────── */
.folder-icon { color: var(--warning); }
.file-pdf { color: #ef4444; }
.file-doc { color: #3b82f6; }
.file-xls { color: #22c55e; }
.file-img { color: #a855f7; }
.file-zip { color: #f59e0b; }
.file-vid { color: #ec4899; }
.file-mus { color: #06b6d4; }
.file-def { color: var(--text-300); }

/* ── UTILS ────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-300); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 64px 24px; gap: 16px; color: var(--text-500);
  text-align: center;
}
.empty-state svg { width: 64px; height: 64px; opacity: .3; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-300); }
.empty-state p { font-size: 13px; max-width: 320px; }

/* ── RESPONSIVE ───────────────────────────── */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
  }
  .sidebar { display: none; }
  .main-content { padding: 16px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .file-row { grid-template-columns: 36px 1fr 80px; }
  .file-row .row-meta:nth-child(3),
  .file-row .row-meta:nth-child(4) { display: none; }
}
