/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #F37021;
  --primary-dark: #D45A0A;
  --primary-light: #FFF3EB;
  --primary-glow: rgba(243, 112, 33, 0.25);
  --bg: #F8F6F3;
  --surface: #FFFFFF;
  --surface-alt: #F5F0EB;
  --surface-glass: rgba(255, 255, 255, 0.85);
  --text: #1A1A1A;
  --text-secondary: #555555;
  --text-muted: #888888;
  --border: #E0D6CC;
  --border-light: #EDE6DD;
  --accent-blue: #2563EB;
  --accent-green: #16A34A;
  --accent-yellow: #CA8A04;
  --accent-purple: #7C3AED;
  --accent-red: #DC2626;
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --shadow-glow: 0 8px 32px rgba(243,112,33,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ===== Login Screen ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #F37021 0%, #D45A0A 40%, #B84508 70%, #8B3406 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Partículas flutuantes */
.login-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-particles span {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  animation: particleFloat 8s ease-in-out infinite;
}

.login-particles span:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 7s; }
.login-particles span:nth-child(2) { left: 30%; top: 60%; animation-delay: 1s; animation-duration: 9s; width: 12px; height: 12px; }
.login-particles span:nth-child(3) { left: 60%; top: 10%; animation-delay: 2s; animation-duration: 6s; width: 6px; height: 6px; }
.login-particles span:nth-child(4) { left: 80%; top: 50%; animation-delay: 3s; animation-duration: 10s; }
.login-particles span:nth-child(5) { left: 50%; top: 80%; animation-delay: 1.5s; animation-duration: 8s; width: 10px; height: 10px; }
.login-particles span:nth-child(6) { left: 90%; top: 30%; animation-delay: 4s; animation-duration: 7.5s; width: 5px; height: 5px; }

@keyframes particleFloat {
  0%, 100% { transform: translateY(0) translateX(0) scale(1); opacity: 0.3; }
  25% { transform: translateY(-40px) translateX(20px) scale(1.2); opacity: 0.6; }
  50% { transform: translateY(-80px) translateX(-10px) scale(0.8); opacity: 0.4; }
  75% { transform: translateY(-30px) translateX(30px) scale(1.1); opacity: 0.5; }
}

.login-card {
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.1) inset;
  animation: cardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 2;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-icon-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 8px 24px var(--primary-glow);
  margin-bottom: 16px;
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 8px 24px var(--primary-glow); }
  50% { box-shadow: 0 8px 40px rgba(243,112,33,0.4); }
}

.login-icon {
  font-size: 2.5rem;
  filter: brightness(1.2);
}

.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
  letter-spacing: -0.5px;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 4px;
}

.login-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--accent-red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  animation: shake 0.4s ease;
}

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

/* Login — Dev Info */
.login-dev-info {
  margin-top: 28px;
}

.login-dev-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

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

