:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a26;
  --bg-hover: #22223a;
  --border: #2a2a3e;
  --text-primary: #e8e8f0;
  --text-secondary: #9090a8;
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --green: #00d68f;
  --orange: #ff9f43;
  --red: #ff6b6b;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(108, 92, 231, 0.08), transparent),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(0, 214, 143, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ── Header ───────────────────────────────────────────────── */

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-icon { font-size: 26px; color: var(--accent); text-shadow: 0 0 20px var(--accent-glow); }
.logo-text h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; white-space: nowrap; }
.tagline { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

/* Menu hamburger (visible only on mobile) */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 22px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1;
}

nav { display: flex; gap: 4px; align-items: center; }

.nav-link {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active { color: var(--accent); background: rgba(108, 92, 231, 0.12); }
.logout-link { font-size: 18px; padding: 7px 10px; }

/* ── Main ─────────────────────────────────────────────────── */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
  position: relative;
  z-index: 1;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-header h2 { font-size: 20px; font-weight: 600; }
.file-count { font-size: 13px; color: var(--text-secondary); background: var(--bg-card); padding: 3px 12px; border-radius: 20px; border: 1px solid var(--border); }

/* ── Files grid ───────────────────────────────────────────── */

.files-grid { display: grid; gap: 8px; }

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  padding: 16px 4px 4px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.category-header:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
.cat-icon { font-size: 18px; }
.cat-count {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 1px 10px;
  border-radius: 12px;
  margin-left: auto;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-primary);
}
.file-card:hover { background: var(--bg-hover); border-color: var(--accent); }

.file-icon {
  font-size: 20px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.file-info { flex: 1; min-width: 0; }
.file-info h3 { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info p { font-size: 12px; color: var(--text-secondary); }

.file-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.file-size, .file-date { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

.file-download {
  padding: 5px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}
.file-download:hover { background: #7c6ff0; box-shadow: 0 0 20px var(--accent-glow); }

.file-delete {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255, 107, 107, 0.15);
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}
.file-delete:hover { background: rgba(255, 107, 107, 0.15); border-color: rgba(255, 107, 107, 0.4); }

/* ── Empty state ──────────────────────────────────────────── */

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-state .big-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text-primary); }
.empty-state p { font-size: 13px; }

/* ── Loading ──────────────────────────────────────────────── */

.loading { text-align: center; padding: 40px; color: var(--text-secondary); }

/* ── Apps grid ────────────────────────────────────────────── */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.app-card {
  display: flex;
  gap: 14px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
}
.app-card:hover { border-color: var(--accent); }
.app-card.placeholder { opacity: 0.5; border-style: dashed; cursor: default; }

.app-icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.app-info { flex: 1; }
.app-info h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.app-info p { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }

.app-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 20px;
}
.app-status.available { color: var(--green); background: rgba(0, 214, 143, 0.1); border: 1px solid rgba(0, 214, 143, 0.2); }
.app-status.soon { color: var(--orange); background: rgba(255, 159, 67, 0.1); border: 1px solid rgba(255, 159, 67, 0.2); }

/* ── Settings ─────────────────────────────────────────────── */

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
}
.settings-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 20px; }

.settings-card .form-group { margin-bottom: 16px; }
.settings-card .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.settings-card .form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.settings-card .form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.settings-msg { margin-top: 12px; font-size: 14px; min-height: 20px; }
.settings-msg.success { color: var(--green); }
.settings-msg.error { color: var(--red); }

/* ── Footer ───────────────────────────────────────────────── */

footer { text-align: center; padding: 28px 16px; color: var(--text-secondary); font-size: 12px; position: relative; z-index: 1; }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
  .header-content { padding: 10px 16px; }
  .logo-text h1 { font-size: 15px; }
  .tagline { display: none; }

  .menu-toggle { display: block; }

  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
    gap: 2px;
  }
  nav.open { display: flex; }

  .nav-link { padding: 10px 14px; font-size: 15px; width: 100%; }

  main { padding: 16px; }

  .file-meta .file-date { display: none; }
  .file-meta .file-size { display: none; }
  .file-card { padding: 10px 12px; gap: 10px; }

  .apps-grid { grid-template-columns: 1fr; }
  .settings-card { padding: 20px; }
}

@media (max-width: 480px) {
  .file-icon { width: 32px; height: 32px; font-size: 16px; }
  .file-info h3 { font-size: 13px; }
  .file-info p { display: none; }
  .file-download { padding: 5px 10px; font-size: 13px; }
  .file-delete { width: 30px; height: 30px; font-size: 13px; }
}

/* ── Scrollbar ────────────────────────────────────────────── */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
