/* ============================================
   TOM.AIWEB — PLATFORM STYLES
   Login page + Training dashboard
   ============================================ */

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Background */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.login-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 20%, transparent 70%);
}

.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}

.login-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.2), transparent 60%);
  top: -100px;
  left: -100px;
  animation: orb-float-1 12s ease-in-out infinite;
}

.login-glow-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.12), transparent 60%);
  bottom: -100px;
  right: -100px;
  animation: orb-float-2 14s ease-in-out infinite;
}

.login-glow-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(6, 214, 160, 0.08), transparent 60%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orb-pulse 8s ease-in-out infinite;
}

/* Login content */
.login-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
}

.login-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(135deg, #fff 30%, var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.login-card {
  width: 100%;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}

/* Animated border effect */
.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: conic-gradient(from 0deg, var(--electric-violet), var(--neon-blue), var(--neon-cyan), var(--neon-pink), var(--electric-violet));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.3;
  animation: login-border-spin 6s linear infinite;
}

@keyframes login-border-spin {
  to { filter: hue-rotate(360deg); }
}

.login-card-inner {
  background: rgba(12, 10, 35, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius);
  padding: 44px 36px;
}

/* Header */
.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
  animation: float-bounce 3s ease-in-out infinite;
}

@keyframes float-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* PIN form */
.pin-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pin-input-group {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.pin-digit {
  width: 52px;
  height: 62px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s ease;
  caret-color: var(--neon-purple);
}

.pin-digit:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.2), 0 0 0 3px rgba(124, 58, 237, 0.08);
  background: rgba(124, 58, 237, 0.06);
}

.pin-digit.filled {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.06);
}

.pin-digit.error {
  border-color: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.pin-error {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 12px;
  font-size: 0.88rem;
  color: #fca5a5;
  text-align: center;
}

.pin-error.visible {
  display: flex;
}

.btn-login {
  width: 100%;
  padding: 16px 32px;
  background: var(--grad-main);
  background-size: 200% 100%;
  color: white;
  border: none;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s var(--ease-out);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.btn-login::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s ease;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(168, 85, 247, 0.4);
  background-position: 100% 0;
}

.btn-login:hover::before {
  left: 150%;
}

.btn-login.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* Divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.login-divider span {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-join {
  display: block;
  width: 100%;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
}

.btn-join:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(124, 58, 237, 0.2);
  color: var(--text-primary);
}

.login-footer {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ============================================
   PLATFORM LAYOUT
   ============================================ */
.platform-page {
  min-height: 100vh;
}

/* Platform Navbar */
.platform-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 60px;
  background: rgba(3, 0, 20, 0.9);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(124, 58, 237, 0.08);
}

.platform-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
  max-width: 100%;
}

.platform-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.member-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(6, 214, 160, 0.08);
  border: 1px solid rgba(6, 214, 160, 0.15);
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--neon-cyan);
}

.member-dot {
  width: 6px;
  height: 6px;
  background: var(--neon-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--neon-cyan);
  animation: pulse-dot 2s ease-in-out infinite;
}

.btn-logout {
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* Layout grid */
.platform-layout {
  display: flex;
  padding-top: 60px;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: 340px;
  min-width: 340px;
  height: calc(100vh - 60px);
  position: fixed;
  top: 60px;
  left: 0;
  background: rgba(7, 5, 26, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  overflow-y: auto;
  z-index: 50;
  transition: transform 0.4s var(--ease-out);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.2);
  border-radius: 4px;
}

.sidebar-header {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.sidebar-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--grad-main);
  border-radius: 6px;
  transition: width 0.8s var(--ease-out);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Modules */
.sidebar-modules {
  padding: 8px 0;
}

.sidebar-module {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.module-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.3s ease;
  user-select: none;
}

.module-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.module-status {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.module-status.completed {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  color: var(--bg-void);
  box-shadow: 0 0 10px rgba(6, 214, 160, 0.3);
}

.module-status.completed::after {
  content: '✓';
  font-weight: 700;
}

.module-number {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--neon-purple);
  min-width: 20px;
}

.module-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
}

