/* ============================================================
   ARKIVA — Design System
   Oscuro, moderno, con acentos glass + gradientes.
   ============================================================ */

:root {
  --bg-0: #06070a;
  --bg-1: #0b0d13;
  --bg-2: #12141c;
  --bg-3: #191c26;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.05);

  --text-0: #f5f6fa;
  --text-1: #c7cad4;
  --text-2: #8b8f9e;
  --text-3: #5b5f6e;

  --accent-a: #7c5cff;
  --accent-b: #35d0ff;
  --accent-c: #ff5ca8;
  --gradient-brand: linear-gradient(135deg, var(--accent-a) 0%, var(--accent-b) 100%);
  --gradient-warm: linear-gradient(135deg, #ff9a5c 0%, var(--accent-c) 100%);

  --success: #37e6a0;
  --warning: #ffc857;
  --danger: #ff5c7a;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 999px;

  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 40px rgba(124, 92, 255, 0.25);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 15% 0%, rgba(124, 92, 255, 0.16) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(53, 208, 255, 0.10) 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 92, 168, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; }

::selection { background: var(--accent-a); color: white; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: var(--radius-full); border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- Layout genérico ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--gradient-brand);
  color: #08090d;
  box-shadow: 0 6px 24px rgba(124, 92, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 32px rgba(124, 92, 255, 0.5); transform: translateY(-1px); }
.btn-ghost {
  background: var(--surface);
  color: var(--text-0);
  border-color: var(--border);
  backdrop-filter: blur(12px);
}
.btn-ghost:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.18); }
.btn-danger { background: rgba(255, 92, 122, 0.14); color: #ff8fa3; border-color: rgba(255,92,122,0.3); }
.btn-danger:hover { background: rgba(255, 92, 122, 0.22); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---------- Glass card ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
}

/* ---------- Landing ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0;
  backdrop-filter: blur(16px);
  background: rgba(6, 7, 10, 0.6);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(124,92,255,0.5);
  font-weight: 900; color: #06070a;
}
.nav-links { display: flex; gap: 10px; align-items: center; }

.hero { padding: 110px 0 90px; text-align: center; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--radius-full);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-1); margin-bottom: 28px;
}
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 22px;
}
.hero h1 .grad {
  background: var(--gradient-brand);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { font-size: 18px; color: var(--text-1); max-width: 600px; margin: 0 auto 40px; line-height: 1.6; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.features { padding: 60px 0 120px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature-card { padding: 28px; transition: transform 0.3s var(--ease), border-color 0.3s var(--ease); }
.feature-card:hover { transform: translateY(-4px); border-color: rgba(124,92,255,0.4); }
.feature-icon {
  width: 46px; height: 46px; border-radius: 12px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gradient-brand); color: #08090d;
}
.feature-card h3 { margin: 0 0 8px; font-size: 17px; }
.feature-card p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }

.footer { padding: 40px 0; text-align: center; color: var(--text-3); font-size: 13px; border-top: 1px solid var(--border-soft); }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card { width: 100%; max-width: 420px; padding: 40px 34px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; text-align: center; }
.auth-card p.sub { text-align: center; color: var(--text-2); margin: 0 0 28px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-1); margin-bottom: 7px; font-weight: 600; }
.field input {
  width: 100%; padding: 13px 15px; border-radius: var(--radius-md);
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-0);
  font-size: 14.5px; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field input:focus { outline: none; border-color: var(--accent-a); box-shadow: 0 0 0 3px rgba(124,92,255,0.2); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--text-3); font-size: 12.5px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-alt { text-align: center; margin-top: 22px; font-size: 13.5px; color: var(--text-2); }
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 13.5px; margin-bottom: 18px; }
.alert-error { background: rgba(255,92,122,0.12); color: #ff9caa; border: 1px solid rgba(255,92,122,0.3); }
.alert-success { background: rgba(55,230,160,0.1); color: #6ff2b8; border: 1px solid rgba(55,230,160,0.28); }
.alert-info { background: rgba(53,208,255,0.1); color: #86e3ff; border: 1px solid rgba(53,208,255,0.28); }
.alert-danger { background: rgba(255,92,122,0.1); color: #ff8fa3; border: 1px solid rgba(255,92,122,0.28); }

/* ---------- App shell (dashboard) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; flex-shrink: 0; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--border-soft);
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 26px; font-weight: 800; font-size: 18px; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: var(--radius-md); color: var(--text-1); font-size: 14.5px; font-weight: 500;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.side-link svg { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.85; }
.side-link:hover { background: var(--surface); color: var(--text-0); }
.side-link.active { background: var(--surface-hover); color: var(--text-0); box-shadow: inset 0 0 0 1px var(--border); }
.side-link.active svg { opacity: 1; color: var(--accent-b); }
.plan-chip {
  margin-left: auto; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; background: var(--surface); color: var(--text-2);
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border-soft);
}
.side-link.active .plan-chip { color: var(--accent-b); border-color: rgba(53,208,255,0.3); }

.upload-btn-full { margin: 6px 0 18px; }

.storage-box { margin-top: auto; padding: 16px; }
.storage-box .label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.progress-track { height: 7px; border-radius: var(--radius-full); background: var(--bg-3); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); background: var(--gradient-brand); transition: width 0.4s var(--ease); }
.progress-fill.warn { background: linear-gradient(135deg, var(--warning), #ff8a5c); }
.progress-fill.danger { background: linear-gradient(135deg, var(--danger), #ff2f5e); }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 18px 28px;
  border-bottom: 1px solid var(--border-soft); position: sticky; top: 0;
  background: rgba(6,7,10,0.7); backdrop-filter: blur(14px); z-index: 20;
}
.search-box { flex: 1; max-width: 440px; position: relative; }
.search-box input {
  width: 100%; padding: 11px 16px 11px 42px; border-radius: var(--radius-full);
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-0); font-size: 14px;
}
.search-box input:focus { outline: none; border-color: var(--accent-a); }
.search-box svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-2); }
.topbar .spacer { flex: 1; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--gradient-warm);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #1a0d10;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.content { padding: 28px; }
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--text-2); flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--text-0); }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text-0); font-weight: 600; }
.view-toggle { display: flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 3px; }
.view-toggle button { border: none; background: transparent; color: var(--text-2); width: 34px; height: 30px; border-radius: var(--radius-full); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.view-toggle button.active { background: var(--surface-hover); color: var(--text-0); }
.view-toggle svg { width: 16px; height: 16px; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--border); border-radius: var(--radius-lg);
  padding: 44px 20px; text-align: center; margin-bottom: 26px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.dropzone.dragover { border-color: var(--accent-a); background: rgba(124,92,255,0.06); }
.dropzone p { margin: 10px 0 4px; color: var(--text-1); font-size: 14.5px; }
.dropzone span { color: var(--text-3); font-size: 12.5px; }
.dropzone .dz-icon { width: 46px; height: 46px; margin: 0 auto; color: var(--accent-b); opacity: 0.85; }

/* Grid de tarjetas */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.card-item {
  padding: 16px; cursor: pointer; position: relative;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.card-item:hover { transform: translateY(-3px); border-color: rgba(255,255,255,0.16); background: var(--surface-hover); }
.card-thumb {
  width: 100%; aspect-ratio: 1.1/1; border-radius: var(--radius-md); margin-bottom: 12px;
  background: var(--bg-3); display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb svg { width: 38px; height: 38px; }
.card-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.card-menu-btn {
  position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.35); border: none; color: var(--text-1); cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s;
}
.card-item:hover .card-menu-btn { opacity: 1; }
.card-star { position: absolute; top: 10px; left: 10px; width: 16px; height: 16px; color: var(--warning); }

/* Selección múltiple (papelera) */
.card-check { position: absolute; top: 10px; left: 10px; z-index: 2; display: none; }
.select-mode .card-check { display: block; }
.select-mode .card-star { left: 34px; }
.select-mode .card-menu-btn { display: none; }
.item-select { width: 18px; height: 18px; accent-color: var(--accent-a); cursor: pointer; }
.list-table th:first-child, .list-table td:first-child { width: 36px; }
.list-table .item-select { display: none; }
.select-mode .list-table .item-select { display: inline-block; }

.bulk-bar {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 120%);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; z-index: 95;
  transition: transform 0.25s var(--ease); min-width: 320px; max-width: calc(100vw - 40px);
}
.bulk-bar.open { transform: translate(-50%, 0); }
.bulk-bar #bulkCount { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.bulk-bar .spacer { flex: 0 0 6px; }

/* Planes */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-top: 22px; }
.plan-card { padding: 26px 22px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.plan-card.current { border-color: var(--accent-a); box-shadow: 0 0 0 1px var(--accent-a); }
.plan-card .plan-badge {
  position: absolute; top: -12px; right: 20px; background: var(--accent-a); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: 0.03em;
}
.plan-card h3 { margin: 0; font-size: 19px; }
.plan-card .plan-price { font-size: 30px; font-weight: 800; }
.plan-card .plan-price span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.plan-card li { font-size: 13.5px; color: var(--text-1); display: flex; align-items: flex-start; gap: 8px; }
.plan-card li svg { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; margin-top: 1px; }
.plan-pending-note { font-size: 12.5px; color: var(--text-2); background: var(--bg-3); padding: 10px 12px; border-radius: var(--radius-sm); }

/* Lista */
.list-table { width: 100%; border-collapse: collapse; }
.list-table th { text-align: left; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); }
.list-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.list-table tr:hover { background: var(--surface); }
.list-name { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.list-icon { width: 22px; height: 22px; flex-shrink: 0; }

/* Icon color per category */
.ic-image { color: #35d0ff; } .ic-video { color: #ff5ca8; } .ic-audio { color: #ffc857; }
.ic-document { color: #7c5cff; } .ic-sheet { color: #37e6a0; } .ic-slide { color: #ff9a5c; }
.ic-archive { color: #8b8f9e; } .ic-other { color: #8b8f9e; } .ic-folder { color: #ffcf5c; }

.empty-state { text-align: center; padding: 70px 20px; color: var(--text-3); }
.empty-state svg { width: 56px; height: 56px; margin-bottom: 14px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,5,8,0.65); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal { width: 100%; max-width: 420px; padding: 26px; animation: modalIn 0.22s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 18px; font-size: 17px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* Context menu */
.context-menu {
  position: fixed; min-width: 190px; padding: 6px; z-index: 90; display: none;
  animation: modalIn 0.15s var(--ease);
}
.context-menu.open { display: block; }
.context-menu button {
  width: 100%; text-align: left; background: none; border: none; color: var(--text-0);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
.context-menu button:hover { background: var(--surface-hover); }
.context-menu button svg { width: 16px; height: 16px; opacity: 0.8; }
.context-menu button.danger { color: #ff8fa3; }
.context-menu hr { border: none; border-top: 1px solid var(--border-soft); margin: 6px 0; }

/* Toasts */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  padding: 13px 18px; border-radius: var(--radius-md); font-size: 13.5px;
  min-width: 240px; animation: toastIn 0.25s var(--ease);
  box-shadow: var(--shadow-soft);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast-success { background: #10241b; border: 1px solid rgba(55,230,160,0.35); color: #85f5c0; }
.toast-error { background: #2a1116; border: 1px solid rgba(255,92,122,0.35); color: #ff9caa; }
.toast-info { background: #0f1c2a; border: 1px solid rgba(53,208,255,0.3); color: #8fe3ff; }

/* Progress uploads */
.upload-progress-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.upload-progress-item { padding: 12px 16px; }
.upload-progress-item .row { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 8px; color: var(--text-1); }

/* Share page (público) */
.share-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.share-card { width: 100%; max-width: 460px; padding: 36px; text-align: center; }
.share-icon-big { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 20px; background: var(--gradient-brand); display: flex; align-items: center; justify-content: center; }
.share-icon-big svg { width: 34px; height: 34px; color: #08090d; }

/* Utilidades */
.mt-0 { margin-top: 0 !important; }
.text-center { text-align: center; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -280px; z-index: 60; background: var(--bg-1); transition: left 0.25s var(--ease); box-shadow: var(--shadow-soft); }
  .sidebar.open { left: 0; }
  .content { padding: 18px; }
}
