@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Outfit:wght@300;400;500;600&display=swap');

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

:root {
  --red: #B11917;
  --red-hover: #8f1412;
  --red-light: rgba(177, 25, 23, 0.06);
  --gray: #646363;
  --gray-light: #a8a7a7;
  --black: #0a0a0a;
  --white: #fafafa;
  --bg: #f2f0ee;
  --card-bg: #ffffff;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --radius: 2px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.06);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--black);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* ============================================
   HEADER
   ============================================ */

.site-header {
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-header .logo-mark {
  width: 32px;
  height: 32px;
  background: var(--red);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.site-header .logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: var(--black);
  text-decoration: none;
  text-transform: uppercase;
}

/* ============================================
   LAYOUT
   ============================================ */

.page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: cardEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(12px);
}

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

.card-accent {
  height: 4px;
  background: var(--red);
}

.card-body {
  padding: 2.5rem 2.5rem 2rem;
}

.card-body h1 {
  font-family: var(--font-display);
  font-size: 2.75rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--black);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.card-body .subtitle {
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--gray);
  margin-bottom: 2rem;
}

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

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--black);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input:focus {
  background: var(--card-bg);
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
}

.form-group input[readonly] {
  color: var(--gray-light);
  cursor: not-allowed;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.button-primary {
  display: block;
  width: 100%;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--red);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  margin-top: 1.75rem;
  position: relative;
  overflow: hidden;
}

.button-primary:hover {
  background: var(--red-hover);
  box-shadow: 0 4px 12px rgba(177, 25, 23, 0.25);
}

.button-primary:active {
  transform: scale(0.985);
}

.button-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.button-primary .spinner {
  display: none;
}

.button-primary.loading .label {
  visibility: hidden;
}

.button-primary.loading .spinner {
  display: block;
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.button-link {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid var(--red);
  transition: color 0.2s, border-color 0.2s;
}

.button-link:hover {
  color: var(--red-hover);
  border-color: var(--red-hover);
}

/* ============================================
   MESSAGES
   ============================================ */

.message-error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--red);
  background: var(--red-light);
  border-radius: var(--radius);
  border-left: 3px solid var(--red);
}

.message-loading {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--gray);
  font-weight: 300;
}

.message-loading .loader {
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--bg);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}

/* ============================================
   RESULT PAGES (SUCCESS / FAILURE)
   ============================================ */

.result-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  animation: iconPop 0.4s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  transform: scale(0.5);
}

@keyframes iconPop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.result-icon.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.result-icon.failure {
  background: var(--red-light);
  color: var(--red);
}

.result-icon svg {
  width: 28px;
  height: 28px;
}

.result-body h1 {
  margin-bottom: 0.5rem;
}

.result-body p {
  font-weight: 300;
  color: var(--gray);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.result-body .action {
  margin-top: 2rem;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-light);
  letter-spacing: 0.03em;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 540px) {
  .card-body {
    padding: 2rem 1.5rem 1.5rem;
  }

  .card-body h1 {
    font-size: 2.25rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .page {
    padding: 1rem;
    align-items: flex-start;
    padding-top: 2rem;
  }
}
