@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap');

:root {
  --accent-color: #003366;
  --base-color: white;
  --text-color: #3b86c9;
  --input-color: #F3F0FF;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-family: 'Roboto', Segoe UI, sans-serif;
  font-size: 12pt;
  color: var(--text-color);
  text-align: center;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  width: 100%;
  background-image: url(../img/background.webp);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.wrapper {
  background: var(--base-color);
  backdrop-filter: blur(var(--base-blur));
  box-shadow: var(--shadow);
  width: min(430px, 90vw);
  max-width: 430px;
  padding: 42px 32px 30px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: box-shadow 0.2s;
  border-radius: 12px;
  margin: 1rem auto;
  box-sizing: border-box;
}

.wrapper:hover, .wrapper:focus-within {
  box-shadow: 0 20px 80px 0 rgba(36,62,99,0.15), 0 2px 6px rgba(36,62,99,0.07);
}

h1 {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent-color);
}

form {
  width: 100%;
  margin-top: 20px;
  margin-bottom: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

form > div {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

form > div.name-surname-container {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

form > div.name-surname-container > div {
  flex: 1;
  display: flex;
  align-items: stretch;
}

form label {
  flex-shrink: 0;
  height: 50px;
  width: 50px;
  background-color: var(--accent-color);
  fill: var(--base-color);
  color: var(--base-color);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 500;
  overflow: hidden;
  position: relative;
  transition: background 0.25s;
  box-shadow: 0 1.5px 8px 0 rgba(40,60,99,0.09);
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

form input {
    margin-left: -2px;
    box-sizing: border-box;
    flex-grow: 1;
    min-width: 0;
    height: 50px;
    padding: 1em;
    font: inherit;
    font-size: 16px;
    border: 2px solid var(--input-color);
    background-color: var(--input-color);
    transition: 150ms ease;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    border-left: none;
}

form input:hover {
  border-color: var(--accent-color);
}

form input:focus {
  outline: none;
  border-color: var(--text-color);
}

div:has(input:focus) > label {
  background-color: var(--text-color);
}

form input::placeholder {
  color: var(--text-color);
  opacity: 0.8;
}

form button {
    margin-top: 1.5rem;
    background: var(--accent-color);
    border: none;
    padding: 12px 20px;
    display: inline-block;
    font-size: 15px;
    font-weight: 600;
    width: 200px;
    text-transform: uppercase;
    cursor: pointer;
    transform: skew(-21deg);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

button span {
    display: inline-block;
    transform: skew(21deg);
    color: white;
}

form button::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 100%;
    left: 0;
    background: var(--text-color);
    opacity: 0;
    z-index: -1;
    transition: all 0.5s;
}

form button:hover {
    color: #fff;
}

form button:hover::before {
    left: 0;
    right: 0;
    opacity: 1;
}

a {
  text-decoration: none;
  color: var(--text-color);
}

a:hover {
  text-decoration: underline;
}

p {
  color: var(--accent-color);
  font-size: 0.95rem;
}

form div.incorrect label {
  background-color: #f06272;
}

form div.incorrect input {
  border-color: #f06272;
}

#error-message {
  color: #f06272;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 10px;
}

#loading-indicator {
  color: var(--accent-color);
  font-weight: bold;
  text-align: center;
  margin-top: 10px;
}

.logo {
  width: min(320px, 80vw);
  height: auto;
  margin-bottom: 40px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.32) 100%);
}

@media (min-width: 1200px) {
  body {
    padding: 2rem;
  }
  
  .wrapper {
    padding: 50px 40px 40px 40px;
  }
}

/* Responsive para tablets */
@media (max-width: 992px) {
  .wrapper {
    width: min(500px, 85vw);
    padding: 35px 25px;
  }
  
  .logo {
    width: min(280px, 75vw);
    margin-bottom: 35px;
  }
}

/* Responsive para móviles */
@media (max-width: 768px) {
  body {
    padding: 1rem;
    align-items: center;
    justify-content: center;
  }

  .wrapper {
    width: min(400px, 95vw);
    padding: 30px 20px;
    margin: 0;
  }

  form {
    width: 100%;
    margin-top: 15px;
    margin-bottom: 25px;
    gap: 10px;
  }

  form label {
    height: 45px;
    width: 45px;
    font-size: 1.2rem;
  }

  form input {
    height: 45px;
    font-size: 16px;
    padding: 0.8em;
  }

  form button {
    width: 100%;
    font-size: 14px;
    padding: 12px 15px;
    margin-top: 1.5rem;
  }

  .logo {
    width: min(220px, 70vw);
    margin-bottom: 25px;
  }

  form > div.name-surname-container {
    flex-direction: column;
    gap: 10px;
  }
  
  form > div.name-surname-container > div {
    width: 100%;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.5rem;
  }

  .wrapper {
    width: 95vw;
    padding: 25px 15px;
  }

  form label {
    height: 42px;
    width: 42px;
    font-size: 1.1rem;
  }

  form input {
    height: 42px;
    padding: 0.7em;
    font-size: 16px;
  }

  form button {
    font-size: 13px;
    padding: 11px 12px;
    width: 100%;
  }

  .logo {
    width: min(180px, 65vw);
    margin-bottom: 20px;
  }

  h1 {
    font-size: 1.3rem;
  }

  p {
    font-size: 0.9rem;
  }
}

@media (max-width: 360px) {
  .wrapper {
    padding: 20px 12px;
  }

  .logo {
    width: min(160px, 60vw);
    margin-bottom: 15px;
  }

  form {
    gap: 8px;
  }

  form label {
    height: 40px;
    width: 40px;
    font-size: 1rem;
  }

  form input {
    height: 40px;
    font-size: 16px;
  }

  h1 {
    font-size: 1.2rem;
  }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 4px solid var(--accent-color);
  border-top-color: var(--text-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}