/* =========================================================================
   DigiFlux — Auth (Login / Forgot Password) Modal Stilleri
   Native <dialog> element kullanılır.
   ========================================================================= */

/* ============================================================
   <dialog> taşıyıcı — transparan, içinde .auth-card var
   ============================================================ */
dialog.auth-modal {
  padding: 0;
  border: none;
  background: transparent;
  max-width: 440px;
  width: calc(100% - 2rem);
  color: var(--df-gray-700);
  overflow: visible;
  box-sizing: border-box;
}

dialog.auth-modal::backdrop {
  background-color: rgba(10, 18, 48, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Open animations */
@keyframes auth-modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes auth-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

dialog.auth-modal[open] {
  animation: auth-modal-in 280ms var(--ease-out);
}

dialog.auth-modal[open]::backdrop {
  animation: auth-backdrop-in 280ms var(--ease-out);
}

/* Body scroll lock */
body.modal-open { overflow: hidden; }

/* ============================================================
   .auth-card — modal içeriği
   ============================================================ */
.auth-card {
  position: relative;
  background-color: var(--df-white);
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem 1.75rem;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Mobile drag-handle (sadece small screen) */
.auth-card::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--df-gray-200);
  border-radius: 2px;
  display: none;
}

/* ============================================================
   Kapatma butonu (top-right)
   ============================================================ */
.auth-close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--df-gray-100);
  color: var(--df-gray-500);
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.auth-close:hover,
.auth-close:focus-visible {
  background-color: var(--df-gray-200);
  color: var(--df-navy);
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .auth-close:hover { transform: none; }
}

/* ============================================================
   Header (icon + title + subtitle)
   ============================================================ */
.auth-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-right: 2rem;   /* prevent collision with .auth-close */
  padding-left: 2rem;
}

.auth-icon-bg {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  color: var(--df-white);
  margin-bottom: 0.25rem;
  position: relative;
}

.auth-icon-bg::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: inherit;
  filter: blur(14px);
  opacity: 0.45;
  z-index: -1;
}

.auth-icon-blue   { background: linear-gradient(135deg, var(--df-blue-deep), var(--df-blue-bright)); }
.auth-icon-orange { background: linear-gradient(135deg, var(--df-orange), var(--df-amber)); }
.auth-icon-amber  { background: linear-gradient(135deg, var(--df-amber), var(--df-orange)); }

.auth-head h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.375rem;
  color: var(--df-navy);
  margin: 0;
  letter-spacing: -0.015em;
}

.auth-head p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--df-gray-500);
  line-height: 1.5;
}

/* ============================================================
   Form
   ============================================================ */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-field label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--df-navy);
  letter-spacing: -0.005em;
}

.auth-field input[type="email"],
.auth-field input[type="text"],
.auth-field input[type="password"] {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--df-gray-700);
  background-color: var(--df-white);
  border: 1px solid var(--df-gray-200);
  border-radius: var(--radius-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: 44px;
}

.auth-field input::placeholder { color: var(--df-gray-500); opacity: 0.65; }

.auth-field input:focus {
  outline: none;
  border-color: var(--df-blue-bright);
  box-shadow: 0 0 0 3px rgba(46, 134, 255, 0.15);
}

.auth-field input:user-invalid {
  border-color: var(--df-reading);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
}

/* Password field with toggle */
.auth-pw {
  position: relative;
}

.auth-pw input {
  padding-right: 2.75rem;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--df-gray-500);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--t-fast), background-color var(--t-fast);
}

.pw-toggle:hover,
.pw-toggle:focus-visible {
  color: var(--df-blue-deep);
  background-color: var(--df-gray-100);
}

/* Remember + forgot row */
.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.125rem;
}

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--df-gray-700);
  cursor: pointer;
}

.auth-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--df-gray-200);
  border-radius: 4px;
  background-color: var(--df-white);
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast);
  position: relative;
}

.auth-check input[type="checkbox"]:checked {
  background-color: var(--df-blue-deep);
  border-color: var(--df-blue-deep);
}

.auth-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border-right: 2px solid var(--df-white);
  border-bottom: 2px solid var(--df-white);
  transform: rotate(45deg);
}

.auth-link {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--df-blue-bright);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.auth-link:hover { text-decoration: underline; }

/* ============================================================
   Error / info message box
   ============================================================ */
.auth-error {
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  background-color: rgba(255, 169, 77, 0.14);
  border: 1px solid rgba(244, 123, 32, 0.30);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: #8A4308;
  line-height: 1.5;
}

.auth-error.is-visible { display: flex; }

.auth-error::before {
  content: "ⓘ";
  font-size: 1rem;
  line-height: 1.3;
  flex-shrink: 0;
  color: var(--df-orange);
  font-weight: 700;
}

/* ============================================================
   Submit button with loading spinner
   ============================================================ */
.auth-submit {
  position: relative;
  margin-top: 0.25rem;
}

.auth-submit .btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--df-white);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.auth-submit.is-loading {
  cursor: progress;
  pointer-events: none;
  opacity: 0.85;
}

.auth-submit.is-loading .btn-label { opacity: 0.6; }
.auth-submit.is-loading .btn-spinner { display: inline-block; }

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

@media (prefers-reduced-motion: reduce) {
  .auth-submit .btn-spinner { animation: none; border-top-color: rgba(255, 255, 255, 0.7); }
}

/* ============================================================
   Divider "veya"
   ============================================================ */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0;
  color: var(--df-gray-500);
  font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--df-gray-200);
}

/* ============================================================
   Footer (alt bilgi)
   ============================================================ */
.auth-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--df-gray-200);
  text-align: center;
}

.auth-footer p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--df-gray-500);
  line-height: 1.5;
}

.auth-footer a {
  color: var(--df-blue-bright);
  font-weight: 600;
}

.auth-footer a:hover { text-decoration: underline; }

.auth-demo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.875rem;
  margin-top: 0.25rem;
  background-color: var(--df-gray-100);
  border: 1px solid var(--df-gray-200);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--df-navy);
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.auth-demo:hover,
.auth-demo:focus-visible {
  background-color: var(--df-white);
  border-color: var(--df-blue-deep);
  color: var(--df-blue-deep);
}

/* ============================================================
   Student-specific decorations
   ============================================================ */
.auth-stars {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  overflow: hidden;
}

.auth-stars span {
  position: absolute;
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--df-amber);
  opacity: 0.6;
  animation: float-up 6s ease-in-out infinite;
}

.auth-stars span:nth-child(1) { top: 30%; left: 15%; }
.auth-stars span:nth-child(2) { top: 50%; left: 85%; animation-delay: 1.5s; background: var(--df-blue-bright); }
.auth-stars span:nth-child(3) { top: 20%; left: 70%; animation-delay: 3s; width: 4px; height: 4px; }

/* ============================================================
   MOBİL — bottom-sheet stili (<600px)
   ============================================================ */
@media (max-width: 600px) {
  dialog.auth-modal {
    max-width: 100%;
    width: 100%;
    margin: 0;
    inset: auto 0 0 0;
    max-height: 92vh;
    overflow-y: auto;
  }
  .auth-card {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-top: 1.75rem;
    padding-bottom: 1.5rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .auth-card::before { display: block; }
  .auth-head { padding-left: 0.5rem; padding-right: 2rem; }

  @keyframes auth-modal-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  dialog.auth-modal[open] {
    animation: auth-modal-slide-up 320ms var(--ease-out);
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.auth-modal[open],
  dialog.auth-modal[open]::backdrop {
    animation: none;
  }
}
