/* ============================================================
   VOD Corp — Componentes shadcn/ui portados a CSS puro
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 3px; }

/* ── Progress bar ── */
.progress-track {
  height: 4px;
  background: hsl(var(--muted));
  border-radius: 9999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: hsl(var(--foreground));
  border-radius: 9999px;
  transition: width 0.3s;
}

/* ── Button ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.btn-default   { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); padding: 0.5rem 1rem; }
.btn-default:hover { opacity: 0.9; }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); padding: 0.5rem 1rem; }
.btn-secondary:hover { opacity: 0.8; }
.btn-ghost     { background: transparent; color: hsl(var(--foreground)); padding: 0.5rem 1rem; }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-outline   { background: transparent; color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); padding: 0.5rem 1rem; }
.btn-outline:hover { background: hsl(var(--accent)); }
.btn-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); padding: 0.5rem 1rem; }
.btn-sm   { padding: 0.25rem 0.75rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.5rem; width: 2.25rem; height: 2.25rem; }

/* ── Card ── */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}
.card-header  { padding: 1.5rem 1.5rem 0.5rem; }
.card-title   { font-size: 1rem; font-weight: 600; line-height: 1.5; }
.card-description { font-size: 0.875rem; color: hsl(var(--muted-foreground)); margin-top: 0.25rem; }
.card-content { padding: 0 1.5rem 1.5rem; }
.card-footer  { padding: 0.75rem 1.5rem 1.5rem; display: flex; align-items: center; }

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-outline     { background: transparent; border-color: hsl(var(--border)); color: hsl(var(--muted-foreground)); }
.badge-secondary   { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge-success     { background: hsl(142 71% 45% / 0.15); color: hsl(142 71% 45%); border-color: hsl(142 71% 45% / 0.3); }
.badge-warning     { background: hsl(38 92% 50% / 0.15); color: hsl(38 92% 50%); border-color: hsl(38 92% 50% / 0.3); }
.badge-destructive { background: hsl(0 62.8% 50% / 0.15); color: hsl(0 72% 65%); border-color: hsl(0 62.8% 50% / 0.3); }

/* ── Input / Select / Textarea ── */
.input,
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  background-color: hsl(var(--background)) !important;
  border: 1px solid hsl(var(--input)) !important;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: hsl(var(--foreground)) !important;
  width: 100%;
  outline: none;
  transition: border 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.input::placeholder,
input::placeholder { color: hsl(var(--muted-foreground)); }

.input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
  border-color: hsl(var(--ring)) !important;
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.15) !important;
}

select.input { cursor: pointer; background: hsl(var(--background)); }
textarea.input { resize: none; }

/* ── Fix Autofill de navegadores (Chrome, Edge, Safari) en modo oscuro ── */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px hsl(var(--background)) inset !important;
  box-shadow: 0 0 0 1000px hsl(var(--background)) inset !important;
  -webkit-text-fill-color: hsl(var(--foreground)) !important;
  caret-color: hsl(var(--foreground)) !important;
  transition: background-color 5000s ease-in-out 0s;
}

.dark input:-webkit-autofill,
.dark input:-webkit-autofill:hover, 
.dark input:-webkit-autofill:focus, 
.dark input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #09090b inset !important;
  box-shadow: 0 0 0 1000px #09090b inset !important;
  -webkit-text-fill-color: #fafafa !important;
  caret-color: #fafafa !important;
}

/* ── Separator ── */
.separator { height: 1px; background: hsl(var(--border)); }

/* ── Sidebar nav item ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: none;
  background: transparent;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.nav-item:hover,
.nav-item.active { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.nav-item.active { font-weight: 500; }

/* ── Table ── */
.table-wrap { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table-wrap th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  font-size: 0.8125rem;
  border-bottom: 1px solid hsl(var(--border));
}
.table-wrap td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: hsl(var(--muted) / 0.5); }

/* ── Avatar ── */
.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }
.avatar-xl { width: 3rem; height: 3rem; font-size: 1rem; }

