/*
* ORGANIZED CSS FILE FOR LA JOCOSIDAD
* Well-structured and commented for maintainability
*/

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

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

/* Set base font size for rem calculations */
html {
  font-size: 18px; /* 1rem = 16px */
}

@media screen and (max-width: 768px) {
  html {
    font-size: 16px; /* Smaller base size on mobile */
  }
}

html,
body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background-color: var(--base-bg-color);
  /* background-size: 100% auto;
  background-image: url(../svg/bg-texture-26.svg);
  background-repeat: repeat;
  background-attachment: fixed;
  background-position: center center; */
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--base-bg-color) url(../svg/bg-texture-26.svg) repeat;
  background-size: cover;
  transform-origin: center center;
  z-index: 0;
  pointer-events: none;
}

@media screen and (max-width: 768px) {
  html,
  body {
    margin: 0;
    padding: 0;
    background-image: none; /* Remove background from body on mobile */
  }

  /* Rotate only the background on mobile using pseudo-element */
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--base-bg-color) url(../svg/bg-texture-26.svg) repeat;
    background-size: auto 100%;
    transform: rotate(0deg);
    transform-origin: center center;
    z-index: 0;
    pointer-events: none;
  }
}

/* Tablet-specific background sizing */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--base-bg-color) url(../svg/bg-texture-26.svg) repeat;
    background-size: auto 100%;
    transform: rotate(0deg);
    transform-origin: center center;
    z-index: 0;
    pointer-events: none;
  }
}

/* ================================
   CSS VARIABLES
   ================================ */

:root {
  --red: #ff0311;
  --blue: #0090d4;
  --dark-blue: #333faf;
  --green: #529f45;
  --yellow: #ffa700;
  --black: #040000;
  --white: #fff;
  --base-bg-color: #e8a341;
  --form-bg-color: #fda335bd;
}

/* ================================
   TYPOGRAPHY & FONTS
   ================================ */

@font-face {
  font-family: 'Alegria';
  src: url('/assets/fonts/Alegria.ttf') format('truetype');
}

@font-face {
  font-family: 'Fixture-Black';
  src: url('/assets/fonts/Fixture-Black.ttf') format('truetype');
}

body {
  font-family: 'Fixture-Black', serif;
  font-size: clamp(1rem, 2.5vw, 1.125rem); /* Responsive: 16px-18px */
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  font-family: 'Alegria', sans-serif;
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem); /* Responsive: 24px-36px */
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1.title {
  font-size: 48px;
  letter-spacing: 0.2rem;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem); /* Responsive: 20px-28px */
  line-height: 1.3;
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
}

p {
  font-size: clamp(1rem, 2.5vw, 1.125rem); /* Responsive: 16px-18px */
  color: var(--black);
  margin-bottom: 1.25rem;
  line-height: 1.6;
  max-width: 50ch;
}

label {
  font-size: clamp(0.875rem, 2vw, 1rem); /* Responsive: 14px-16px */
  color: var(--white);
  line-height: 1.4;
}

/* ================================
   LAYOUT & CONTAINERS
   ================================ */

.main-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.form-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.text-content {
  text-align: center;
  margin-bottom: 2.5rem;
  background-color: #e8a341;
  /* background-color: var(--base-bg-color); */
  padding: 8px 24px;
  border-radius: 16px;
  border: 2px solid var(--black);
}

@media screen and (max-width: 768px) {
  .text-content {
    margin-bottom: 1.25rem;
  }
}

/* ================================
   IMAGES
   ================================ */

.imgLogo {
  display: block;
  margin: 0 auto;
  padding: 0.625rem 0;
  width: min(280px, 90vw);
  height: auto;
}

