/* ==========================================================================
   Simulator Framework & iOS Container Styles
   ========================================================================== */

:root {
  --phone-width: 393px;  /* iPhone 15/16 proportional size */
  --phone-height: 852px;
  --bezel-width: 14px;
  --bezel-color: #1f1f1f;
  --border-radius: 48px;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --color-primary: #8A4FFF;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top left, #1a1528 0%, #0d0a15 60%, #050409 100%);
  color: #f1ecf9;
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Parent Workspace Container */
.workspace-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  padding: 20px;
  gap: 30px;
}

/* Left Panel: Center Phone */
.simulator-panel {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 460px;
  background: rgba(255, 255, 255, 0.01);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
}

.simulator-panel::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(138, 79, 255, 0.08) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
}

/* iPhone Outer Bezel Frame */
.iphone-device {
  width: var(--phone-width);
  height: var(--phone-height);
  background: var(--bezel-color);
  border-radius: var(--border-radius);
  padding: var(--bezel-width);
  box-shadow: 
    0px 25px 50px -12px rgba(0, 0, 0, 0.7),
    0px 0px 0px 4px #2c2a35,
    inset 0 0 4px 2px rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 1;
  user-select: none;
}

/* Glare highlight running across the screen */
.screen-glare {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0) 100%);
  border-radius: var(--border-radius);
  pointer-events: none;
  z-index: 10;
}

/* iPhone Dynamic Island Camera Cutout */
.dynamic-island {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 30px;
  background: #000000;
  border-radius: 20px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 15px;
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.2);
}

.camera-lens {
  width: 12px;
  height: 12px;
  background: #111116;
  border-radius: 50%;
  border: 1px solid #1a1a24;
  box-shadow: inset 0 0 4px #000;
}

/* iPhone Screen Area */
.screen-content {
  width: 100%;
  height: 100%;
  background: #0d0914;
  border-radius: calc(var(--border-radius) - var(--bezel-width));
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* iOS Header Status Bar */
.ios-status-bar {
  height: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 28px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  z-index: 12;
  position: relative;
  background: #0d0914;
}

.status-indicators {
  display: flex;
  align-items: center;
  gap: 5px;
}

.network-type {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.15);
  padding: 1px 3px;
  border-radius: 3px;
  margin-right: 2px;
}

.battery-label {
  font-size: 11px;
}

.battery-icon {
  width: 22px;
  height: 11px;
  border: 1px solid #ffffff;
  border-radius: 3px;
  padding: 1px;
  position: relative;
}

.battery-icon::after {
  content: '';
  position: absolute;
  top: 3px;
  right: -3px;
  width: 2px;
  height: 4px;
  background: #ffffff;
  border-radius: 0 1px 1px 0;
}

.battery-level {
  height: 100%;
  background: #34c759;
  border-radius: 1px;
}

/* Virtual Home Indicator Bar at the bottom */
.ios-home-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 5px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 3px;
  z-index: 12;
}

/* WeChat Mini Program Core Frame */
.miniprogram-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px; /* Leave space for iOS Home Bar */
}

/* Mini Program Header Navigation Bar */
.nav-bar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #110d1b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #ffffff;
  z-index: 11;
  position: relative;
}

.nav-title {
  font-size: 16px;
  font-weight: 600;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.back-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 4px;
  display: none; /* Only show when nested screens are open */
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* WeChat Capsule Menu Button on the right */
.wechat-menu {
  width: 80px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  margin-left: auto;
}

.wechat-menu-dot {
  width: 5px;
  height: 5px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: -8px 0 #ffffff, 8px 0 #ffffff;
  margin-left: 10px;
}

.wechat-menu-divider {
  width: 1px;
  height: 15px;
  background: rgba(255, 255, 255, 0.2);
}

.wechat-menu-circle {
  width: 10px;
  height: 10px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  margin-right: 5px;
}

/* Main Display Canvas */
.screen-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Screen Transitions CSS */
.mp-screen, .mp-screen-tab {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0d0914;
  overflow-y: auto;
  scrollbar-width: none; /* Hide scrollbar for cleaner look */
  animation: slideIn 0.35s cubic-bezier(0.1, 0.76, 0.55, 0.94) forwards;
}

.mp-screen::-webkit-scrollbar, .mp-screen-tab::-webkit-scrollbar {
  display: none;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0.9;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Fade animation for tab switching */
.mp-screen-tab {
  animation: fadeInTab 0.2s ease-out forwards;
}

@keyframes fadeInTab {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 1V1 classroom student URL uses the full browser viewport on desktop/iPad. */
body.classroom-fullscreen {
  display: block;
  overflow: hidden;
  background: #0d0914;
}

body.classroom-fullscreen .workspace-container {
  width: 100vw;
  height: 100vh;
  padding: 0;
  gap: 0;
  display: block;
}

body.classroom-fullscreen .simulator-panel {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background: #0d0914;
}

body.classroom-fullscreen .simulator-panel::before,
body.classroom-fullscreen .screen-glare,
body.classroom-fullscreen .dynamic-island,
body.classroom-fullscreen .ios-status-bar,
body.classroom-fullscreen .ios-home-bar {
  display: none;
}

body.classroom-fullscreen .iphone-device {
  width: 100vw;
  height: 100vh;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  background: #0d0914;
}

body.classroom-fullscreen .screen-content,
body.classroom-fullscreen .miniprogram-frame {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
}

body.classroom-fullscreen .nav-bar {
  height: 56px;
  padding: 0 28px;
}

body.classroom-fullscreen .nav-title {
  max-width: min(70vw, 760px);
  font-size: 18px;
}
