/* ============================================================
   AUTH.CSS – Prijava, registracija, toast, gamifikacija
   ============================================================ */

/* ---- MODAL OVERLAY ---- */
#auth-modal-overlay,
#upgrade-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 3000;
  animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body.modal-open { overflow: hidden; }

/* ---- AUTH CARD ---- */
.auth-card {
  width: min(100%, 440px);
  background: white;
  border-radius: 24px;
  padding: 2.25rem;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.22);
  position: relative;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Wide variant for profile with tabs */
.profile-card-wide {
  width: min(100%, 480px);
}

.auth-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.auth-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: background 0.15s, color 0.15s;
}
.auth-close:hover { background: var(--gray-200); color: var(--gray-800); }

.auth-logo {
  width: 60px;
  height: 60px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1.25rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.auth-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--gray-900);
  text-align: center;
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 0.92rem;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ---- FIELDS ---- */
.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}

.auth-field label small {
  font-weight: 400;
  color: var(--gray-400);
}

.auth-field input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-family: var(--font);
  font-size: 0.97rem;
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--gray-50);
}

.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: white;
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap input {
  padding-right: 3rem;
}

.toggle-pw {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.toggle-pw:hover { opacity: 1; }

/* ---- ERROR ---- */
.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border-left: 3px solid var(--danger);
}
.auth-error.hidden { display: none; }

/* ---- SUBMIT BUTTON ---- */
.auth-submit {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  margin-top: 0.25rem;
}
.auth-submit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.38);
}
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled {
  background: var(--gray-300);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.auth-submit.danger-btn {
  background: var(--gray-100);
  color: var(--danger);
  box-shadow: none;
}
.auth-submit.danger-btn:hover { background: var(--danger-light); }

.auth-divider {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-400);
  margin: 1rem 0;
  position: relative;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--gray-200);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-switch-btn {
  width: 100%;
  padding: 0.7rem;
  background: none;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.auth-switch-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.auth-switch-btn strong { color: var(--primary); }

/* ---- PROFILE CARD ---- */
.profile-card .auth-logo {
  font-size: 1.5rem;
  background: var(--primary);
  color: white;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.profile-stat {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 0.85rem;
  text-align: center;
}

.profile-stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.profile-stat-label {
  font-size: 0.72rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- UPGRADE CARD ---- */
.upgrade-card {
  width: min(100%, 460px);
}

.upgrade-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1.25rem 0;
  padding: 0;
}

.upgrade-list li {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
  color: var(--gray-700);
}

.upgrade-btn {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
  font-size: 1.05rem;
}
.upgrade-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #4338ca);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
}

/* ============================================================
   NAVBAR AUTH ELEMENTS
   ============================================================ */
#nav-auth {
  display: flex;
  align-items: center;
  position: relative;
}

.nav-login-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.nav-login-btn:hover { background: rgba(255, 255, 255, 0.28); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: background 0.15s;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  user-select: none;
}
.nav-user:hover { background: rgba(255, 255, 255, 0.28); }

.nav-avatar {
  width: 28px;
  height: 28px;
  background: white;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.nav-username {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- USER DROPDOWN MENU ---- */
.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 230px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.14);
  overflow: hidden;
  z-index: 500;
  border: 1px solid var(--gray-200);
  animation: menuIn 0.18s ease;
}
.user-menu.hidden { display: none; }

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.user-menu-info {
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--gray-100);
}
.user-menu-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--gray-900);
}
.user-menu-email {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-stats {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}
.stats-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--gray-700);
}

.user-menu-btn {
  display: block;
  width: 100%;
  padding: 0.7rem 1rem;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.12s;
}
.user-menu-btn:hover { background: var(--gray-50); }
.user-menu-btn.danger { color: var(--danger); }
.user-menu-btn.danger:hover { background: var(--danger-light); }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
#ap-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--gray-900);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  white-space: nowrap;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s;
  opacity: 0;
}
#ap-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================================
   POINTS POPUP ANIMATION
   ============================================================ */
.points-popup {
  position: fixed;
  bottom: 5rem;
  right: 2rem;
  background: var(--warning);
  color: white;
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font-size: 1rem;
  font-weight: 800;
  z-index: 8000;
  animation: pointsFloat 1.5s ease forwards;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.4);
}
@keyframes pointsFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-30px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.9); }
}

/* ============================================================
   GAMIFIKACIJA – STREAK BANNER
   ============================================================ */
.streak-banner {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: white;
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}
.streak-fire { font-size: 2rem; flex-shrink: 0; }
.streak-text { flex: 1; }
.streak-text strong { font-size: 1.1rem; display: block; }
.streak-text small { font-size: 0.8rem; opacity: 0.9; }
.streak-count {
  font-size: 2rem;
  font-weight: 900;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 0.1rem 0.75rem;
  flex-shrink: 0;
}

/* ============================================================
   VIZUALNI FEEDBACK GOVORA (Sound Wave)
   ============================================================ */
