:root {
  --primary: #9333ea;
  --primary-hover: #7e22ce;
  --secondary: #ec4899;
  --bg-gradient: linear-gradient(135deg, #f5f3ff 0%, #fdf2f8 50%, #eff6ff 100%);
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== HEADER & NAVIGATION ===== */
header {
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  color: var(--primary);
  margin: 0;
  font-size: 1.5rem;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 4px;
  padding: 10px;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

nav ul {
  display: flex;
  list-style: none;
  gap: 15px;
  margin: 0;
  padding: 0;
}

nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s;
  display: block;
}

nav a:hover {
  background: #f3f4f6;
  color: var(--primary);
}

nav a.active {
  background: var(--primary);
  color: white;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.3s;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-color: #d8b4fe;
}

.card-no-padding {
  padding: 0;
  overflow: hidden;
}

.card-flex {
  display: flex;
  flex-direction: column;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 14px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-full {
  width: 100%;
  text-align: center;
}

/* ===== HERO SECTION ===== */
.hero-section {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  color: white;
  padding: 50px;
  border-radius: 20px;
  margin-bottom: 40px;
  text-align: center;
}

.hero-section h1 {
  margin: 0 0 10px 0;
  font-size: 2rem;
}

.hero-section p {
  margin: 0 0 20px 0;
  font-size: 1.1rem;
}

.hero-section .btn {
  background: white;
  color: var(--primary);
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stats-grid .card {
  text-align: center;
}

.stats-grid h3 {
  margin: 0 0 10px 0;
  font-size: 1rem;
  color: var(--text-muted);
}

.stats-value {
  font-size: 2rem;
  font-weight: bold;
  margin: 0;
}

.stats-value.primary {
  color: var(--primary);
}

.stats-value.secondary {
  color: var(--secondary);
}

/* ===== FORMS ===== */
.form-search {
  display: flex;
  gap: 10px;
  margin: 0;
}

.input-field {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  flex: 1;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
}

/* ===== GRID LAYOUTS ===== */
.grid-raffles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.grid-winners {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

/* ===== RAFFLE CARDS ===== */
.raffle-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
}

.raffle-content {
  padding: 20px;
  flex-grow: 1;
}

.raffle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.raffle-price {
  color: var(--primary);
  font-weight: bold;
}

.raffle-title {
  margin: 10px 0;
  font-size: 1.2rem;
}

.raffle-description {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 15px;
}

.raffle-info {
  border-top: 1px solid #eee;
  margin-top: 15px;
  padding-top: 15px;
  font-size: 13px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.raffle-footer {
  padding: 0 20px 20px 20px;
}

/* ===== BADGES ===== */
.badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  color: white;
  display: inline-block;
}

.badge-active {
  background: var(--success);
}

.badge-closed {
  background: var(--warning);
}

.badge-completed {
  background: #3b82f6;
}

.badge-verified {
  background: var(--success);
}

.badge-pending {
  background: var(--text-muted);
}

.badge-rejected {
  background: var(--danger);
}

/* ===== WINNERS PAGE ===== */
.winner-card {
  border: 2px solid var(--warning);
  border-radius: 15px;
  overflow: hidden;
}

.winner-image-container {
  position: relative;
  height: 220px;
}

.winner-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.winner-image-overlay {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 15px;
}

.winner-image-overlay h3 {
  margin: 0;
  font-size: 1.2rem;
}

.winner-image-overlay small {
  font-size: 0.85rem;
}

.winner-content {
  padding: 20px;
}

.winner-info {
  border-left: 4px solid var(--primary);
  padding-left: 15px;
  margin-bottom: 15px;
}

.winner-info h2 {
  margin: 0;
  font-size: 1.2rem;
}

.winner-info p {
  margin: 5px 0;
  font-size: 14px;
  color: #444;
}

.winner-ticket {
  text-align: center;
  background: var(--bg-gradient);
  padding: 10px;
  border: 1px dashed var(--primary);
  border-radius: 8px;
}

.winner-ticket small {
  color: var(--primary);
  font-weight: bold;
  display: block;
  margin-bottom: 5px;
}

.ticket-number {
  font-family: "Courier New", Courier, monospace;
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 2px;
}

/* ===== FILTER SECTION ===== */
.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.filter-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.filter-form select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 50px;
  color: gray;
}

.page-title {
  color: var(--primary);
  font-size: 2.5rem;
  margin: 20px 0;
  text-align: center;
}

.back-link {
  text-decoration: none;
  color: var(--primary);
  font-weight: bold;
  display: inline-block;
  margin-bottom: 15px;
}

/* ===== DETAILS PAGE SPECIFIC ===== */
.details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 20px;
}

.raffle-banner {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
}

.info-box {
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.info-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.bg-purple {
  background: #f5f3ff;
  color: #7c3aed;
}

.bg-blue {
  background: #eff6ff;
  color: #2563eb;
}

.bg-pink {
  background: #fdf2f8;
  color: #db2777;
}

.prize-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: linear-gradient(to right, #fffbeb, #ffffff);
  border: 1px solid #fde68a;
  border-radius: 10px;
  margin-bottom: 10px;
}

.prize-position {
  background: var(--warning);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.payment-info {
  background: #f5f3ff;
  border-radius: 8px;
  padding: 12px;
  margin: 15px 0;
  border: 1px dashed #9333ea;
}

.payment-info p {
  margin: 5px 0;
}

.payment-amount {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary);
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #bbf7d0;
}

.sticky-form {
  position: sticky;
  top: 90px;
  border: 2px solid #ddd;
}

/* ===== PARTICIPANTS PAGE ===== */
.results-grid {
  display: grid;
  gap: 15px;
}

.participant-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.participant-info {
  flex: 1;
}

.participant-payment {
  text-align: right;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablet: 641px - 1024px */
@media (min-width: 641px) {
  .grid-raffles {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-winners {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-section {
    text-align: left;
  }

  .hero-section h1 {
    font-size: 2.5rem;
  }
}

/* Desktop: 1025px+ */
@media (min-width: 1025px) {
  .grid-raffles {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-winners {
    grid-template-columns: repeat(3, 1fr);
  }

  .details-grid {
    grid-template-columns: 2fr 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile: hasta 640px */
@media (max-width: 640px) {
  .container {
    padding: 15px;
  }

  .header-title {
    font-size: 1.2rem;
  }

  .hamburger {
    display: flex;
  }

  nav {
    position: fixed;
    top: 60px;
    left: -100%;
    width: 100%;
    background: white;
    transition: left 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 99;
  }

  nav.active {
    left: 0;
  }

  nav ul {
    flex-direction: column;
    padding: 20px;
    gap: 0;
  }

  nav li {
    border-bottom: 1px solid #f3f4f6;
  }

  nav li:last-child {
    border-bottom: none;
  }

  nav a {
    padding: 15px 10px;
    border-radius: 0;
  }

  .hero-section {
    padding: 30px 20px;
  }

  .hero-section h1 {
    font-size: 1.5rem;
  }

  .hero-section p {
    font-size: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-value {
    font-size: 1.5rem;
  }

  .form-search {
    flex-direction: column;
  }

  .input-field {
    width: 100%;
  }

  .raffle-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-header {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-form {
    flex-direction: column;
    width: 100%;
  }

  .filter-form select {
    width: 100%;
  }

  .page-title {
    font-size: 1.8rem;
  }

  .winner-image-container {
    height: 180px;
  }

  .ticket-number {
    font-size: 1.2rem;
  }

  .participant-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .participant-payment {
    text-align: left;
    width: 100%;
  }

  .raffle-banner {
    height: 200px;
  }

  .info-boxes {
    grid-template-columns: 1fr;
  }
}

/* Extra Small devices */
@media (max-width: 375px) {
  .hero-section {
    padding: 20px 15px;
  }

  .card {
    padding: 1rem;
  }

  .raffle-content {
    padding: 15px;
  }

  .raffle-footer {
    padding: 0 15px 15px 15px;
  }
}

/*añadí*/
#name_input {
  width: auto !important;
  max-width: 100%;
  display: inline-block;
}

/*añadi para imprimir ticket*/
/* Estilos normales para el botón */
.btn-print {
  background-color: #28a745;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 10px;
  font-weight: bold;
}

@media print {
  /* Ocultamos el header, el menú y el contenedor del buscador */
  header, 
        .hamburger, 
        nav, 
        .form-search, 
        .card:has(.form-search), /* Oculta la tarjeta que contiene el formulario */
        .btn-primary {
    display: none !important;
  }

  /* Quitamos márgenes innecesarios para que el ticket suba al inicio de la página */
  body {
    background: white !important;
    margin: 0;
    padding: 0;
  }

  main.container {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Estilizamos el título del resultado para que se vea limpio */
  h3 {
    margin-top: 0;
    font-size: 16pt;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
  }
}
