/* ========================================
   Diseño moderno y profesional (Design System)
   ======================================== */

/* Paleta y variables */
:root {
  /* Base */
  --color-bg-00: #0f0f10;
  --color-bg-01: #151517;
  --color-bg-02: #1b1c1f;
  --color-bg-03: #212225;
  --color-surface: #232428;
  --color-border: #303138;

  /* Texto */
  --color-text: #e7e7ea;
  --color-text-soft: #b3b3bb;
  --color-text-mute: #8a8a95;

  /* Accents */
  --primary: #ff4a4a;
  --primary-600: #e23e3e;
  --primary-700: #c93434;
  --secondary: #3b82f6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Elevation */
  --shadow-1: 0 6px 18px rgba(0, 0, 0, 0.25);
  --shadow-2: 0 10px 28px rgba(0, 0, 0, 0.35);
  --ring-primary: 0 0 0 2px rgba(255, 74, 74, 0.35);
  --ring-focus: 0 0 0 2px rgba(59, 130, 246, 0.35);

  /* Layout scale */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
}

/* Puente de compatibilidad: sobrescribe tokens existentes del proyecto */
:root {
  --primary-color: var(--primary);
  --primary-hover: var(--primary-600);
  --bg-dark: var(--color-bg-01);
  --bg-darker: var(--color-bg-02);
  --bg-card: var(--color-bg-02);
  --bg-card-hover: var(--color-surface);
  --border-color: var(--color-border);
  --text-white: #ffffff;
  --text-gray: #cbd5e1;
  /* slate-300 aprox */
  --shadow-dark: 0 8px 32px 0 #000c;
  --shadow-red: 0 2px 8px 0 rgba(255, 74, 74, .25);
  --shadow-red-hover: 0 4px 16px 0 rgba(255, 74, 74, .4);
}

/* Tipografía base */
html,
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', Helvetica, Arial, sans-serif;
}

body {
  background: var(--color-bg-01);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
.h1 {
  font-size: clamp(2rem, 2.4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

h2,
.h2 {
  font-size: clamp(1.6rem, 2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.005em;
}

h3,
.h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

p {
  color: var(--color-text-soft);
  line-height: 1.65;
}

small,
.text-muted {
  color: var(--color-text-mute);
}

/* Contenedor y secciones */
.container-pro {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.section {
  padding: var(--space-10) 0;
}

/* Header y navegación */
header {
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 1000;
  /* asegura que el header y su dropdown queden por encima */
}

/* Dropdown del usuario: asegura prioridad sobre el contenido */
#user-menu-dropdown {
  z-index: 2000;
}

/* Contenidos del dropdown: evitar desbordes de texto */
#user-menu-dropdown .user-name,
#user-menu-dropdown .user-email {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-menu-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--color-text);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  transition: color .25s ease, background .25s ease;
  position: relative;
}

.main-menu-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--primary);
  border-radius: 4px;
}

.main-menu-link:hover::after,
.main-menu-link.active-menu::after {
  transform: scaleX(1);
}

.main-menu-link:hover {
  background: var(--color-bg-02);
  color: var(--primary);
}

.main-menu-link.active-menu {
  background: var(--color-bg-02);
  color: var(--primary);
}

/* Tarjetas */
.card {
  background: linear-gradient(180deg, var(--color-surface), var(--color-bg-02));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.card.hoverable {
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.card.hoverable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: #3a3b42;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: all .25s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 28px rgba(255, 74, 74, .2);
}

.btn-primary:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-bg-02);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-bg-02);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: black;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .6rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: .75rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg-02);
  color: var(--color-text-soft);
}

.badge.primary {
  background: rgba(255, 74, 74, .15);
  border-color: rgba(255, 74, 74, .35);
  color: var(--primary);
}

.badge.success {
  background: rgba(34, 197, 94, .15);
  border-color: rgba(34, 197, 94, .35);
  color: var(--success);
}

.badge.warning {
  background: rgba(245, 158, 11, .15);
  border-color: rgba(245, 158, 11, .35);
  color: var(--warning);
}

.badge.info {
  background: rgba(59, 130, 246, .15);
  border-color: rgba(59, 130, 246, .35);
  color: var(--secondary);
}

/* Inputs y formularios */
.input {
  background: var(--color-bg-02);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-md);
  padding: .7rem .9rem;
  transition: border-color .25s ease, box-shadow .25s ease;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring-primary);
}

select.input,
textarea.input {
  resize: vertical;
}

/* Tablas */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table thead th {
  background: var(--color-bg-02);
  color: var(--color-text-soft);
  text-align: left;
  padding: .9rem 1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--color-border);
}

.table tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.table tbody tr:hover {
  background: #26272b;
}

/* Alertas */
.alert {
  padding: .9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-02);
  color: var(--color-text-soft);
}

.alert-danger {
  background: rgba(239, 68, 68, .15);
  color: #fecaca;
  border-color: rgba(239, 68, 68, .35);
}

.alert-success {
  background: rgba(34, 197, 94, .15);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, .35);
}

.alert-warning {
  background: rgba(245, 158, 11, .12);
  color: #fde68a;
  border-color: rgba(245, 158, 11, .3);
}

/* Tarjetas de producto */
.product-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
}

.product-card .image {
  height: 200px;
  border-radius: var(--radius-md);
  background: var(--color-bg-02);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.product-card .image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .3s ease;
}

.product-card:hover .image img {
  transform: scale(1.03);
}

.product-card .title {
  font-weight: 700;
  letter-spacing: -.01em;
}

.product-card .price {
  font-weight: 800;
  color: var(--primary);
}

/* Footer */
footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-01);
}

/* Animaciones sutiles */
.fade-in {
  animation: fade-in .5s ease both;
}

.slide-up {
  animation: slide-up .5s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes slide-up {
  from {
    transform: translateY(8px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

/* Responsivo */
@media (max-width: 1024px) {
  .container-pro {
    max-width: 980px;
  }
}

@media (max-width: 768px) {
  .container-pro {
    max-width: 680px;
  }

  .main-menu-link {
    padding: .5rem .75rem;
  }
}

@media (max-width: 480px) {
  .container-pro {
    max-width: 100%;
    padding: 0 var(--space-3);
  }

  h1 {
    font-size: 1.75rem;
  }

  .btn {
    padding: .6rem .85rem;
  }
}

/* Flecha del botón de perfil: arriba por defecto, abajo cuando abierto */
#user-menu-button .user-chevron {
  transition: transform 200ms ease;
  transform: rotate(180deg);
}

#user-menu-button.open .user-chevron {
  transform: rotate(0deg);
}