.speech-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  margin: 0.75rem 0;
}
.speech-wave.hidden { display: none; }
.speech-wave-bar {
  width: 4px;
  background: var(--primary);
  border-radius: 2px;
  animation: wave 0.8s ease-in-out infinite alternate;
  min-height: 6px;
}
.speech-wave-bar:nth-child(1) { animation-delay: 0s;    height: 14px; }
.speech-wave-bar:nth-child(2) { animation-delay: 0.1s;  height: 22px; }
.speech-wave-bar:nth-child(3) { animation-delay: 0.2s;  height: 30px; }
.speech-wave-bar:nth-child(4) { animation-delay: 0.3s;  height: 22px; }
.speech-wave-bar:nth-child(5) { animation-delay: 0.4s;  height: 14px; }
.speech-wave-bar:nth-child(6) { animation-delay: 0.15s; height: 26px; }
.speech-wave-bar:nth-child(7) { animation-delay: 0.25s; height: 18px; }
@keyframes wave {
  from { transform: scaleY(0.5); opacity: 0.7; }
  to   { transform: scaleY(1.4); opacity: 1; }
}
.speak-status-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
  min-height: 1.2rem;
}

/* ============================================================
   MOBILNI HAMBURGER MENI
   ============================================================ */
#hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  margin-right: 0.5rem;
  border-radius: 8px;
  transition: background 0.15s;
}
#hamburger-btn:hover { background: rgba(255,255,255,0.15); }

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 149;
}
#sidebar-overlay.visible { display: block; }

/* ============================================================
   PERSONALIZIRAN KVIZ IZ NAPAK
   ============================================================ */
.weak-words-section {
  background: var(--warning-light);
  border: 1px solid #fde68a;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.weak-words-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 0.5rem;
}
.weak-words-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.weak-word-chip {
  background: white;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
  color: #92400e;
  font-weight: 600;
}
.btn-weak-quiz {
  background: var(--warning);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.25rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-weak-quiz:hover { background: #b45309; }

/* ============================================================
   MOBILNI MEDIA QUERIES
   ============================================================ */
@media (max-width: 768px) {
  #hamburger-btn { display: flex; align-items: center; }

  #sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    height: calc(100vh - 60px);
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  #sidebar.open {
    transform: translateX(0);
  }

  #main {
    padding: 1rem;
  }

  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 4px;
    gap: 2px;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
  }

  .vocab-grid {
    grid-template-columns: 1fr 1fr;
  }

  .section-header {
    padding: 1rem 1.25rem;
  }
  .section-header h1 { font-size: 1.15rem; }

  .nav-username { display: none; }
  .nav-login-btn { font-size: 0.78rem; padding: 0.4rem 0.8rem; }

  #progress-bar-wrap { display: none; }
  #progress-label { font-size: 0.75rem; }

  .profile-stats-grid { grid-template-columns: 1fr 1fr; }

  .auth-card { padding: 1.5rem; border-radius: 18px; }
  .auth-title { font-size: 1.3rem; }

  #ap-toast { white-space: normal; text-align: center; max-width: 90vw; }
}

@media (max-width: 480px) {
  .vocab-grid { grid-template-columns: 1fr; }
  .nav-row { flex-direction: column; gap: 0.5rem; }
  .nav-row .btn { width: 100%; }
}

/* ============================================================
   PROFILE TABS
   ============================================================ */
.profile-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--gray-100);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 1.35rem;
}

.profile-tab-btn {
  flex: 1;
  padding: 0.5rem 0.35rem;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  text-align: center;
}

.profile-tab-btn:hover {
  color: var(--gray-800);
  background: rgba(255,255,255,0.6);
}

.profile-tab-btn.active {
  background: white;
  color: var(--primary-dark);
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

/* ============================================================
   SUBSCRIPTION PANEL
   ============================================================ */
.sub-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 99px;
  margin-bottom: 1.25rem;
}

.sub-status-badge.active {
  background: #f0fdf4;
  color: #15803d;
  border: 1.5px solid #86efac;
}

.sub-status-badge.inactive {
  background: #fef9ec;
  color: #92400e;
  border: 1.5px solid #fcd34d;
}

.sub-info-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.sub-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.sub-info-row:last-child {
  border-bottom: none;
}

.sub-info-row span {
  color: var(--gray-500);
}

.sub-info-row strong {
  color: var(--gray-800);
}

.sub-plan-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 2px solid #86efac;
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.sub-plan-price {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
}

.sub-plan-price span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--gray-500);
}

.sub-plan-features {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sub-plan-features li {
  font-size: 0.88rem;
  color: var(--gray-600);
}

/* ============================================================
   RESPONSIVE SCALING FIXES
   ============================================================ */
@media (max-width: 480px) {
  #auth-modal-overlay,
  #upgrade-modal-overlay {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .auth-card {
    width: 100%;
    border-radius: 20px 20px 14px 14px;
    padding: 1.5rem 1.25rem 1.75rem;
    max-height: 92vh;
    transform: translateY(30px) scale(1);
  }

  .auth-card.visible {
    transform: translateY(0) scale(1);
  }

  .profile-card-wide {
    width: 100%;
  }

  .profile-tab-btn {
    font-size: 0.7rem;
    padding: 0.45rem 0.2rem;
  }

  .auth-title { font-size: 1.25rem; }
  .auth-submit { font-size: 0.95rem; padding: 0.85rem; }
  .auth-field input { font-size: 0.92rem; }
  .profile-stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .profile-stat { padding: 0.65rem 0.5rem; }
  .profile-stat-val { font-size: 1.1rem; }
}

@media (max-width: 360px) {
  .profile-tab-btn { font-size: 0.65rem; }
  .auth-card { padding: 1.25rem 1rem 1.5rem; }
}
