/* ============================================
   Wub — Estilos Principales
   Paleta: Dark + Púrpura (Archivist / ListView)
   Fuente: Work Sans
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ── Fondos ── */
  --bg-primary:           #0a0a0a;   /* fondo principal                    */
  --bg-secondary:         #111111;   /* sidebar / inputs / elevated         */
  --bg-card:              #1a1a1a;   /* tarjetas                            */
  --bg-card-alt:          #222222;   /* tarjeta hover / borde visibles      */

  /* ── Colores de marca ── */
  --color-primary:        #8a2be2;   /* púrpura principal                   */
  --color-primary-hover:  #a044ff;   /* púrpura hover                       */
  --color-secondary:      #a855f7;   /* púrpura claro                       */
  --color-secondary-hover:#a044ff;
  --color-accent:         #a855f7;

  /* ── Texto ── */
  --text-primary:         #ffffff;
  --text-secondary:       #a0a0a0;
  --text-muted:           #737373;
  --text-inverse:         #ffffff;

  /* ── Bordes ── */
  --border-color:         #222222;
  --border-light:         #333333;

  /* ── Sombras ── */
  --shadow-sm:  0 1px 4px  rgba(0, 0, 0, 0.35);
  --shadow-md:  0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg:  0 8px 28px rgba(0, 0, 0, 0.55);

  /* ── Radio ── */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;

  /* ── Funcionales ── */
  --color-success: #22c55e;
  --color-danger:  #ef4444;
  --color-warning: #c9a227;
  --color-info:    #8a2be2;

  /* Fondos funcionales tint */
  --success-bg: rgba(34, 197, 94, 0.12);
  --danger-bg:  rgba(239, 68, 68, 0.12);
  --warning-bg: rgba(201, 162, 39, 0.12);
  --accent-pale: rgba(138, 43, 226, 0.18);

  /* ── Tipografía ── */
  --font-family: 'Work Sans', ui-sans-serif, system-ui, sans-serif;

  /* ── Layout ── */
  --sidebar-width:    240px;
  --topbar-height:    60px;
  --bottomnav-height: 68px;
}

/* ========== RESET & BASE ========== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a   { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

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

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ========== UTILIDADES ========== */

.hidden { display: none !important; }
.view   { min-height: 100vh; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ========== LOGO SISTEMA ========== */

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.brand-logo-lg {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* ========== LOGIN VIEW ========== */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--bg-primary);
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  max-width: 400px;
  width: 100%;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
  width: 100%;
  justify-content: center;
}

.btn-google:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--accent-pale);
  background: var(--bg-card-alt);
}

/* ========== APP SHELL LAYOUT ========== */

#app-shell {
  display: flex;
  min-height: 100vh;
}

/* ========== SIDEBAR ========== */

#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  padding: 1.25rem 0.75rem;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0 0.5rem;
  margin-bottom: 1.75rem;
}

.sidebar-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.4px;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6875rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.18s ease;
}

.nav-item:hover {
  background: var(--bg-card-alt);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-pale);
  color: var(--color-primary);
}

.nav-item.active .material-symbols-rounded {
  color: var(--color-primary);
}

.nav-item .material-symbols-rounded {
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

.sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card-alt);
  flex-shrink: 0;
}

/* ========== MAIN CONTENT ========== */

#main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-color);
  background: #000000;
  position: sticky;
  top: 0;
  z-index: 50;
}

#page-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

#page-content {
  padding: 1.75rem 2rem;
  flex: 1;
}

/* ========== MOBILE HEADER ========== */

#mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: #000000;
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
}

.mobile-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: contain;
}

.mobile-brand {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.3px;
}

.mobile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card-alt);
  border: 1.5px solid var(--border-light);
}

/* ========== BOTTOM NAVIGATION ========== */

#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottomnav-height);
  min-height: 60px;
  background: #000000;
  border-top: 1px solid var(--border-color);
  z-index: 100;
  padding: 0.375rem 0;
  padding-bottom: max(0.375rem, env(safe-area-inset-bottom, 0px));
  align-items: center;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.18s ease;
}

.bottom-nav-item .material-symbols-rounded {
  font-size: 22px;
  transition: transform 0.18s ease;
}

.bottom-nav-item.active {
  color: var(--color-primary);
}

.bottom-nav-item.active .material-symbols-rounded {
  transform: scale(1.1);
}

.bottom-nav-item:hover { color: var(--color-secondary); }

/* FAB central "+" */
.bottom-nav-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0.25rem;
  margin-top: -22px;
  box-shadow: 0 4px 16px rgba(138, 43, 226, 0.45);
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.bottom-nav-fab:hover  { background: var(--color-primary-hover); transform: scale(1.06); box-shadow: 0 6px 22px rgba(138, 43, 226, 0.55); }
.bottom-nav-fab:active { transform: scale(0.94); }
.bottom-nav-fab .material-symbols-rounded { font-size: 26px; }

/* ========== MODAL ========== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-container {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.2px;
}

.modal-body { padding: 1.5rem; }

/* ========== LOADING ========== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2.5px solid var(--border-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== BOTTOM NAV DROPDOWN ========== */

/* Wrapper posicionado para anclar el menú */
.bottom-nav-dropdown-wrap {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
}

/* Botón que actúa como nav-item */
.bottom-nav-dd-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: color 0.18s ease;
  font-family: var(--font-family);
  padding: 0.25rem 0;
}

.bottom-nav-dd-btn .material-symbols-rounded {
  font-size: 22px;
  transition: transform 0.18s ease;
}

/* Solo púrpura mientras el menú está abierto — clase controlada por JS */
.bottom-nav-dd-btn.dd-open {
  color: var(--color-primary);
}

/* Menú flotante hacia arriba */
.bottom-nav-dropdown {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 14px;
  padding: 0.375rem;
  min-width: 150px;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.bottom-nav-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Items dentro del menú */
.bottom-nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6875rem 0.875rem;
  border-radius: 10px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: var(--font-family);
  white-space: nowrap;
}

.bottom-nav-dropdown-item:hover {
  background: rgba(138, 43, 226, 0.18);
  color: var(--color-primary);
}

.bottom-nav-dropdown-item .material-symbols-rounded {
  font-size: 20px;
  color: var(--color-primary);
}

/* ========== SCROLLBAR ========== */

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