@import url('https://fonts.googleapis.com/css2?family=Clash+Display:wght@400;500;600;700&family=Satoshi:wght@400;500;700&display=swap');

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

:root {
  --bg: #14111F;
  --purple: #8B5CF6;
  --purple-light: #A78BFA;
  --purple-dark: #6D3FE0;
  --text: #F0EEF7;
  --text-muted: #9691AC;
  --white: #1D1930;
  --danger: #F87171;
  --card: rgba(29,25,48,0.75);
  --card-border: rgba(139,92,246,0.18);
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.45);
  --radius: 16px;
  --radius-sm: 12px;
}

html, body { min-height: 100vh; font-family: 'Satoshi', sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }

.nx-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: rgba(29,25,48,0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--card-border); position: sticky; top: 0; z-index: 100; flex-wrap: wrap; }
.nx-header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { width: 28px; height: 28px; object-fit: contain; }
.header-brand { font-family: 'Clash Display', sans-serif; font-size: 16px; font-weight: 600; }
.nx-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.storage-bar-wrap { display: flex; align-items: center; gap: 8px; }
.storage-bar { width: 80px; height: 6px; background: rgba(107,63,240,0.1); border-radius: 10px; overflow: hidden; }
.storage-fill { height: 100%; background: linear-gradient(90deg, var(--purple), var(--purple-light)); border-radius: 10px; transition: width 0.4s ease; }
.storage-fill.warning { background: linear-gradient(90deg, #F59E0B, #EF4444); }
.storage-text { font-size: 12px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }

.btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; background: var(--purple); color: #fff; border: none; border-radius: var(--radius-sm); font-family: 'Satoshi', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.18s; text-decoration: none; }
.btn-primary:hover { background: var(--purple-dark); transform: translateY(-1px); }
.btn-primary.full { width: 100%; justify-content: center; }
.btn-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: rgba(107,63,240,0.08); border: none; border-radius: 10px; cursor: pointer; color: var(--purple); transition: all 0.18s; }
.btn-icon:hover { background: rgba(107,63,240,0.16); }
.btn-danger-ghost { padding: 9px 16px; background: transparent; border: 1.5px solid rgba(229,62,62,0.25); border-radius: var(--radius-sm); font-family: 'Satoshi', sans-serif; font-size: 13px; font-weight: 600; color: var(--danger); cursor: pointer; transition: all 0.18s; }
.btn-danger-ghost:hover { background: rgba(229,62,62,0.08); }

.breadcrumb-wrap { padding: 10px 20px; background: rgba(29,25,48,0.5); border-bottom: 1px solid var(--card-border); }
.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crumb { font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: color 0.15s; }
.crumb:hover { color: var(--purple); }
.crumb.active { color: var(--text); cursor: default; }
.crumb-sep { color: var(--text-muted); font-size: 12px; }

.drive-main { width: 100%; padding: 20px; max-width: 1000px; margin: 0 auto; }

.drive-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; text-align: center; gap: 10px; }
.empty-icon { width: 52px; height: 52px; object-fit: contain; opacity: 0.3; }
.empty-title { font-family: 'Clash Display', sans-serif; font-size: 17px; font-weight: 600; }
.empty-sub { font-size: 13px; color: var(--text-muted); }

.drive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

.drive-item { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; transition: all 0.2s; backdrop-filter: blur(8px); text-align: center; position: relative; }
.drive-item:hover { border-color: var(--purple); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.drive-item-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; font-size: 26px; }
.drive-item-icon.folder { background: rgba(107,63,240,0.1); }
.drive-item-icon.img-thumb { border-radius: 10px; overflow: hidden; width: 44px; height: 44px; }
.drive-item-icon.img-thumb img { width: 100%; height: 100%; object-fit: cover; }

.drive-item-name { font-size: 12px; font-weight: 600; color: var(--text); word-break: break-word; line-height: 1.4; width: 100%; }
.drive-item-meta { font-size: 11px; color: var(--text-muted); }

