/* ============================================================
   TechKids Edu — Main Stylesheet
   Colorful, animated, responsive for tablets & mobile
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Baloo+2:wght@400;600;700;800&display=swap');

:root {
  --primary:    #5B4FCF;
  --primary-lt: #7C6FE0;
  --secondary:  #FF6B6B;
  --accent:     #FFD93D;
  --green:      #6BCB77;
  --cyan:       #4CC9F0;
  --orange:     #FF9F43;
  --bg:         #F0EDFF;
  --card:       #FFFFFF;
  --text:       #2D2B55;
  --muted:      #7B7A9A;
  --radius:     18px;
  --shadow:     0 8px 32px rgba(91,79,207,0.13);
  --shadow-lg:  0 16px 48px rgba(91,79,207,0.2);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── ANIMATED BACKGROUND ── */
.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #5B4FCF 40%, #764ba2 100%);
  overflow: hidden;
}

.auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,217,61,0.25) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255,107,107,0.2)  0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(76,201,240,0.15)  0%, transparent 60%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0%   { opacity: 0.7; transform: scale(1); }
  100% { opacity: 1;   transform: scale(1.05); }
}

/* Floating bubbles */
.bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bubble {
  position: absolute;
  border-radius: 50%;
  opacity: 0.12;
  animation: floatUp linear infinite;
}
.bubble:nth-child(1)  { width:60px;  height:60px;  left:5%;   background:#FFD93D; animation-duration:12s; animation-delay:0s; }
.bubble:nth-child(2)  { width:40px;  height:40px;  left:20%;  background:#FF6B6B; animation-duration:9s;  animation-delay:2s; }
.bubble:nth-child(3)  { width:80px;  height:80px;  left:40%;  background:#6BCB77; animation-duration:14s; animation-delay:4s; }
.bubble:nth-child(4)  { width:30px;  height:30px;  left:60%;  background:#4CC9F0; animation-duration:10s; animation-delay:1s; }
.bubble:nth-child(5)  { width:55px;  height:55px;  left:75%;  background:#FF9F43; animation-duration:11s; animation-delay:3s; }
.bubble:nth-child(6)  { width:45px;  height:45px;  left:88%;  background:#ffffff; animation-duration:13s; animation-delay:5s; }

@keyframes floatUp {
  0%   { transform: translateY(110vh) rotate(0deg);   opacity: 0; }
  10%  { opacity: 0.12; }
  90%  { opacity: 0.12; }
  100% { transform: translateY(-10vh)  rotate(360deg); opacity: 0; }
}

/* Stars decoration */
.stars { position: absolute; inset: 0; pointer-events: none; }
.star {
  position: absolute;
  color: rgba(255,255,255,0.6);
  font-size: 18px;
  animation: twinkle 3s ease-in-out infinite;
}
.star:nth-child(1)  { top:8%;  left:12%; animation-delay:0s; }
.star:nth-child(2)  { top:15%; left:85%; animation-delay:0.5s; }
.star:nth-child(3)  { top:70%; left:8%;  animation-delay:1s; }
.star:nth-child(4)  { top:80%; left:90%; animation-delay:1.5s; }
.star:nth-child(5)  { top:40%; left:3%;  animation-delay:2s; }
.star:nth-child(6)  { top:55%; left:95%; animation-delay:0.8s; }
@keyframes twinkle {
  0%,100% { opacity: 0.3; transform: scale(1);    }
  50%      { opacity: 0.9; transform: scale(1.3); }
}

/* ── AUTH CARD ── */
.auth-wrapper {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 10;
}

.auth-card {
  background: var(--card);
  border-radius: 28px;
  box-shadow: var(--shadow-lg), 0 2px 0 rgba(255,255,255,0.3) inset;
  overflow: hidden;
  animation: cardIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── CARD HEADER ── */
.card-header {
  background: linear-gradient(135deg, #5B4FCF, #764ba2);
  padding: 28px 30px 20px;
  text-align: center;
  position: relative;
}
.card-header .logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}
.card-header .logo-icon {
  font-size: 36px;
  animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.card-header h1 {
  font-family: 'Baloo 2', cursive;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
}
.card-header p {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin-top: 2px;
}

/* Tab switcher */
.tab-switcher {
  display: flex;
  background: rgba(255,255,255,0.12);
  border-radius: 50px;
  padding: 4px;
  margin-top: 16px;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.tab-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* ── CARD BODY ── */
.card-body { padding: 28px 28px 24px; }

/* Role selector */
.role-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.role-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: 2.5px solid #E0DEFF;
  border-radius: var(--radius);
  background: #F8F7FF;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Nunito', sans-serif;
}
.role-btn span.role-icon { font-size: 28px; }
.role-btn span.role-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.role-btn.active {
  border-color: var(--primary);
  background: #EDE9FF;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(91,79,207,0.2);
}
.role-btn.active .role-label { color: var(--primary); }

/* Form */
.form-group {
  margin-bottom: 16px;
  position: relative;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  font-size: 17px;
  pointer-events: none;
  z-index: 1;
}
.form-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 2px solid #E0DEFF;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: #F8F7FF;
  outline: none;
  transition: all 0.25s ease;
}
.form-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(91,79,207,0.12);
}
.form-input::placeholder { color: #B0AEC8; font-weight: 600; }
.toggle-pass {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--muted);
  padding: 0;
  transition: color 0.2s;
}
.toggle-pass:hover { color: var(--primary); }

/* Two-col row for form */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Submit button */
.btn-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  font-family: 'Baloo 2', cursive;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  margin-top: 4px;
}
.btn-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
}
.btn-submit:hover::after { background: rgba(255,255,255,0.12); }
.btn-submit:active { transform: scale(0.98); }
.btn-submit.btn-login {
  background: linear-gradient(135deg, #5B4FCF, #764ba2);
  color: #fff;
  box-shadow: 0 6px 20px rgba(91,79,207,0.35);
}
.btn-submit.btn-register {
  background: linear-gradient(135deg, #FF6B6B, #FF9F43);
  color: #fff;
  box-shadow: 0 6px 20px rgba(255,107,107,0.35);
}
.btn-submit .btn-loader {
  display: none;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-submit.loading .btn-text   { display: none; }
.btn-submit.loading .btn-loader { display: inline-block; }

/* Messages */
.alert {
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
  display: none;
  animation: slideIn 0.3s ease both;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.alert.show { display: flex; align-items: center; gap: 8px; }
.alert-error   { background: #FFE8E8; color: #C0392B; border: 1.5px solid #FFBBBB; }
.alert-success { background: #E8FFE8; color: #27AE60; border: 1.5px solid #BBFFBB; }

/* Links */
.form-footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 14px;
}
.form-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.form-footer a:hover { text-decoration: underline; }

/* Decorative images row */
.deco-images {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 0 0 20px;
  overflow: hidden;
}
.deco-img-wrap {
  width: 90px;
  height: 80px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.deco-img-wrap:hover { transform: scale(1.07) rotate(-2deg); }
.deco-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── PANEL FORMS (hidden/shown) ── */
.form-panel { display: none; }
.form-panel.active { display: block; animation: fadePanel 0.4s ease both; }
@keyframes fadePanel {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── RESPONSIVE ── */

/* Tablets (768px–1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .auth-bg { padding: 30px; }
  .auth-wrapper { max-width: 520px; }
  .card-header h1 { font-size: 28px; }
  .card-header .logo-icon { font-size: 40px; }
  .card-body { padding: 32px 36px 28px; }
  .form-input { font-size: 15px; padding: 14px 14px 14px 44px; }
  .btn-submit { font-size: 17px; padding: 15px; }
  .deco-img-wrap { width: 110px; height: 95px; }
  .role-btn span.role-icon { font-size: 32px; }
  .role-btn span.role-label { font-size: 14px; }
}

/* Small phones (max 480px) */
@media (max-width: 480px) {
  .auth-bg { padding: 12px; align-items: flex-start; padding-top: 20px; }
  .auth-wrapper { max-width: 100%; }
  .auth-card { border-radius: 22px; }
  .card-header { padding: 22px 20px 16px; }
  .card-header h1 { font-size: 22px; }
  .card-header .logo-icon { font-size: 30px; }
  .card-body { padding: 20px 18px 18px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .deco-img-wrap { width: 75px; height: 68px; }
  .deco-images { gap: 10px; }
  .form-input { font-size: 14px; }
  .btn-submit { font-size: 15px; padding: 13px; }
}

/* Very small phones */
@media (max-width: 360px) {
  .deco-images { display: none; }
  .role-selector { gap: 7px; }
  .role-btn { padding: 11px 7px; }
}

/* ── UTILITIES ── */
.hidden { display: none !important; }
.mt-2  { margin-top: 8px; }
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: #E0DEFF;
  border-radius: 2px;
}

/* Password strength */
.pass-strength {
  height: 5px;
  border-radius: 5px;
  margin-top: 6px;
  background: #E0DEFF;
  overflow: hidden;
  transition: all 0.4s ease;
}
.pass-strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  transition: all 0.4s ease;
}
.pass-strength-text {
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
  color: var(--muted);
}
