/* ──────────────────────────────────────────────────────────
   GLOBAL LAYOUT - Education Support Center
────────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
}

/* ──────────────────────────────────────────────────────────
   SIDEBAR
────────────────────────────────────────────────────────── */
#sidebar {
  background: rgba(79, 70, 229, 0.92);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 32px 24px;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 50;
}

#sidebar h1 {
  font-size: 24px;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(45deg, #ffffff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 32px;
  font-style: italic;
  line-height: 1.4;
}

#sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.service-btn {
  all: unset;
  display: block;
  font-size: 15px;
  margin: 12px 0;
  padding: 16px 20px;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

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

.service-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.service-btn:hover::before {
  left: 100%;
}

.service-btn.active {
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ──────────────────────────────────────────────────────────
   MAIN COLUMN + AVATAR
────────────────────────────────────────────────────────── */
main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: 
    url('https://images.unsplash.com/photo-1562774053-701939374585?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1000&q=80') center/cover no-repeat,
    linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(124, 58, 237, 0.12) 50%, rgba(236, 72, 153, 0.08) 100%);
  background-attachment: fixed;
  animation: ambiance 20s ease-in-out infinite;
}

@keyframes ambiance {
  0%, 100% { 
    background-position: center, center;
    filter: brightness(1);
  }
  50% { 
    background-position: center, center;
    filter: brightness(1.05);
  }
}

#avatarZone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#avatarContainer {
  width: 720px;
  height: 720px;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 0 60px rgba(255, 255, 255, 0.05);
  
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(79, 70, 229, 0.05) 50%, rgba(124, 58, 237, 0.08) 100%);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

#avatarContainer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.08) 0%, transparent 50%), 
              radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.05) 0%, transparent 50%);
  border-radius: 18px;
  pointer-events: none;
  z-index: 1;
}

#avatarContainer canvas {
  border-radius: 18px;
  box-shadow: none;
  position: relative;
  z-index: 2;
}

/* ──────────────────────────────────────────────────────────
   FLOATING CONTROLS
────────────────────────────────────────────────────────── */
#controls {
  display: flex;
  gap: 16px;
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
}

.ctrl {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(79, 70, 229, 0.9), rgba(124, 58, 237, 0.95));
  display: grid;
  place-content: center;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 2px 10px rgba(79, 70, 229, 0.3);
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

.ctrl::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.ctrl:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 4px 15px rgba(79, 70, 229, 0.4);
  border-color: rgba(255, 255, 255, 0.3);
}

#pauseBtn.active {
  background: linear-gradient(45deg, #ef4444, #dc2626);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

#muteBtn.active {
  background: linear-gradient(45deg, #6b7280, #4b5563);
  box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
}

#mic.active {
  background: linear-gradient(45deg, #ef4444, #dc2626);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { transform: translateY(-3px) scale(1); }
  50% { transform: translateY(-3px) scale(1.05); }
}

/* ──────────────────────────────────────────────────────────
   START OVERLAY
────────────────────────────────────────────────────────── */
.start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: all 0.5s ease;
}

.start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

.start-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 32px;
  background: linear-gradient(45deg, #4f46e5, #7c3aed);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  color: white;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.start-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.start-button:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  background: linear-gradient(45deg, #7c3aed, #4f46e5);
}

.start-icon {
  font-size: 24px;
  animation: pulse 2s infinite;
}

.start-button:not(:disabled) .start-icon {
  animation: none;
}

/* ──────────────────────────────────────────────────────────
   TEXT-INPUT ROW
────────────────────────────────────────────────────────── */
#txtSend {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  width: 460px;
  max-width: 90%;
  gap: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border-radius: 15px;
  overflow: hidden;
}

#txtSend input {
  flex: 1;
  padding: 16px 20px;
  border: 2px solid rgba(79, 70, 229, 0.3);
  border-right: 0;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px 0 0 15px;
  outline: none;
  transition: all 0.3s ease;
}

#txtSend input:focus {
  border-color: rgba(79, 70, 229, 0.6);
  background: rgba(255, 255, 255, 1);
}

#txtSend input::placeholder {
  color: #94a3b8;
}

#txtSend button {
  width: 70px;
  border-radius: 0 15px 15px 0;
  border: 2px solid rgba(79, 70, 229, 0.3);
  background: linear-gradient(45deg, #4f46e5, #7c3aed);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

#txtSend button:hover {
  background: linear-gradient(45deg, #7c3aed, #4f46e5);
  transform: scale(1.02);
}

/* ──────────────────────────────────────────────────────────
   SUBMENU PANEL - POSITIONED NEXT TO SIDEBAR
────────────────────────────────────────────────────────── */
#submenu {
  position: fixed;
  left: 0px; /* Right next to the 280px sidebar */
  top: 80px;
  width: 380px;
  max-width: calc(100vw - 280px - 40px); /* Account for sidebar width + padding */
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-30px); /* Slide in from the left */
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  overflow-y: auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 0 20px 20px 0; /* Rounded only on the right side */
  border: 2px solid rgba(79, 70, 229, 0.2);
  border-left: none; /* No border on the left since it's against the sidebar */
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

#submenu::-webkit-scrollbar {
  width: 6px;
}

#submenu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

#submenu::-webkit-scrollbar-thumb {
  background: rgba(79, 70, 229, 0.5);
  border-radius: 3px;
}

