:root {
  --bg-dark: #050816;
  --bg-section: #080f24;
  --bg-card: #0b1024;
  --accent: #ffcc33;
  --accent-soft: #ffe899;
  --accent-secondary: #4fd1c5;
  --accent-danger: #ff6b6b;
  --text-main: #f5f5f5;
  --text-muted: #b0b5c3;
  --border-soft: rgba(255,255,255,0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;
}

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

body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #1b2540 0, #050816 55%, #000 100%);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* fondo de ruido sutil */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.10;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

/* HEADER / LOGO / BOTONES */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 10%, #fff7d0 0, #ffcc33 40%, #ff9f1c 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 26px rgba(255,204,51,0.6);
  font-weight: 800;
  font-size: 14px;
  color: #3d2b00;
}

.logo-text-main {
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 20px;
}

.logo-text-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.13);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn {
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(120deg, #ffcc33, #ff9f1c);
  color: #302107;
  box-shadow: 0 10px 22px rgba(0,0,0,0.6);
}

.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text-main);
  border: 1px solid rgba(255,255,255,0.12);
}

.btn span.icon {
  font-size: 16px;
}

/* SECCIONES / LISTADO */

.section {
  margin-top: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 18px;
  letter-spacing: -0.03em;
}

.section-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.controls-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.18);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 12px;
  min-width: 160px;
}

.search-box input::placeholder {
  color: rgba(255,255,255,0.5);
}

.chip-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 4px 9px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  background: rgba(0,0,0,0.4);
}

.chip.chip-active {
  background: rgba(255,204,51,0.12);
  border-color: rgba(255,204,51,0.8);
  color: var(--accent-soft);
}

/* CARDS DE RIFAS */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.card-rifa-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-rifa {
  background: rgba(8,15,36,0.95);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 26px rgba(0,0,0,0.8);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-rifa:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.9);
  border-color: rgba(255,204,51,0.5);
}

.card-rifa-img {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: radial-gradient(circle at top, #1f2937 0, #020617 60%, #000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-rifa-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.card-rifa:hover .card-rifa-img img {
  transform: scale(1.04);
}

.card-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 10px;
  color: var(--accent-soft);
}

.card-cat-pill {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.85);
}

.card-body {
  padding: 10px 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-org {
  font-size: 11px;
  color: var(--text-muted);
}

.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}

.price-tag {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-soft);
}

.price-tag span {
  font-size: 11px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  margin-left: 4px;
}

.draw-date {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

.progress-wrap {
  margin-top: 4px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 3px;
}

.progress-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.progress-inner {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4fd1c5, #ffcc33);
}

.card-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.75);
}

.badge-status {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--accent-secondary);
}

.badge-status.badge-urgent {
  color: var(--accent-danger);
  border-color: rgba(255,107,107,0.6);
  background: rgba(255,107,107,0.12);
}

.cta-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-soft);
}

.cta-inline span.arrow {
  font-size: 12px;
}

footer {
  margin-top: 26px;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  text-align: center;
}

/* =========== USER MENU (HEADER) =========== */

.user-menu {
  position: relative;
}

.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
}

.user-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.28);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-fallback {
  font-size: 13px;
  font-weight: 600;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-caret {
  font-size: 10px;
  opacity: 0.7;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: rgba(8, 15, 36, 0.98);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
  padding: 8px;
  display: none;
  z-index: 30;
}

.user-dropdown.is-open {
  display: block;
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  margin-bottom: 6px;
}

.user-avatar-lg {
  width: 36px;
  height: 36px;
}

.user-dropdown-info {
  min-width: 0;
}

.user-dropdown-name {
  font-size: 13px;
  font-weight: 600;
}

.user-dropdown-email {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-item {
  display: block;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--text-main);
  text-decoration: none;
  border-radius: 10px;
}

.user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-dropdown-logout {
  color: #fecaca;
}

/* ===========================
   PANEL DE USUARIO
   =========================== */

.panel-layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: flex-start;
}

.panel-sidebar {
  background: rgba(8, 15, 36, 0.95);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 12px 12px 10px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.75);
}

.panel-user-hero {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  margin-bottom: 8px;
}

.panel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  overflow: hidden;
  background: radial-gradient(circle at top, #1f2937 0, #020617 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.panel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.panel-avatar-initial {
  font-weight: 700;
  font-size: 16px;
  color: #e5e7eb;
}

.panel-user-info {
  min-width: 0;
}

.panel-user-name {
  font-size: 13px;
  font-weight: 600;
}

.panel-user-email {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-nav {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.panel-nav-item {
  display: block;
  padding: 7px 9px;
  font-size: 13px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(248, 250, 252, 0.85);
}

.panel-nav-item:hover {
  background: rgba(148, 163, 184, 0.2);
}

.panel-nav-item.is-active {
  background: linear-gradient(120deg, #4fd1c5, #ffcc33);
  color: #020617;
}

/* Área principal del panel */
.panel-main {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-card {
  background: rgba(8, 15, 36, 0.96);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 12px 14px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.8);
}

.panel-card-highlight {
  background: radial-gradient(circle at top left, rgba(79, 209, 197, 0.18), transparent 55%),
              radial-gradient(circle at bottom right, rgba(255, 204, 51, 0.18), transparent 55%),
              rgba(8, 15, 36, 0.96);
}

.panel-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.panel-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.panel-stat {
  padding: 8px 9px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.panel-stat-label {
  font-size: 11px;
  color: rgba(148, 163, 184, 0.9);
  margin-bottom: 4px;
}

.panel-stat-value {
  font-size: 18px;
  font-weight: 700;
}

.panel-stat-sub {
  font-size: 11px;
  color: rgba(248, 250, 252, 0.8);
  margin-top: 2px;
}

.panel-empty {
  font-size: 12px;
  color: var(--text-muted);
}

.panel-table {
  margin-top: 4px;
  font-size: 12px;
}

.panel-table-header,
.panel-table-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) 70px 110px 90px;
  gap: 8px;
  align-items: center;
}

.panel-table-header {
  padding: 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.5);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(148, 163, 184, 0.9);
}

.panel-table-row {
  padding: 6px 0;
  border-bottom: 1px solid rgba(30, 41, 59, 0.9);
}

.panel-table-row:last-child {
  border-bottom: none;
}

.hide-sm {
  display: inline;
}

@media (max-width: 768px) {
  .panel-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-sidebar {
    order: 2;
  }

  .panel-main {
    order: 1;
  }

  .panel-table-header,
  .panel-table-row {
    grid-template-columns: minmax(0, 2.3fr) 70px 90px;
  }

  .hide-sm {
    display: none;
  }
}


/* Aviso legal portada */
.legal-banner {
  max-width: 1100px;
  margin: 16px auto 24px;
  padding: 0 16px;        /* para alinearlo con el resto del contenido */
}

.legal-banner-inner {
  background: rgba(255, 80, 80, 0.12);      /* rojizo suave */
  border: 1px solid rgba(255, 120, 120, 0.9);
  border-radius: 16px;
  padding: 14px 18px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

.legal-banner.hidden {
  display: none;
}

.legal-banner-text {
  font-size: 13px;
  line-height: 1.5;
}

.legal-banner-btn {
  align-self: flex-start;
  border: none;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #ffb347;
  color: #3b0000;
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.1s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.legal-banner-btn:hover {
  background: #ffc86d;
  transform: translateY(-1px);
}

.legal-banner-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

@media (min-width: 768px) {
  .legal-banner-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
