/* ==========================================================================
   SMARTPREP MASTER STYLESHEET
   Supports both the Main Hub (Tiles) and the Conversation App (Cinematic Stage)
   ========================================================================== */

:root {
  --primary: #2563eb;       /* SmartPrep Blue */
  --primary-dark: #1e3a8a;  /* Deep Navy */
  --success: #10b981;       /* Green */
  --danger: #ef4444;        /* Red */
  --bg-light: #f8fafc;      /* Very Light Blue/Gray */
  --border-color: #e2e8f0;
  --text-main: #1f2937;
  --text-muted: #6b7280;
}

/* --- GLOBAL RESET & LAYOUT --- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overscroll-behavior-y: contain;
  overflow-x: hidden;
}

header {
  background-color: var(--primary-dark);
  color: white;
  width: 100%;
  text-align: center;
  padding: 20px 0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
  margin: 0 0 5px 0;
  font-size: 1.8rem;
}

header p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.8;
}

.nav-bar {
  background: white;
  width: 100%;
  padding: 12px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  flex-wrap: wrap;
  z-index: 100;
}

.nav-bar select, .nav-bar button, .nav-bar a {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
  background: #f1f5f9;
  color: var(--text-main);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.nav-bar button {
  background: var(--success);
  color: white;
  font-weight: bold;
  border: none;
}

.nav-bar button:hover { background: #059669; }

/* ==========================================================================
   1. HUB STYLES (Used in index.html)
   ========================================================================== */
.container {
  max-width: 900px;
  width: 90%;
  margin: 40px auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 25px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  border: 1px solid var(--border-color);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}

.card .icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.card h2 {
  margin: 0 0 10px 0;
  font-size: 1.4rem;
  color: var(--text-main);
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

/* ==========================================================================
   2. CINEMATIC ROLEPLAY STYLES (Used in converse.html)
   ========================================================================== */
.wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

#module-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 20px;
  background: white;
  padding: 10px 30px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* --- THE STAGE --- */
#cinematic-stage {
  position: relative;
  width: 100%;
  max-width: 850px;
  height: 500px;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  margin: 0 auto;
}

#scene-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center bottom;
  z-index: 1;
}

/* --- DUAL CHARACTER POSITIONING --- */
.character-sprite {
  position: absolute;
  bottom: -30px; 
  height: 95%; 
  z-index: 5;  
  object-fit: contain;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.char-pos-left {
  left: 25%;
  transform: translateX(-50%);
}

.char-pos-right {
  left: 75%;
  transform: translateX(-50%);
}

/* --- THE SPOTLIGHT EFFECT --- */
/* Highlights the person currently talking */
.character-sprite.speaking {
  filter: brightness(1);
  transform: translateX(-50%) scale(1.05);
  z-index: 6; /* Brings the speaker slightly forward */
}

/* Dims the person who is listening */
.character-sprite.listening {
  filter: brightness(0.6); 
  transform: translateX(-50%) scale(0.95); 
  z-index: 4;
}

/* --- UI & DIALOGUE LAYER --- */
#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10; /* Sits ON TOP of the character */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

#dialogue-box {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 25px;
  border-top: 6px solid var(--primary-dark); /* The thick blue separator line */
  pointer-events: auto;
}

#speaker-name {
  color: var(--primary-dark);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  margin-bottom: 5px;
}

#speaker-text {
  font-size: 1.8rem;
  font-weight: 700;
  color: #111;
  margin: 0;
  line-height: 1.2;
}

#subtitle-text {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 5px;
}

/* --- HINT BUBBLE --- */
#hint-bubble {
  align-self: center;
  background: #fef08a;
  border: 2px solid #eab308;
  padding: 12px 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  font-weight: bold;
  pointer-events: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  color: #333;
}

/* --- BUTTONS --- */
#controls-bar {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 15px;
}

.action-btn {
  padding: 12px 30px;
  border-radius: 50px;
  border: none;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: pointer;
  background: var(--primary-dark);
  color: white;
  transition: transform 0.2s;
}

.action-btn:hover { transform: scale(1.05); }
.action-btn.listening { background: var(--danger); animation: pulse 1s infinite; }

/* --- TC (TASK COMPLETE) SCREEN --- */
#final-screen-container {
  display: none;
  position: absolute; 
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 10px 50px rgba(0,0,0,0.5);
  z-index: 100;
}

#final-screen-container h2 {
  font-size: 2.5rem;
  color: var(--primary-dark);
  margin: 0 0 10px 0;
}

/* --- UTILS --- */
.hidden { display: none !important; }

#feedback {
  margin-top: 20px;
  font-size: 1.3rem;
  font-weight: bold;
  text-align: center;
  min-height: 40px;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes bounceIn {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 600px) {
  #cinematic-stage { height: 400px; }
  #speaker-text { font-size: 1.4rem; }
  #character-sprite { height: 85%; bottom: -10px; }
}