.imgInfo {
  display: block;
  margin: 0 auto 1.25rem;
  width: 100%;
  height: auto;
  max-width: min(280px, 90vw);
  rotate: 13deg;
  /* Improve SVG text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Ensure crisp edges for rotated SVG */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ================================
   BUTTONS
   ================================ */

.btn-jocosidad {
  font-family: 'Alegria', sans-serif;
  font-size: clamp(1.75rem, 3vw, 2rem); /* Responsive: 20px-24px */
  /* text-shadow: 2px 2px 1px var(--black); */
  background-color: var(--red);
  color: var(--yellow);
  border: 5px solid var(--white);
  border-radius: 10px;
  margin: 1.5rem auto 0;
  display: block;
  text-align: center;
  padding: 0.75rem 1.25rem;
  transition: all 0.3s ease;
  line-height: 1.2;
  cursor: pointer;
  min-width: 200px;
  letter-spacing: 0.05rem;
}

.btn-jocosidad:hover {
  background-color: var(--black);
  border-radius: 10px;
  color: var(--white);
  transform: scale(1.1);
  border-top-color: var(--white);
  border-left-color: var(--white);
  border-right-color: var(--white);
  border-bottom-color: var(--white);
}

.disfraz-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  /* text-decoration: underline; */
  padding: 12px 24px;
  margin: 0;
  font-size: clamp(1rem, 3vw, 1.5rem);
  background-color: #fda435;
  border-radius: 9999px;
  border: 2px solid #fda435;
  transition: all 0.3s ease;

  /* border: 1px solid var(--black); */
  /* box-shadow: 2px 2px 0 var(--black); */
}

.disfraz-btn:hover {
  /* opacity: 0.8; */
  border: 2px solid var(--black);
  transform: scale(1.1);
}

.disfraz-btn:focus {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

/* ================================
   FORMS
   ================================ */

.registration-form {
  display: grid;
  gap: 1.5rem;
  border: 2px solid var(--black);
  border-radius: 10px;
  background-color: var(--base-bg-color);
  padding: 2rem;
  margin: 2rem 0;
}

.field-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
}

@media (min-width: 768px) {
  .field-group {
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      'label input'
      'error error';
    align-items: start;
    gap: 1rem 1rem;
  }
}

.field-label {
  font-size: clamp(0.875rem, 2vw, 1rem);
  color: var(--black);
  line-height: 1.4;
  margin-bottom: 0.375rem;
  font-weight: 500;
}

@media (min-width: 768px) {
  .field-label {
    grid-area: label;
    margin-bottom: 0;
    padding-top: 0.5rem;
  }
}

.field-input {
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .field-input {
    grid-area: input;
  }
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: clamp(0.875rem, 2vw, 1rem);
  font-family: inherit;
  background-color: white;
  color: #333;
  transition: border-color 0.2s ease;
  min-height: 2.75rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

select.form-input {
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6,9 12,15 18,9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

input.form-input,
select.form-input {
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0, 144, 212, 0.2);
}

.field-error {
  color: var(--black);
  font-size: clamp(0.75rem, 1.5vw, 0.875rem);
  line-height: 1.4;
  margin-top: 0.25rem;
  display: none;
}

.field-error:not(:empty) {
  display: block;
}

@media (min-width: 768px) {
  .field-error {
    grid-area: error;
    margin-top: 0.5rem;
    margin-left: 0;
  }
}

/* ================================
   LINKS
   ================================ */

a:link {
  color: var(--black);
}

a:visited {
  color: var(--black);
}

a:hover {
  color: var(--white);
  font-weight: bold;
}

.linkAddMore {
  font-size: clamp(1.125rem, 2.5vw, 1.25rem); /* Responsive: 18px-20px */
  text-decoration: none;
  text-align: center !important;
  line-height: 1.4;
}

/* ================================
   SOCIAL ICONS
   ================================ */

.socialIcons {
  display: flex;
  justify-content: center;
  gap: 0.625rem;
  margin: 2.5rem 0 5rem 0;
}

.icon {
  transition: transform 0.3s ease;
}

.icon:hover {
  transform: scale(1.1);
}

.icon svg {
  background-color: var(--yellow);
  border-radius: 20px;
}

.icon svg path {
  color: #fff;
  fill: #fff;
}

@media (min-width: 430px) {
  .socialIcons {
    display: flex;
    justify-content: center;
  }
}

/* ================================
   MODAL & POPUP COMPONENTS
   ================================ */

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: 100% auto;
  background-color: var(--base-bg-color);
  background-image: url(../svg/bg-texture-26.svg);
  background-repeat: repeat;
  background-attachment: fixed;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.popup-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.popup-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  /* box-shadow: 0 4px 20px rgba(0, 0, 0, 1); */
}

