/* ============================================
   BCAA Video Player — Login Gate
   Styled to match reference project (smart-websites-admin)
   ============================================ */

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-deep);
  overflow-y: auto;
}

.gate-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Logo */
.gate-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.gate-logo img {
  height: 80px;
  width: auto;
}

/* Branding */
.gate-branding {
  text-align: center;
  margin-bottom: 24px;
}

.gate-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.gate-byline {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.gate-byline a {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: opacity var(--transition);
}

.gate-byline a:hover {
  opacity: 0.8;
}

/* Form */
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gate-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gate-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.gate-field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.gate-field input::placeholder {
  color: var(--text-dim);
}

.gate-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.gate-field input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Password field with toggle */
.gate-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.gate-password-wrap input {
  padding-right: 44px;
}

.gate-password-toggle {
  position: absolute;
  right: 8px;
  padding: 6px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

.gate-password-toggle:hover {
  color: var(--text-muted);
}

/* Submit */
.gate-submit {
  width: 100%;
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.gate-submit:hover {
  background: var(--primary-hover);
}

.gate-submit:active {
  transform: scale(0.98);
}

.gate-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.gate-submit--loading {
  position: relative;
  color: transparent;
}

.gate-submit--loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Error — always in DOM for reliable role="alert" announcements */
.gate-error {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  text-align: center;
  transition: max-height 0.2s ease, padding 0.2s ease;
}

.gate-error.visible {
  padding: 12px 16px;
  max-height: 100px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Footer */
.gate-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.gate-footer a {
  color: var(--primary);
  text-decoration: none;
  transition: opacity var(--transition);
}

.gate-footer a:hover {
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 480px) {
  .gate {
    padding: 16px;
    align-items: flex-start;
    padding-top: 15vh;
  }

  .gate-card {
    padding: 24px 20px;
  }

  .gate-logo img {
    height: 60px;
  }

  .gate-title {
    font-size: 1.25rem;
  }

  .gate-field input {
    padding: 12px 14px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .gate-submit {
    padding: 14px 24px;
    font-size: 16px;
  }
}