.modal-overlay { position: fixed; inset: 0; background: rgba(26,16,40,0.5); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal { width: 100%; max-width: 480px; background: var(--white); border-radius: var(--radius) var(--radius) 0 0; padding: 20px; display: flex; flex-direction: column; gap: 16px; animation: slideUp 0.3s cubic-bezier(0.22,1,0.36,1); }
@media (min-width: 520px) { .modal-overlay { align-items: center; } .modal { border-radius: var(--radius); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: 'Clash Display', sans-serif; font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-footer { display: flex; gap: 10px; }
.modal-footer .btn-primary { flex: 1; justify-content: center; }

.nx-input { width: 100%; padding: 11px 14px; background: rgba(29,25,48,0.8); border: 1.5px solid var(--card-border); border-radius: var(--radius-sm); font-family: 'Satoshi', sans-serif; font-size: 14px; color: var(--text); outline: none; transition: border-color 0.18s; }
.nx-input:focus { border-color: var(--purple); }
.form-error { font-size: 13px; color: var(--danger); min-height: 18px; }

.file-preview { width: 100%; display: flex; justify-content: center; }
.file-preview img { max-width: 100%; max-height: 280px; border-radius: var(--radius-sm); object-fit: contain; }
.file-preview .file-icon-big { font-size: 64px; text-align: center; width: 100%; padding: 20px 0; }
.file-meta { display: flex; flex-direction: column; gap: 6px; }
.file-meta-row { display: flex; justify-content: space-between; font-size: 13px; }
.file-meta-row span:first-child { color: var(--text-muted); }
.file-meta-row span:last-child { font-weight: 600; }

.upload-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--white); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow-lg); min-width: 260px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.upload-toast.hidden { display: none; }
.upload-toast-inner { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.upload-toast-inner svg { color: var(--purple); flex-shrink: 0; }
.upload-progress-bar { height: 4px; background: rgba(107,63,240,0.1); border-radius: 10px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: var(--purple); border-radius: 10px; transition: width 0.3s ease; width: 0%; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); background: #2A2440; color: #F0EEF7; padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 999; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

#screen-access { align-items: center; justify-content: center; position: relative; }
.login-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.4; }
.orb1 { width: 500px; height: 500px; background: radial-gradient(circle, #9B7FF6, #6B3FF0); top: -160px; left: -100px; animation: drift1 12s ease-in-out infinite; }
.orb2 { width: 400px; height: 400px; background: radial-gradient(circle, #C4B5FD, #7C3AED); bottom: -100px; right: -80px; animation: drift2 15s ease-in-out infinite; }
.orb3 { width: 300px; height: 300px; background: radial-gradient(circle, #DDD6FE, #A78BFA); top: 50%; left: 50%; transform: translate(-50%,-50%); animation: drift3 18s ease-in-out infinite; }
@keyframes drift1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(30px,20px)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-20px,-30px)} }
@keyframes drift3 { 0%,100%{transform:translate(-50%,-50%) scale(1)} 50%{transform:translate(-50%,-50%) scale(1.1)} }

.login-wrap { position: relative; z-index: 1; width: 100%; max-width: 380px; padding: 0 28px; display: flex; flex-direction: column; align-items: center; text-align: center; animation: fadeUp 0.6s cubic-bezier(0.22,1,0.36,1) both; }
.login-logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: 18px; }
.login-headline { font-family: 'Clash Display', sans-serif; font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.login-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.access-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.input-wrap { position: relative; width: 100%; }
.input-wrap .nx-input { padding-right: 44px; }
.btn-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; display: flex; align-items: center; }
.btn-eye:hover { color: var(--purple); }
.btn-ghost-sm { background: transparent; border: none; font-family: 'Satoshi', sans-serif; font-size: 13px; color: var(--text-muted); cursor: pointer; padding: 6px; }
.btn-ghost-sm:hover { color: var(--purple); }
@keyframes fadeUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }

/* ══════════ NUEVA INTERFAZ: SIDEBAR + TOPBAR ══════════ */

.nx-shell { display: flex; min-height: 100vh; align-items: stretch; }

/* ── SIDEBAR ── */
.nx-sidebar {
  width: 248px; flex-shrink: 0; background: rgba(17,14,28,0.92);
  border-right: 1px solid var(--card-border); display: flex; flex-direction: column;
  padding: 18px 14px; gap: 18px; position: sticky; top: 0; height: 100vh; z-index: 120;
}
.sidebar-top { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.sidebar-logo { width: 26px; height: 26px; object-fit: contain; }
.sidebar-brand { font-family: 'Clash Display', sans-serif; font-size: 15px; font-weight: 600; }

.new-menu-wrap { position: relative; }
.btn-new-toggle {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; background: var(--purple); color: #fff; border: none; border-radius: var(--radius-sm);
  font-family: 'Satoshi', sans-serif; font-size: 13.5px; font-weight: 700; cursor: pointer;
  transition: all 0.18s; box-shadow: 0 4px 18px rgba(139,92,246,0.28);
}
.btn-new-toggle:hover { background: var(--purple-dark); transform: translateY(-1px); }
.new-menu {
  position: absolute; top: calc(100% + 8px); left: 0; width: 100%; min-width: 210px;
  background: var(--white); border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 130;
  animation: fadeUp 0.15s ease both;
}
.new-menu.hidden { display: none; }
.new-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 10px; background: transparent;
  border: none; border-radius: 8px; color: var(--text); font-family: 'Satoshi', sans-serif; font-size: 13px;
  font-weight: 600; cursor: pointer; text-align: left; transition: background 0.15s;
}
.new-menu-item svg { color: var(--purple); flex-shrink: 0; }
.new-menu-item:hover { background: rgba(107,63,240,0.12); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; background: transparent;
  border: none; border-radius: var(--radius-sm); color: var(--text-muted); font-family: 'Satoshi', sans-serif;
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all 0.15s; text-align: left;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover:not(:disabled) { background: rgba(107,63,240,0.08); color: var(--text); }
.nav-item.active { background: rgba(139,92,246,0.16); color: var(--purple-light); }
.nav-item:disabled { cursor: default; opacity: 0.55; }
.pill-soon {
  margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--purple-light); background: rgba(139,92,246,0.16); padding: 3px 7px; border-radius: 20px;
}

.sidebar-footer { margin-top: auto; padding: 10px 6px 2px; }
.sidebar-footer .storage-bar-wrap { flex-direction: column; align-items: flex-start; gap: 6px; }
.sidebar-footer .storage-bar { width: 100%; }
.sidebar-footer .storage-text { font-size: 11.5px; }

.sidebar-backdrop { display: none; }

/* ── CONTENIDO / TOPBAR ── */
.nx-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.nx-topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 22px; background: rgba(29,25,48,0.85);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--card-border); position: sticky; top: 0; z-index: 100;
}
.sidebar-toggle { display: none; }