.popup-close {
  position: absolute;
  top: -40px;
  right: -10px;
  font-size: 36px;
  font-weight: normal;
  color: var(--black);
  cursor: pointer;
  z-index: 1001;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 0;
  padding: 0;
  border: none;
  font-family: Arial, sans-serif;
  transform: translateY(-1px);
}

.popup-close:hover {
  background-color: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

/* Desktop specific popup sizing */
@media screen and (min-width: 769px) {
  .popup-container {
    max-width: 600px;
    max-height: 80vh;
  }

  .popup-image {
    max-width: 600px;
    max-height: 80vh;
  }
}

/* Mobile responsive popup adjustments */
@media screen and (max-width: 768px) {
  .popup-overlay {
    background-image: none; /* Remove default background on mobile */
  }

  /* Add rotated background to popup on mobile */
  .popup-overlay::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--base-bg-color) url(../svg/bg-texture-26.svg) repeat;
    background-size: auto 100%;
    transform: rotate(0deg);
    transform-origin: center center;
    z-index: -1;
    pointer-events: none;
  }

  .popup-close {
    font-size: 30px;
    width: 40px;
    height: 40px;
    top: -30px;
    right: -5px;
  }
}

/* ================================
   UTILITY CLASSES
   ================================ */

.textObligatorio {
  color: #ffffff;
  font-size: clamp(1rem, 2.5vw, 1.125rem); /* Responsive: 16px-18px */
  text-align: center;
  margin-bottom: 2.25rem;
  line-height: 1.5;
}

.textDonacion {
  color: #000000;
  font-size: clamp(1rem, 2.5vw, 1.125rem); /* Responsive: 16px-18px */
  text-align: center;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.success-message {
  color: var(--green);
  /* color: #00b7ff; */
  color: #003c9b;
  font-size: clamp(2.1rem, 3vw, 2.5rem);
  font-weight: 400;
  text-align: center;
  line-height: 1.4;

  /* font-size: 64px; */
  /* color: white; */
  /* -webkit-text-stroke: 0.5px var(--white); */
  text-shadow: -2px -2px 0 var(--white), 2px -2px 0 var(--white),
    -2px 2px 0 var(--white), 2px 2px 0 var(--white);
}

.error-message {
  color: var(--red);
  font-size: clamp(2rem, 3vw, 2.5rem);
  font-weight: 400;
  text-align: center;
  line-height: 1.4;
  /* -webkit-text-stroke: 0.5px var(--white); */
  text-shadow: -2px -2px 0 var(--white), 2px -2px 0 var(--white),
    -2px 2px 0 var(--white), 2px 2px 0 var(--white);
}

/* ================================
   UNUSED / LEGACY STYLES
   (Commented for potential future use)
   ================================ */

/* UNUSED - Commented font-faces */
/* @font-face {
  font-family: 'SignPainter';
  src: url('/assets/fonts/SignPainter.ttc') format('truetype');
} */

/* @font-face {
  font-family: 'MyriadPro-Regular';
  src: url('/assets/fonts/MyriadPro-Regular.otf') format('opentype');
} */

/* UNUSED - Commented utility classes */
/* .rotate {
  transform: rotate(-15deg);
} */

/* UNUSED - Commented date and frase classes */
/* .date {
  font-family: 'SignPainter', serif;
  color: var(--yellow);
  font-size: 32px;
  margin-bottom: 0;
} */

/* .frase {
  color: var(--yellow);
} */

/* UNUSED - Commented fotosDisfraces class */
/* .fotosDisfraces {
  font-family: 'Lemonada', cursive;
  color: #ffffff;
  font-size: 120%;
  text-align: center !important;
  margin-bottom: 30px;
} */

/* UNUSED - Commented image class */
/* .imgName {
  margin-top: -40px;
  padding-top: 0px;
  padding-bottom: 30px;
  width: 500px;
  height: auto;
} */

/* UNUSED - Commented typography styles */
/* h1,
h2,
h3,
h4 {
  font-family: 'Lemonada', cursive;
  color: var(--white);
} */

/* UNUSED - Commented old container styles */
/* .box {
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  box-shadow: 0px 8px 14px var(--red);
  width: auto;
  height: auto;
  -webki-border-radius: 4px;
  -moz-border-radius: 4px;
  text-align: center;
} */

/* .titleForm {
  text-align: center;
  padding-top: 20px;
  padding-bottom: 60px;
} */