.module-chevron {
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.sidebar-module.open .module-chevron {
  transform: rotate(90deg);
}

/* Lessons */
.module-lessons {
  display: none;
  padding: 4px 0;
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-module.open .module-lessons {
  display: block;
}

.lesson-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 10px 52px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all 0.2s ease;
  position: relative;
}

.lesson-link:hover {
  background: rgba(124, 58, 237, 0.06);
  color: var(--text-primary);
}

.lesson-link.active {
  background: rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
  border-left: 2px solid var(--neon-purple);
}

.lesson-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  transition: all 0.3s ease;
}

.lesson-check.completed {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  color: var(--bg-void);
  box-shadow: 0 0 8px rgba(6, 214, 160, 0.2);
}

.lesson-check.completed::after {
  content: '✓';
  font-weight: 700;
}

.lesson-title {
  flex: 1;
  line-height: 1.4;
}

.lesson-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 200;
  width: 50px;
  height: 50px;
  background: var(--grad-main);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
}

.sidebar-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.platform-main {
  flex: 1;
  margin-left: 340px;
  min-height: calc(100vh - 60px);
}

/* Welcome state */
.welcome-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 40px 24px;
}

.welcome-inner {
  text-align: center;
  max-width: 520px;
}

.welcome-icon {
  font-size: 4rem;
  margin-bottom: 24px;
  display: block;
  animation: float-bounce 3s ease-in-out infinite;
}

.welcome-title {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.welcome-text {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 36px;
}

.welcome-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 36px;
}

.welcome-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ws-number {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  background: var(--grad-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.btn-start-learning {
  padding: 16px 40px;
  background: var(--grad-main);
  background-size: 200% 100%;
  color: white;
  border: none;
  border-radius: 60px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s var(--ease-out);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.btn-start-learning:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(168, 85, 247, 0.4);
}

/* ============================================
   VIDEO PLAYER STATE
   ============================================ */
.video-state {
  padding: 28px 32px 40px;
}

.video-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.bc-module {
  color: var(--neon-purple);
  font-weight: 600;
}

.bc-sep {
  color: var(--text-muted);
}

.bc-lesson {
  color: var(--text-secondary);
}

/* Video container */
.video-container {
  margin-bottom: 24px;
}

.video-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(12, 10, 35, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.video-player iframe,
.video-player video {
  width: 100%;
  height: 100%;
  border: none;
}

/* Placeholder */
.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.06), rgba(12, 10, 35, 0.9));
}

.vp-icon {
  width: 80px;
  height: 80px;
  background: var(--grad-main);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
  cursor: pointer;
  transition: all 0.4s var(--ease-out);
}

.vp-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 0 50px rgba(168, 85, 247, 0.5);
}

.vp-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
}

.vp-text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Video info */
.video-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.video-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.video-module-label {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.btn-mark-complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: rgba(6, 214, 160, 0.08);
  border: 1px solid rgba(6, 214, 160, 0.2);
  border-radius: 12px;
  color: var(--neon-cyan);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-mark-complete:hover {
  background: rgba(6, 214, 160, 0.15);
  box-shadow: 0 0 20px rgba(6, 214, 160, 0.1);
}

.btn-mark-complete.completed {
  background: rgba(6, 214, 160, 0.15);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(6, 214, 160, 0.15);
}

.btn-mark-complete.completed .bmc-icon {
  background: var(--neon-cyan);
  color: var(--bg-void);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

/* Prev/Next navigation */
.video-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

.btn-prev-lesson,
.btn-next-lesson {
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-prev-lesson:hover:not(:disabled),
.btn-next-lesson:hover:not(:disabled) {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.2);
  color: var(--text-primary);
}

.btn-prev-lesson:disabled,
.btn-next-lesson:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-next-lesson {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.15);
  color: var(--neon-purple);
}

/* ============================================
   RESPONSIVE — PLATFORM
   ============================================ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .platform-main {
    margin-left: 0;
  }
}

@media (max-width: 600px) {
  .pin-digit {
    width: 44px;
    height: 54px;
    font-size: 1.2rem;
  }

  .login-card-inner {
    padding: 32px 20px;
  }

  .video-state {
    padding: 20px 16px 32px;
  }

  .video-info {
    flex-direction: column;
  }

  .video-nav {
    flex-direction: column;
  }

  .welcome-stats {
    gap: 24px;
  }

  .member-badge {
    display: none;
  }
}