#submenu.active {
  pointer-events: auto;
  opacity: 1;
  transform: translateX(0);
}

/* Enhanced Menu Items */
.menu-item, .finishBtn {
  all: unset;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(79, 70, 229, 0.15);
  padding: 20px 24px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.4;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.menu-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.05), transparent);
  transition: left 0.6s ease;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(79, 70, 229, 0.3);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    0 12px 35px rgba(0, 0, 0, 0.15),
    0 4px 15px rgba(79, 70, 229, 0.2);
}

.menu-item:hover::before {
  left: 100%;
}

.item-name {
  font-weight: 600;
  color: #1e293b;
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}

.item-description {
  font-size: 14px;
  color: #64748b;
  line-height: 1.4;
  font-style: normal;
}

.item-price {
  color: #4f46e5;
  font-weight: 600;
  font-size: 14px;
  float: right;
}

.finishBtn {
  background: linear-gradient(45deg, #10b981, #059669) !important;
  border-color: transparent !important;
  color: white !important;
  font-weight: 600;
  text-align: center;
  margin-top: 16px;
  font-size: 16px;
}

.finishBtn:hover {
  background: linear-gradient(45deg, #059669, #047857) !important;
  transform: translateY(-4px) scale(1.02);
}

/* ──────────────────────────────────────────────────────────
   INFORMATION PANEL
────────────────────────────────────────────────────────── */
.information-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(79, 70, 229, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 300;
}

.information-panel.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.info-content {
  padding: 30px;
  overflow-y: auto;
  max-height: calc(80vh - 60px);
  position: relative;
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(239, 68, 68, 0.8);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.close-btn:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

#infoTitle {
  color: #4f46e5;
  font-size: 24px;
  font-weight: 700;
  margin: 0 40px 20px 0;
  line-height: 1.3;
}

#infoBody {
  color: #475569;
  font-size: 16px;
  line-height: 1.6;
}

#infoBody h3 {
  color: #7c3aed;
  font-size: 18px;
  font-weight: 600;
  margin: 20px 0 10px;
}

#infoBody p {
  margin: 0 0 15px;
}

#infoBody ul {
  margin: 10px 0 15px 20px;
}

#infoBody li {
  margin: 5px 0;
}

/* ──────────────────────────────────────────────────────────
   ORDER SUMMARY CARD
────────────────────────────────────────────────────────── */
.orderBox {
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 2px solid rgba(79, 70, 229, 0.2);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.orderBox.confirmed {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.05);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.orderBox h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.orderBox h3::before {
  content: "🛍️";
  font-size: 18px;
}

.orderLine {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin: 8px 0;
  padding: 4px 0;
}

.orderLine span:first-child {
  flex: 1;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #475569;
}

.orderLine span:last-child {
  font-weight: 600;
  color: #4f46e5;
}

.orderTotal {
  margin-top: 12px;
  font-weight: 700;
  text-align: right;
  border-top: 1px solid rgba(79, 70, 229, 0.2);
  padding-top: 12px;
  font-size: 16px;
  color: #1e293b;
}

/* ──────────────────────────────────────────────────────────
   STATUS INDICATOR
────────────────────────────────────────────────────────── */
#statusIndicator {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  background: rgba(79, 70, 229, 0.9);
  color: white;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
}

.status-hidden {
  opacity: 0;
  transform: translateY(-20px);
}

.status-visible {
  opacity: 1;
  transform: translateY(0);
}

.status-success {
  background: rgba(16, 185, 129, 0.9) !important;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3) !important;
}

.status-error {
  background: rgba(239, 68, 68, 0.9) !important;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3) !important;
}

/* ──────────────────────────────────────────────────────────
   MOBILE RESPONSIVE
────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }
  
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    padding: 16px;
    z-index: 200;
  }
  
  #sidebar ul {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  
  .service-btn {
    margin: 0;
    padding: 12px 16px;
    white-space: nowrap;
    font-size: 14px;
  }
  
  main {
    margin-top: 140px;
  }
  
  #avatarContainer {
    width: 90vw;
    height: 60vh;
    max-width: 500px;
  }
  
  /* Mobile submenu positioning */
  #submenu {
    left: 10px;
    right: 10px;
    top: 160px;
    width: auto;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 280px);
    transform: translateY(-20px);
    border-radius: 20px;
    border: 2px solid rgba(79, 70, 229, 0.2);
  }
  
  #submenu.active {
    transform: translateY(0);
  }
  
  #txtSend {
    width: 90%;
  }
  
  .information-panel {
    width: 95%;
    max-height: 85vh;
  }
}

/* ──────────────────────────────────────────────────────────
   ANIMATIONS
────────────────────────────────────────────────────────── */
@keyframes slideInMenu {
  from {
    opacity: 0;
    transform: translateX(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.menu-item {
  animation: slideInMenu 0.4s ease forwards;
}

.menu-item:nth-child(1) { animation-delay: 0.1s; }
.menu-item:nth-child(2) { animation-delay: 0.15s; }
.menu-item:nth-child(3) { animation-delay: 0.2s; }
.menu-item:nth-child(4) { animation-delay: 0.25s; }
.menu-item:nth-child(5) { animation-delay: 0.3s; }
.menu-item:nth-child(6) { animation-delay: 0.35s; }
