/* ===== Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== Theme Colors ===== */
:root {
  --bg: #f5f5f7;
  --card: rgba(255,255,255,0.75);
  --text: #1d1d1f;
  --subtext: #86868b;
  --border: #d2d2d7;

  --accent: #ffcc00;      /* Warm iOS yellow */
  --accent-hover: #f5b800;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10;
    --card: rgba(30,30,32,0.75);
    --text: #f5f5f7;
    --subtext: #a1a1a6;
    --border: #3a3a3c;
    --accent: #ffd60a;
    --accent-hover: #ffcc00;
  }
}

/* ===== Background Blur ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(120deg, #fff2c2, #ffffff);
  filter: blur(22px);
  transform: scale(1.1);
  z-index: -1;
}

@media (prefers-color-scheme: dark) {
  .bg {
    background: linear-gradient(120deg, #2c2c2e, #000);
  }
}

/* ===== Layout ===== */
.wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 16px;
}

/* ===== Logo ===== */
.apple-logo img {
  width: 200px;           /* mobile size */
  max-width: 90%;
  height: auto;
  margin-bottom: -20px;   /* overlaps card */
  opacity: 0;
  transform: scale(0.8);
  animation: logoAppear 1s forwards ease-out, floatLogo 3s ease-in-out infinite alternate;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.apple-logo img:hover {
  transform: scale(1.3);
}

@keyframes logoAppear {
  to { opacity: 1; transform: scale(1); }
}

@keyframes floatLogo {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

@media (min-width: 1024px) {
  .apple-logo img {
    width: 280px;
    margin-bottom: -30px;
  }
}

/* ===== Glass Card ===== */
.card {
  width: 100%;
  max-width: 400px;
  padding: 40px 32px 32px;
  border-radius: 22px;
  text-align: center;
  background: var(--card);
  backdrop-filter: blur(30px);
  box-shadow: 0 30px 60px rgba(0,0,0,0.25);
}

/* ===== Input Fields ===== */
.field {
  position: relative;
  margin-bottom: 18px;
}

.field input {
  width: 100%;
  padding: 16px 14px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.field label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--subtext);
  pointer-events: none;
  transition: 0.2s ease;
  background: var(--card);
  padding: 0 6px;
}

.field input:focus,
.field input:valid {
  border-color: var(--accent);
}

.field input:focus + label,
.field input:valid + label {
  top: -7px;
  font-size: 12px;
  color: var(--accent);
}

/* ===== Password Toggle ===== */
.password-field .toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 16px;
  user-select: none;
}

/* ===== Submit Button ===== */
button {
  width: 100%;
  height: 52px;
  margin-top: 10px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #000;
  font-size: 20px;
  cursor: pointer;
  position: relative;
}

button:hover {
  background: var(--accent-hover);
}

/* Spinner */
.spinner {
  display: none;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

@keyframes spin { to { transform: rotate(360deg) translate(-50%, -50%); } }

button.loading .btn-text { opacity: 0; }
button.loading .spinner { display: block; }

/* ===== Links ===== */
.links {
  margin-top: 26px;
  font-size: 14px;
}

.links a {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  text-decoration: none;
}

/* ===== Desktop adjustments ===== */
@media (min-width: 1024px) {
  .card { max-width: 450px; padding: 48px 40px 40px; }
  .field input { height: 56px; padding: 18px 16px; font-size: 17px; border-radius: 14px; }
  button { height: 56px; font-size: 22px; border-radius: 16px; }
}