/* ── Tabs ── */
.tabs-list {
  display: flex;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  padding: 0.25rem;
  gap: 0.25rem;
}
.tab-trigger {
  flex: 1;
  text-align: center;
  padding: 0.375rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: transparent;
  font-family: inherit;
}
.tab-trigger.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ── Sidebar layout & Fixed Desktop Pinning ── */
.sidebar-width { width: 256px; min-width: 256px; }

.sidebar-desktop {
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  max-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  flex-shrink: 0 !important;
  overflow: hidden !important;
  z-index: 30;
}

.sidebar-desktop .nav-scroll-area {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
}

.sidebar-desktop .user-footer-pinned {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--sidebar));
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* ── Logo adaptation ── */
.logo-light { display: block; }
.logo-dark  { display: none; }
.dark .logo-light { display: none; }
.dark .logo-dark  { display: block; }

/* ── Theme toggle icons ── */
.icon-sun  { display: none; }
.icon-moon { display: block; }
.dark .icon-sun  { display: block; }
.dark .icon-moon { display: none; }

/* ── Screen routing con scroll independiente ── */
.screen { display: none; }
.screen.active {
  display: flex !important;
  width: 100% !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

#screen-login.screen.active {
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh !important;
}

/* ================================================================
   Integración con animations.css
   Aplica automáticamente transiciones a componentes base
================================================================ */

/* Cards con hover animado */
.card {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.card:where([onclick], [class*="cursor-pointer"]) {
  cursor: pointer;
}
.card:where([onclick]):hover {
  transform: translateY(-2px) scale(1.005);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  border-color: hsl(var(--foreground) / 0.2);
}

/* Botones con micro-bounce en click */
.btn {
  transition: all 0.15s ease;
}
.btn:active {
  transform: scale(0.97);
}

/* Nav items con transición de padding */
.nav-item {
  transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}
.nav-item:hover:not(.active) {
  padding-left: 1.1rem;
}

/* Badges NUEVO con pulso */
.badge-warning {
  animation: pulse-soft 2.5s ease-in-out infinite;
}

/* Progress fill animada */
.progress-fill {
  animation: progress-grow 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.4s;
}
@keyframes progress-grow {
  from { width: 0 !important; }
}

/* Avatar con ring en hover */
.avatar {
  transition: box-shadow 0.15s ease;
}
.avatar:hover {
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.4);
}

/* Input focus con transición suave */
.input {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Separador con fade */
.separator {
  opacity: 0.6;
}

/* Table rows */
.table-wrap tr {
  transition: background 0.1s ease;
}

/* Tab trigger */
.tab-trigger {
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

/* ================================================================
   ADAPTACIÓN MÓVIL (shadcn/ui Sheet & Mobile Streaming UX)
   ================================================================ */

/* ── Responsive Drawer / Sheet Móvil ── */
#mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#mobile-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#mobile-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 280px;
  max-width: 85vw;
  background: hsl(var(--sidebar));
  border-right: 1px solid hsl(var(--border));
  z-index: 51;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
#mobile-drawer.open {
  transform: translateX(0);
}

/* ── Mobile Bottom Navigation Bar (YouTube/Netflix style) ── */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4rem;
  background: hsl(var(--background) / 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 40;
}
@media (min-width: 1024px) {
  .mobile-bottom-nav {
    display: none !important;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  gap: 0.25rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.6875rem;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.1s ease;
  padding: 0.25rem;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item:active {
  transform: scale(0.92);
}
.bottom-nav-item.active {
  color: hsl(var(--foreground));
  font-weight: 600;
}
.bottom-nav-item.active svg {
  color: hsl(var(--foreground));
}

/* ── Ocultar sidebar de escritorio en móviles ── */
@media (max-width: 1023px) {
  .sidebar-desktop {
    display: none !important;
  }
}

/* ── Floating debug switcher colapsable ── */
.debug-switcher-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-radius: 9999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.debug-switcher-pill:hover {
  border-color: hsl(var(--foreground) / 0.4);
}