.topbar-search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: rgba(255,255,255,0.05); border: 1.5px solid var(--card-border); border-radius: 999px;
  color: var(--text-muted); transition: border-color 0.18s;
}
.topbar-search:focus-within { border-color: var(--purple); color: var(--text); }
.topbar-search svg { flex-shrink: 0; }
.topbar-search input {
  flex: 1; background: none; border: none; outline: none; color: var(--text);
  font-family: 'Satoshi', sans-serif; font-size: 13.5px;
}
.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.view-toggle-btn.active { background: rgba(139,92,246,0.22); color: var(--purple-light); }

.user-menu-wrap { position: relative; margin-left: 4px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark)); color: #fff;
  font-family: 'Clash Display', sans-serif; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-menu {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 220px; background: var(--white);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 8px; z-index: 130; animation: fadeUp 0.15s ease both;
}
.user-menu.hidden { display: none; }
.user-menu-email {
  padding: 8px 10px 10px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--card-border);
  margin-bottom: 6px; word-break: break-all;
}
.user-menu-item {
  width: 100%; padding: 9px 10px; background: transparent; border: none; border-radius: 8px;
  color: var(--danger); font-family: 'Satoshi', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer;
  text-align: left; transition: background 0.15s;
}
.user-menu-item:hover { background: rgba(248,113,113,0.1); }

/* ── VISTA DE LISTA ── */
.drive-grid.view-list { display: flex; flex-direction: column; gap: 2px; }
.drive-grid.view-list .drive-item {
  flex-direction: row; align-items: center; justify-content: flex-start; text-align: left;
  padding: 9px 14px; border-radius: 10px; gap: 14px;
}
.drive-grid.view-list .drive-item:hover { transform: none; }
.drive-grid.view-list .drive-item-icon { width: 34px; height: 34px; font-size: 18px; flex-shrink: 0; }
.drive-grid.view-list .drive-item-icon.img-thumb { width: 34px; height: 34px; }
.drive-grid.view-list .drive-item-name { flex: 1; width: auto; }
.drive-grid.view-list .drive-item-meta { flex-shrink: 0; width: 90px; text-align: right; }

.drive-item.search-hidden { display: none; }

/* ── RESPONSIVE ── */
@media (max-width: 880px) {
  .nx-sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .nx-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(10,8,16,0.55); z-index: 110;
  }
  .sidebar-backdrop.show { display: block; }
  .sidebar-toggle { display: flex; }
  .topbar-search { max-width: none; }
}
@media (max-width: 560px) {
  .nx-topbar { padding: 10px 12px; gap: 8px; }
  .topbar-actions { gap: 4px; }
  .view-toggle-btn { display: none; }
  .drive-main { padding: 14px; }
  .drive-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
}

/* ── PLANES (sidebar) ── */
.plan-list { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; }
.plan-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-muted); transition: background 0.15s;
}
.plan-dot { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--text-muted); flex-shrink: 0; }
.plan-item.active { color: var(--text); background: rgba(139,92,246,0.1); }
.plan-item.active .plan-dot { background: var(--purple); border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.18); }
.plan-item.plan-soon { color: var(--text-muted); opacity: 0.7; }
.plan-item.plan-soon .plan-label { flex: 1; }