.login-dev-divider span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.login-dev-name {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.login-dev-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.login-dev-links a {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
  padding: 3px 0;
}

.login-dev-links a:hover {
  color: var(--primary);
}

/* Alternador de Login/Cadastro */
.login-toggle {
  text-align: center;
  margin-top: 20px;
}

.login-toggle a {
  font-size: 0.88rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.login-toggle a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: var(--surface);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(243,112,33,0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-full { width: 100%; padding: 16px; font-size: 1.05rem; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--surface-alt);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-success { background: linear-gradient(135deg, var(--accent-green), #15803D); color: #fff; }
.btn-success:hover { box-shadow: 0 4px 16px rgba(22,163,74,0.3); }

.btn-danger { background: linear-gradient(135deg, var(--accent-red), #B91C1C); color: #fff; }
.btn-danger:hover { box-shadow: 0 4px 16px rgba(220,38,38,0.3); }

/* ===== Header ===== */
.header {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 3px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon { font-size: 2rem; }

.logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Role Badge ===== */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.admin {
  background: #FEF2F2;
  color: var(--accent-red);
  border: 1px solid #FECACA;
}

.role-badge.coordenador {
  background: #F5F3FF;
  color: var(--accent-purple);
  border: 1px solid #DDD6FE;
}

.role-badge.aluno {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #FDDCB5;
}

/* ===== Coord Toggle ===== */
.coord-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: var(--transition);
}

.slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

.coord-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Tabs Navigation ===== */
.tabs-nav {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 61px;
  z-index: 90;
}

.tabs-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 2px;
  overflow-x: visible;
  overflow-y: visible;
}

.tabs-container::-webkit-scrollbar { height: 0; }

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--text-secondary);
  background: var(--surface-alt);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-num {
  font-weight: 700;
  font-size: 0.8rem;
  background: var(--surface-alt);
  padding: 2px 8px;
  border-radius: 4px;
}

.tab.active .tab-num {
  background: var(--primary-light);
  color: var(--primary);
}

.tab-label { font-size: 0.82rem; }

/* ===== Tab Dropdown (Unidades) ===== */
.tab-dropdown {
  position: relative;
}

.tab-dropdown-toggle {
  position: relative;
}

.tab-dropdown-arrow {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.tab-dropdown-toggle.open .tab-dropdown-arrow {
  transform: rotate(180deg);
}

.tab-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  z-index: 200;
  padding: 6px 0;
  animation: fadeIn 0.2s ease;
}

.tab-dropdown-menu.show {
  display: block;
}

.tab-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-dropdown-menu button:hover {
  background: var(--surface-alt);
  color: var(--primary);
}

.tab-dropdown-menu button.active-unit {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

/* ===== Botão ESTUDE AQUI ===== */
.estude-aqui-wrapper {
  display: flex;
  justify-content: center;
  padding: 30px 0;
}

.btn-estude-aqui {
  display: inline-block;
  padding: 18px 48px;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #00e676, #00c853, #00e676);
  background-size: 200% 200%;
  border: none;
  border-radius: 16px;
  box-shadow:
    0 0 15px rgba(0, 230, 118, 0.5),
    0 0 40px rgba(0, 230, 118, 0.3),
    0 0 80px rgba(0, 230, 118, 0.15);
  animation: pulse-glow 1.5s ease-in-out infinite, gradient-shift 3s ease infinite;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-estude-aqui:hover {
  transform: scale(1.08);
  box-shadow:
    0 0 25px rgba(0, 230, 118, 0.7),
    0 0 60px rgba(0, 230, 118, 0.4),
    0 0 100px rgba(0, 230, 118, 0.2);
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow:
      0 0 15px rgba(0, 230, 118, 0.5),
      0 0 40px rgba(0, 230, 118, 0.3),
      0 0 80px rgba(0, 230, 118, 0.15);
  }
  50% {
    box-shadow:
      0 0 25px rgba(0, 230, 118, 0.8),
      0 0 60px rgba(0, 230, 118, 0.5),
      0 0 100px rgba(0, 230, 118, 0.25);
  }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== Admin Button in Header ===== */
.btn-admin-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: linear-gradient(135deg, #ff6b35, #e74c3c);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(231, 76, 60, 0.3);
  transition: all var(--transition);
}

.btn-admin-header:hover {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  box-shadow: 0 4px 16px rgba(231, 76, 60, 0.45);
  transform: translateY(-1px);
}

.btn-admin-header:active {
  transform: translateY(0);
}

/* ===== Main Content ===== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.35s ease;
}

.tab-content.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Unit Header ===== */
.unit-header {
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
}

.unit-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.unit-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ===== Section Title ===== */
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--primary-light);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ===== Concept Cards ===== */
.concepts-section { margin-bottom: 40px; }

.concept-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.concept-card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.concept-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.concept-header:hover { background: var(--surface-alt); }

.concept-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.toggle-icon {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.concept-card.open .toggle-icon { transform: rotate(180deg); }

.concept-body {
  display: none;
  padding: 0 20px 20px;
}

.concept-card.open .concept-body {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.concept-body p {
  margin-bottom: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.concept-body ul, .concept-body ol {
  margin: 8px 0 16px 20px;
  color: var(--text-secondary);
}

.concept-body li { margin-bottom: 6px; }

/* ===== Grid Layouts ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

/* ===== Mini Cards ===== */
.mini-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  border-left: 4px solid var(--border);
}

.mini-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
  color: var(--text);
}

.mini-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.mini-card.accent-blue { border-left-color: var(--accent-blue); }
.mini-card.accent-green { border-left-color: var(--accent-green); }
.mini-card.accent-yellow { border-left-color: var(--accent-yellow); }
.mini-card.accent-purple { border-left-color: var(--accent-purple); }
.mini-card.accent-red { border-left-color: var(--accent-red); }

/* ===== Info & Warning Boxes ===== */
.info-box {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 12px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.example-box {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 12px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.warning-box {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 12px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.formula-box {
  background: #F5F3FF;
  border: 1px solid #DDD6FE;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 12px 0;
}

.formula {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-purple);
  text-align: center;
  margin: 12px 0;
  padding: 8px;
  background: rgba(124,58,237,0.05);
  border-radius: 4px;
}

/* ===== Process Flow ===== */
.process-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
  padding: 16px;
}

.process-step {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  color: var(--primary-dark);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.process-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* ===== Risk Matrix ===== */
.matrix-example { margin: 16px 0; }

.matrix-example h5 {
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: var(--text);
}

.risk-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.risk-matrix th, .risk-matrix td {
  padding: 10px 14px;
  text-align: center;
  border: 1px solid var(--border);
}

.risk-matrix th {
  background: var(--surface-alt);
  font-weight: 600;
  color: var(--text-secondary);
}

.risk-low { background: #F0FDF4; color: var(--accent-green); }
.risk-medium { background: #FFFBEB; color: var(--accent-yellow); }
.risk-high { background: #FEF2F2; color: var(--accent-red); }
.risk-critical { background: #FEE2E2; color: #B91C1C; font-weight: 700; }

.small-text { font-size: 0.82rem; color: var(--text-muted); }

/* ===== Mind Map ===== */
.mind-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin: 20px 0;
  padding: 24px;
}

.mind-node {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border-color var(--transition);
}

.mind-node:hover { border-color: var(--primary); }

.mind-node.central {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
  padding: 20px 32px;
}

.mind-branches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  width: 100%;
}

.mind-node small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.node-1 { border-left: 3px solid var(--accent-blue); }
.node-2 { border-left: 3px solid var(--accent-green); }
.node-3 { border-left: 3px solid var(--accent-yellow); }
.node-4 { border-left: 3px solid var(--accent-purple); }

/* ===== Section Hint ===== */
.section-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 8px;
  font-style: italic;
}

/* ===== Flash Cards Grid ===== */
.flashcards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 8px 0;
}

.flashcard {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.flashcard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  transition: height var(--transition);
}

.flashcard[data-color="orange"]::before { background: linear-gradient(90deg, #F37021, #FF9A56); }
.flashcard[data-color="blue"]::before { background: linear-gradient(90deg, #2563EB, #60A5FA); }
.flashcard[data-color="green"]::before { background: linear-gradient(90deg, #16A34A, #4ADE80); }
.flashcard[data-color="purple"]::before { background: linear-gradient(90deg, #7C3AED, #A78BFA); }
.flashcard[data-color="red"]::before { background: linear-gradient(90deg, #DC2626, #F87171); }

.flashcard:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.flashcard:hover::before { height: 6px; }

.flashcard:active {
  transform: translateY(-2px) scale(0.99);
}

.flashcard-icon {
  font-size: 2.4rem;
  margin-bottom: 14px;
  display: inline-block;
  transition: transform var(--transition-bounce);
}

.flashcard:hover .flashcard-icon {
  transform: scale(1.15) rotate(-5deg);
}

.flashcard-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}

.flashcard-preview {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.flashcard-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--primary-light);
  color: var(--primary);
}

.flashcard[data-color="blue"] .flashcard-badge { background: #EFF6FF; color: var(--accent-blue); }
.flashcard[data-color="green"] .flashcard-badge { background: #F0FDF4; color: var(--accent-green); }
.flashcard[data-color="purple"] .flashcard-badge { background: #F5F3FF; color: var(--accent-purple); }
.flashcard[data-color="red"] .flashcard-badge { background: #FEF2F2; color: var(--accent-red); }

.flashcard-wide {
  grid-column: 1 / -1;
}

/* Flash Card Modal */
.flashcard-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.flashcard-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.flashcard-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  transform: translateY(40px) scale(0.9);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.flashcard-modal-overlay.active .flashcard-modal {
  transform: translateY(0) scale(1);
}

.flashcard-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, var(--primary-light), var(--surface));
}

.flashcard-modal-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
}

.flashcard-modal-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.flashcard-modal-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--primary);
  color: #fff;
  margin-top: 4px;
}

.flashcard-modal-close {
  position: absolute;
  right: 20px;
  top: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.flashcard-modal-close:hover {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
  transform: rotate(90deg);
}

.flashcard-modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
  animation: modalContentIn 0.5s ease 0.15s both;
}

@keyframes modalContentIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.flashcard-modal-body p {
  margin-bottom: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.95rem;
}

.flashcard-modal-body ul,
.flashcard-modal-body ol {
  margin: 8px 0 16px 20px;
  color: var(--text-secondary);
}

.flashcard-modal-body li {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* ===== Exercises ===== */
.exercises-section { margin-top: 40px; }

.exercise-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.exercise-card .etapa-titulo {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 12px;
}

.exercise-card .exercise-num {
  font-size: 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 10px;
}

.exercise-card .pergunta {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 10px;
  color: var(--text);
}

.exercise-card .conceitos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.exercise-card .conceito-tag {
  background: var(--bg);
  border: 1px solid var(--border-light);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.exercise-card .exercise-form { margin-top: 16px; }

/* ===== Feedback ===== */
.feedback-box {
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius-sm);
  animation: fadeIn 0.35s ease;
}

.feedback-box.nota-alta {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
}

.feedback-box.nota-media {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
}

.feedback-box.nota-baixa {
  background: #FEF2F2;
  border: 1px solid #FECACA;
}

.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.feedback-nota { font-size: 1.5rem; font-weight: 800; }
.feedback-nota.alta { color: var(--accent-green); }
.feedback-nota.media { color: var(--accent-yellow); }
.feedback-nota.baixa { color: var(--accent-red); }

.feedback-percentual { font-size: 0.85rem; color: var(--text-muted); }

.feedback-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 500;
}

.feedback-list {
  list-style: none;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.feedback-list li { margin-bottom: 4px; line-height: 1.5; }

.feedback-gabarito {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.feedback-gabarito summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

.feedback-gabarito p {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== CRUD Buttons ===== */
.exercise-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ===== Previously Answered ===== */
.already-answered {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.already-answered strong { color: var(--accent-green); }

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Profile Section ===== */
.profile-section {
  max-width: 700px;
  margin: 0 auto;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.profile-avatar {
  font-size: 4rem;
  margin-bottom: 12px;
}

.profile-card h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-email {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

/* ===== Stat Cards ===== */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-value {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Admin Section ===== */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.admin-section { margin-bottom: 32px; }

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

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

.aluno-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.aluno-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

.aluno-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.aluno-card .aluno-email {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.aluno-card .aluno-stats {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
}

.aluno-card .aluno-stat {
  color: var(--text-secondary);
}

.aluno-card .aluno-stat strong {
  color: var(--primary);
}

/* ===== Documents ===== */
.docs-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== Folder Cards ===== */
.folder-card {
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
  position: relative;
}

.folder-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.folder-icon {
  font-size: 2rem;
}

.folder-info {
  flex: 1;
}

.folder-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.folder-count {
  font-size: 0.78rem;
  opacity: 0.7;
}

.folder-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.folder-open .folder-arrow {
  transform: rotate(90deg);
}

/* Folder files list (hidden by default) */
.folder-files {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.folder-open .folder-files {
  max-height: 2000px;
  margin-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.1);
  padding-top: 12px;
}

.doc-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.doc-file:hover {
  background: rgba(255,255,255,0.5);
}

.doc-file-icon {
  font-size: 1.2rem;
}

.doc-file-name {
  font-size: 0.88rem;
  font-weight: 500;
}

/* ===== Folder color: Green (Projeto de Software) ===== */
.folder-green {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border: 1px solid #81c784;
}
.folder-green .folder-info h4 { color: #2e7d32; }
.folder-green .folder-count { color: #388e3c; }
.folder-green .folder-arrow { color: #2e7d32; }
.folder-green:hover { border-color: #43a047; }

/* ===== Folder color: Blue (ADS 2) ===== */
.folder-blue {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  border: 1px solid #64b5f6;
}
.folder-blue .folder-info h4 { color: #1565c0; }
.folder-blue .folder-count { color: #1976d2; }
.folder-blue .folder-arrow { color: #1565c0; }
.folder-blue:hover { border-color: #1e88e5; }

/* ===== Folder color: Purple (ADS 3) ===== */
.folder-purple {
  background: linear-gradient(135deg, #f3e5f5, #e1bee7);
  border: 1px solid #ba68c8;
}
.folder-purple .folder-info h4 { color: #7b1fa2; }
.folder-purple .folder-count { color: #8e24aa; }
.folder-purple .folder-arrow { color: #7b1fa2; }
.folder-purple:hover { border-color: #ab47bc; }

/* ===== Folder color: Orange (ADS 4) ===== */
.folder-orange {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border: 1px solid #ffb74d;
}
.folder-orange .folder-info h4 { color: #e65100; }
.folder-orange .folder-count { color: #ef6c00; }
.folder-orange .folder-arrow { color: #e65100; }
.folder-orange:hover { border-color: #fb8c00; }

/* ===== Folder color: Teal (Engenharia de Software) ===== */
.folder-teal {
  background: linear-gradient(135deg, #e0f7f5, #b2dfdb);
  border: 1px solid #4db6ac;
}
.folder-teal .folder-info h4 { color: #00695c; }
.folder-teal .folder-count { color: #00796b; }
.folder-teal .folder-arrow { color: #00695c; }
.folder-teal:hover { border-color: #00897b; }

/* ===== Doc locked state ===== */
.doc-locked {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}

.doc-locked::after {
  content: '🔒';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 1.2rem;
}

/* ===== Modal Overlay ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  animation: cardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-box-large {
  max-width: 90vw;
  max-height: 90vh;
}

.modal-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
}

.modal-box-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.modal-box-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* ===== README Content ===== */
.readme-content {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.readme-content h1,
.readme-content h2,
.readme-content h3,
.readme-content h4 {
  color: var(--text);
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 600;
}

.readme-content h1 {
  font-size: 1.6rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}
.readme-content h2 {
  font-size: 1.35rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
}
.readme-content h3 { font-size: 1.15rem; }
.readme-content h4 { font-size: 1.0rem; }

.readme-content p {
  margin-bottom: 14px;
}

.readme-content a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.readme-content a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.readme-content code {
  background: var(--surface-alt);
  color: var(--primary-dark);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: monospace;
}

.readme-content pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
}

.readme-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}

.readme-content ul, 
.readme-content ol {
  margin: 8px 0 16px 20px;
}

.readme-content ul {
  list-style-type: disc;
}

.readme-content ol {
  list-style-type: decimal;
}

.readme-content li {
  margin-bottom: 6px;
}

/* Tablas en README */
.readme-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.88rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.readme-content table th,
.readme-content table td {
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  text-align: left;
}

.readme-content table th {
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 600;
}

.readme-content table tr:nth-child(even) {
  background: var(--bg);
}

/* Blockquotes en README */
.readme-content blockquote {
  border-left: 4px solid var(--primary);
  background: var(--surface-alt);
  margin: 18px 0;
  padding: 10px 16px;
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.readme-content blockquote p {
  margin-bottom: 0;
}

/* Divisores en README */
.readme-content hr {
  border: 0;
  height: 1px;
  background: var(--border-light);
  margin: 24px 0;
}

/* Imágenes y Badges en README */
.readme-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
  margin: 4px 0;
}

/* ===== Doc Iframe ===== */
.doc-iframe {
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: var(--radius-sm);
}

/* ===== Footer ===== */
.footer {
  background: var(--surface);
  border-top: 3px solid var(--primary);
  padding: 32px 24px;
  margin-top: 60px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.04);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-main {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-dev {
  margin-bottom: 12px;
}

.footer-dev > span {
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.footer-readme-btn {
  margin-top: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: center;
  }

  .logo { justify-content: center; }

  .tabs-container { padding: 0 12px; }

  .tab { padding: 10px 12px; }
  .tab-label { display: none; }
  .tab-dropdown .tab-label { display: inline; }
  .tab-dropdown-arrow { display: inline; }
  .tab-num { font-size: 0.9rem; }

  .main-content { padding: 20px 16px; }

  .unit-header h2 { font-size: 1.3rem; }

  .login-card { padding: 28px 20px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .flashcards-grid { grid-template-columns: 1fr; }

  .flashcard-wide { grid-column: 1; }

  .mind-branches { grid-template-columns: 1fr; }

  .process-flow { padding: 12px; }

  .exercise-card { padding: 18px; }

  .feedback-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-stats { grid-template-columns: 1fr; }

  .alunos-grid { grid-template-columns: 1fr; }

  .docs-grid { grid-template-columns: 1fr; }

  .footer-links { flex-direction: column; gap: 8px; }

  .modal-box-large { max-width: 100vw; }

  .flashcard-modal {
    max-height: 90vh;
    border-radius: var(--radius);
    margin: 12px;
  }

  .flashcard-modal-header { padding: 20px; }
  .flashcard-modal-body { padding: 20px; }

  .login-dev-links { gap: 4px; }
}

@media (max-width: 480px) {
  .login-logo h1 { font-size: 1.2rem; }
  .logo h1 { font-size: 1.05rem; }
  .user-name { display: none; }
  .profile-stats { grid-template-columns: 1fr; }
  .login-icon-ring { width: 64px; height: 64px; }
  .login-icon { font-size: 2rem; }
}

/* ===== Botão Matriz RACI ===== */
.btn-raci-matrix {
  display: inline-block;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #fff !important;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-raci-matrix:hover {
  background: linear-gradient(135deg, #1D4ED8, #1E40AF);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.raci-senha {
  font-style: italic;
}

/* ===== Code Editor ===== */
.code-user-tabs-container {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 0 16px;
  -webkit-overflow-scrolling: touch;
}

.code-user-tabs-container::-webkit-scrollbar { height: 4px; }
.code-user-tabs-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.code-user-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.code-user-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.code-user-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.code-user-icon { font-size: 0.9rem; }

.code-user-count {
  background: rgba(255,255,255,0.2);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
}

.code-user-tab.active .code-user-count {
  background: rgba(255,255,255,0.3);
}

.code-editor-area {
  position: relative;
}

/* Compilador em largura ampliada (full-bleed sem transform p/ não conflitar com fadeIn) */
#tab-codigo.active {
  width: min(96vw, 1700px);
  margin-left: calc(-1 * (min(96vw, 1700px) - 100%) / 2);
}

.code-project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.code-project-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 200px;
}

.code-project-name-input {
  flex: 1;
  padding: 8px 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
}

.code-project-name-input:focus {
  outline: none;
  border-color: var(--primary);
}

.code-project-select {
  padding: 8px 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg);
  cursor: pointer;
  min-width: 160px;
}

.code-project-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.frontend-learning-cta {
  display: flex;
  justify-content: center;
  margin: 0 0 18px;
}

.btn-aprenda-frontend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 640px);
  min-height: 64px;
  padding: 18px 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #ED145B, #FF4D8D, #111827);
  background-size: 220% 220%;
  color: #fff;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 12px 30px rgba(237, 20, 91, 0.32), 0 0 0 3px rgba(237, 20, 91, 0.12);
  animation: gradient-shift 3s ease infinite, frontend-cta-pulse 1.4s ease-in-out infinite;
  transition: transform var(--transition), box-shadow var(--transition);
}

.btn-aprenda-frontend:hover,
.btn-aprenda-frontend:focus-visible {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 18px 42px rgba(237, 20, 91, 0.44), 0 0 0 4px rgba(237, 20, 91, 0.18);
}

.btn-aprenda-frontend:focus-visible {
  outline: 3px solid #111827;
  outline-offset: 3px;
}

@keyframes frontend-cta-pulse {
  0%, 100% {
    box-shadow: 0 12px 30px rgba(237, 20, 91, 0.32), 0 0 0 3px rgba(237, 20, 91, 0.12);
  }
  50% {
    box-shadow: 0 16px 44px rgba(237, 20, 91, 0.52), 0 0 0 6px rgba(237, 20, 91, 0.08);
  }
}

/* Abas de linguagem */
.code-lang-tabs {
  display: flex;
  gap: 0;
  background: #EEF2F7;
  border: 1px solid var(--border-light);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  overflow: hidden;
}

.code-lang-tab {
  padding: 10px 20px;
  background: #E2E8F0;
  border: none;
  border-right: 1px solid #CBD5E1;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-lang-tab:hover {
  color: #0F172A;
  background: #F1F5F9;
}

.code-lang-tab.active {
  background: #FFFFFF;
  color: #0F172A;
  border-bottom: 2px solid var(--primary);
}

/* Barra de ferramentas: zoom + tema */
.code-editor-toolbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}

.editor-tool-btn {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-sm);
  color: #475569;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.editor-tool-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.editor-zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.editor-zoom-label:hover {
  color: var(--primary);
}

.lang-tab-icon {
  font-size: 0.9rem;
}

/* ===== IDE Layout: File Tree + Editor ===== */
.code-ide-layout {
  display: flex;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 620px;
  background: #FFFFFF;
}

/* File Tree Panel */
.code-file-tree {
  width: 240px;
  min-width: 200px;
  background: #F1F5F9;
  border-right: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.code-file-tree-header {
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748B;
  border-bottom: 1px solid #E2E8F0;
  background: #E8EEF5;
}

.code-file-tree-project {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.6);
}

.file-tree-folder {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.code-file-tree-files {
  padding: 4px 0;
}

.code-file-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 28px;
  font-size: 0.82rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.code-file-tree-item:hover {
  background: rgba(243, 112, 33, 0.1);
  color: #0F172A;
}

.code-file-tree-item.active {
  background: rgba(243, 112, 33, 0.14);
  color: #0F172A;
  border-left: 2px solid var(--primary);
}

.file-tree-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.file-tree-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
}

.file-tree-actions {
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  gap: 2px;
}

.code-file-tree-item:hover .file-tree-actions {
  opacity: 1;
}

.file-tree-btn {
  background: none;
  border: none;
  color: #64748B;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 3px;
  transition: all 0.15s;
}

.file-tree-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0F172A;
}

/* Editor Main Section */
.code-editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.code-editor-main .code-lang-tabs {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

/* Pa\u00ednel de editores */
.code-editors-wrapper {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.code-editor-pane {
  display: none;
  height: 100%;
}

.code-editor-pane.active {
  display: block;
}

.monaco-container {
  width: 100%;
  height: 580px;
}

/* ===== Tema escuro do editor (toggle) ===== */
.code-ide-layout.editor-dark { background: #1E293B; }
.code-ide-layout.editor-dark .code-file-tree { background: #1a1f2e; border-right-color: #334155; }
.code-ide-layout.editor-dark .code-file-tree-header { background: #151a27; color: #64748B; border-bottom-color: #334155; }
.code-ide-layout.editor-dark .file-tree-folder { color: #CBD5E1; }
.code-ide-layout.editor-dark .code-file-tree-item { color: #94A3B8; }
.code-ide-layout.editor-dark .code-file-tree-item:hover { background: rgba(59,130,246,0.1); color: #E2E8F0; }
.code-ide-layout.editor-dark .code-file-tree-item.active { background: rgba(59,130,246,0.15); color: #E2E8F0; }
.code-ide-layout.editor-dark .code-lang-tabs { background: #1E293B; }
.code-ide-layout.editor-dark .code-lang-tab { background: #0F172A; color: #94A3B8; border-right-color: #334155; }
.code-ide-layout.editor-dark .code-lang-tab:hover { background: #1E293B; color: #E2E8F0; }
.code-ide-layout.editor-dark .code-lang-tab.active { background: #1E293B; color: #E2E8F0; }
.code-ide-layout.editor-dark .editor-tool-btn { background: #1E293B; border-color: #334155; color: #CBD5E1; }
.code-ide-layout.editor-dark .editor-zoom-label { color: #CBD5E1; }

/* ===== Console (full width below editor) ===== */
.code-console-full {
  margin-top: 16px;
}

.code-console-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auto-run-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: #94A3B8;
  cursor: pointer;
  user-select: none;
}

.auto-run-label input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

/* Console */
.code-console-section {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.code-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1E293B;
  border: 1px solid #334155;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.code-console-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #E2E8F0;
}

.code-console-header .btn-outline {
  color: #94A3B8;
  border-color: #475569;
  font-size: 0.75rem;
  padding: 4px 10px;
}

.code-console-header .btn-outline:hover {
  background: #334155;
  color: #E2E8F0;
}

.code-console {
  flex: 1;
  background: #0F172A;
  border: 1px solid #334155;
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 12px 16px;
  min-height: 180px;
  max-height: 250px;
  overflow-y: auto;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
}

.console-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  animation: consoleFadeIn 0.15s ease;
}

@keyframes consoleFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.console-icon {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  font-weight: 700;
}

.console-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.console-log { color: #E2E8F0; }
.console-log .console-icon { color: #64748B; }

.console-warn { color: #FBBF24; }
.console-warn .console-icon { color: #F59E0B; }

.console-error { color: #F87171; }
.console-error .console-icon { color: #EF4444; }

.console-info { color: #60A5FA; }
.console-info .console-icon { color: #3B82F6; }

/* Scrollbar do console */
.code-console::-webkit-scrollbar {
  width: 6px;
}
.code-console::-webkit-scrollbar-track {
  background: transparent;
}
.code-console::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

/* ===== Live Preview Panel ===== */
.code-preview-panel {
  margin-top: 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid #334155;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  animation: previewSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes previewSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.code-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border-bottom: 1px solid #334155;
  gap: 12px;
  flex-wrap: wrap;
}

.code-preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-preview-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.code-preview-dot.dot-red {
  background: #EF4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.code-preview-dot.dot-yellow {
  background: #F59E0B;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
}

.code-preview-dot.dot-green {
  background: #22C55E;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.4);
}

.code-preview-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #E2E8F0;
  margin: 0;
}

.code-preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(34, 197, 94, 0.15);
  color: #22C55E;
  border: 1px solid rgba(34, 197, 94, 0.3);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.code-preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.code-preview-btn {
  font-size: 0.75rem !important;
  padding: 5px 12px !important;
  border-radius: var(--radius-sm) !important;
  transition: all 0.2s ease !important;
}

.code-preview-btn.btn-outline {
  color: #94A3B8 !important;
  border-color: #475569 !important;
}

.code-preview-btn.btn-outline:hover {
  background: #334155 !important;
  color: #E2E8F0 !important;
}

.code-preview-btn.btn-success {
  background: linear-gradient(135deg, #22C55E, #16A34A) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.code-preview-btn.btn-success:hover {
  background: linear-gradient(135deg, #16A34A, #15803D) !important;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
}

.code-preview-body {
  background: #FFFFFF;
  position: relative;
  overflow: hidden;
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.code-preview-body iframe {
  width: 100%;
  height: 480px;
  border: none;
  display: block;
  background: #FFFFFF;
}

/* Preview collapsed state */
.code-preview-panel.preview-collapsed .code-preview-body {
  height: 0 !important;
  opacity: 0;
  overflow: hidden;
}

.code-preview-panel.preview-collapsed {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Preview loading shimmer */
.code-preview-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(243, 112, 33, 0.04) 50%,
    transparent 100%
  );
  animation: previewShimmer 2s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s;
}

.code-preview-body.loading::before {
  opacity: 1;
}

@keyframes previewShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ===== Preview Resize Controls ===== */
.code-preview-resize-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #475569;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.code-preview-resize-btn {
  width: 28px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
  line-height: 1;
}

.code-preview-resize-btn:hover {
  background: rgba(243, 112, 33, 0.2);
  color: #F37021;
}

.code-preview-resize-btn:active {
  transform: scale(0.9);
}

.code-preview-size-label {
  min-width: 46px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748B;
  font-family: 'Fira Code', 'Consolas', monospace;
  user-select: none;
  cursor: pointer;
}

.code-preview-size-label:hover {
  color: #F37021;
}

/* ===== Preview Resize Drag Handle ===== */
.code-preview-resize-handle {
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #1E293B, #0F172A);
  border-top: 1px solid #334155;
  cursor: ns-resize;
  transition: background 0.2s ease;
  user-select: none;
}

.code-preview-resize-handle:hover {
  background: linear-gradient(180deg, #334155, #1E293B);
}

.code-preview-resize-handle:active {
  background: linear-gradient(180deg, rgba(243, 112, 33, 0.15), #1E293B);
}

.resize-handle-grip {
  width: 40px;
  height: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.resize-handle-grip::before,
.resize-handle-grip::after {
  content: '';
  width: 32px;
  height: 2px;
  border-radius: 1px;
  background: #475569;
  transition: background 0.2s ease;
}

.code-preview-resize-handle:hover .resize-handle-grip::before,
.code-preview-resize-handle:hover .resize-handle-grip::after {
  background: #F37021;
}

/* Hide resize handle when collapsed */
.code-preview-panel.preview-collapsed .code-preview-resize-handle {
  display: none;
}

/* Responsive preview */
@media (max-width: 768px) {
  .code-preview-body iframe {
    height: 320px;
  }

  .code-preview-header {
    padding: 8px 12px;
  }

  .code-preview-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Notificação */
.code-notification {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease;
}

.code-notification-success {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: var(--accent-green);
}

.code-notification-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--accent-red);
}

/* Responsive */
@media (max-width: 768px) {
  .code-project-header {
    flex-direction: column;
    align-items: stretch;
  }

  .code-project-info {
    flex-direction: column;
  }

  .code-project-actions {
    justify-content: stretch;
  }

  .code-project-actions .btn {
    flex: 1;
  }

  .btn-aprenda-frontend {
    min-height: 58px;
    padding: 16px 20px;
    font-size: 1.05rem;
  }

  .code-ide-layout {
    flex-direction: column;
    min-height: auto;
  }

  .code-file-tree {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid #334155;
  }

  .code-file-tree-files {
    display: flex;
    overflow-x: auto;
    gap: 2px;
    padding: 4px 8px;
  }

  .code-file-tree-item {
    padding: 6px 12px;
    white-space: nowrap;
  }

  .monaco-container {
    height: 280px;
  }

  .code-console {
    min-height: 200px;
    max-height: 250px;
  }

  .code-user-tab {
    padding: 6px 12px;
    font-size: 0.78rem;
  }
}

/* ===== Ranking (cards horizontais animados) ===== */
.ranking-section {
  margin-bottom: 22px;
}

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ranking-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.ranking-leader-msg {
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border: 1px solid #FCD34D;
  color: #92400E;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 16px;
  animation: rankingMsgIn 0.5s ease;
}

@keyframes rankingMsgIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ranking-cards {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 8px 4px 16px;
  scroll-snap-type: x proximity;
}

.ranking-cards::-webkit-scrollbar { height: 8px; }
.ranking-cards::-webkit-scrollbar-track { background: transparent; }
.ranking-cards::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }

.ranking-card {
  flex: 0 0 auto;
  width: 172px;
  min-height: 158px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  scroll-snap-align: start;
  transition: transform 0.2s, box-shadow 0.2s;
}

.ranking-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.ranking-card-medal {
  font-size: 2.1rem;
  line-height: 1;
}

.ranking-card-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  word-break: break-word;
}

.ranking-card-incentivo {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--primary);
}

.ranking-card-incentivo.muted {
  color: var(--text-secondary);
  font-weight: 500;
}

.ranking-card-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ranking-card-stats span { white-space: nowrap; }

/* Pódio animado (1º, 2º, 3º lugares) */
.ranking-card-top { color: #3a2c00; }

.ranking-top-1 {
  background: linear-gradient(135deg, #FFF7DB, #FFE082);
  border-color: #FFC107;
  animation: podioGold 2s ease-in-out infinite;
}

.ranking-top-2 {
  background: linear-gradient(135deg, #F4F6F8, #CFD8DC);
  border-color: #B0BEC5;
  animation: podioFloat 2.4s ease-in-out infinite;
}

.ranking-top-3 {
  background: linear-gradient(135deg, #FBE9D8, #F0B27A);
  border-color: #E59866;
  animation: podioFloat 2.8s ease-in-out infinite;
}

.ranking-top-1 .ranking-card-medal {
  animation: medalSpin 3s ease-in-out infinite;
}

@keyframes podioGold {
  0%, 100% {
    box-shadow: 0 6px 18px rgba(255, 193, 7, 0.35), 0 0 0 0 rgba(255, 193, 7, 0.4);
    transform: translateY(0) scale(1.04);
  }
  50% {
    box-shadow: 0 14px 32px rgba(255, 193, 7, 0.5), 0 0 0 7px rgba(255, 193, 7, 0);
    transform: translateY(-6px) scale(1.06);
  }
}

@keyframes podioFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes medalSpin {
  0%, 100% { transform: rotate(0) scale(1); }
  25% { transform: rotate(-12deg) scale(1.18); }
  75% { transform: rotate(12deg) scale(1.18); }
}

@media (prefers-reduced-motion: reduce) {
  .ranking-top-1, .ranking-top-2, .ranking-top-3, .ranking-top-1 .ranking-card-medal {
    animation: none;
  }
}

/* ===== Arrastar e soltar arquivos no editor ===== */
.code-ide-layout {
  position: relative;
}

.code-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(243, 112, 33, 0.12);
  border: 3px dashed var(--primary);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.code-ide-layout.drag-active .code-drop-overlay {
  display: flex;
}

.code-drop-inner {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  background: var(--surface);
  padding: 22px 34px;
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.code-drop-inner small {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ===== Imagens do projeto (árvore) ===== */
.code-img-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-tree-add-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
}

.file-tree-add-btn:hover {
  background: rgba(99, 102, 241, 0.15);
}

.code-file-tree-images {
  padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
}

.code-img-empty {
  padding: 10px 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}

.code-img-item .file-tree-img-thumb {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid var(--border, #d1d5db);
  background-color: #fff;
}

.code-img-item .file-tree-name {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-img-item .file-tree-name:hover {
  text-decoration: underline;
  color: var(--primary);
}

.code-ide-layout.editor-dark .code-img-item .file-tree-img-thumb {
  border-color: #334155;
}

.code-ide-layout.editor-dark .file-tree-add-btn:hover {
  background: rgba(99, 102, 241, 0.25);
}

/* ===== AI CHAT PANEL ===== */

/* Botão flutuante */
.ai-chat-toggle-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
  transition: var(--transition);
}

.ai-chat-toggle-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.55);
}

.ai-toggle-icon { font-size: 1.1rem; }
.ai-toggle-label { font-size: 0.88rem; letter-spacing: 0.03em; }

/* Painel principal */
.ai-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 28px;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 999;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.ai-chat-panel.ai-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header roxo */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  color: white;
  flex-shrink: 0;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chat-avatar-head {
  font-size: 1.4rem;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-chat-title strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}

.ai-chat-subtitle {
  font-size: 0.71rem;
  opacity: 0.8;
  display: block;
}

.ai-chat-header-actions {
  display: flex;
  gap: 4px;
}

.ai-btn-icon {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ai-btn-icon:hover { background: rgba(255,255,255,0.28); }

/* Área de mensagens */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar { width: 5px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Mensagem individual */
.ai-msg {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  animation: aiMsgIn 0.22s ease;
}

@keyframes aiMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-msg-user { flex-direction: row-reverse; }

.ai-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.ai-msg-user .ai-msg-avatar {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
}

.ai-msg-bubble {
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 0.855rem;
  line-height: 1.6;
  max-width: calc(100% - 44px);
  word-break: break-word;
}

.ai-msg-user .ai-msg-bubble {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
}

.ai-msg-bubble p { margin-bottom: 5px; }
.ai-msg-bubble p:last-child { margin-bottom: 0; }
.ai-msg-bubble ul { padding-left: 18px; margin: 4px 0; }
.ai-msg-bubble li { margin-bottom: 2px; }

.ai-msg-bubble pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  margin: 8px 0;
  line-height: 1.55;
}

.ai-msg-bubble code {
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.82em;
}

.ai-msg-user .ai-msg-bubble code { background: rgba(255,255,255,0.2); }
.ai-msg-bubble pre code { background: none; padding: 0; font-size: inherit; }
.ai-msg-bubble strong { font-weight: 600; }
.ai-msg-bubble em { font-style: italic; }

/* Indicador de digitação */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}

.ai-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-purple);
  animation: aiTypingDot 1.2s ease infinite;
}

.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiTypingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Ações rápidas */
.ai-chat-quick-actions {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  flex-shrink: 0;
  border-top: 1px solid var(--border-light);
  scrollbar-width: none;
}

.ai-chat-quick-actions::-webkit-scrollbar { display: none; }

.ai-quick-btn {
  white-space: nowrap;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid rgba(243,112,33,0.2);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.ai-quick-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Área de input */
.ai-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.ai-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.855rem;
  background: var(--surface-alt);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.5;
}

.ai-chat-input:focus {
  outline: none;
  border-color: #7C3AED;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.ai-chat-send-btn {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.ai-chat-send-btn:hover { filter: brightness(1.12); transform: scale(1.05); }
.ai-chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

/* Responsividade */
@media (max-width: 480px) {
  .ai-chat-panel {
    right: 10px;
    bottom: 78px;
    width: calc(100vw - 20px);
    height: calc(100vh - 100px);
    border-radius: var(--radius);
  }
  .ai-chat-toggle-btn {
    right: 14px;
    bottom: 18px;
    padding: 10px 16px;
  }
}
