/* ============================================================
   CUBIX App Styles
   ============================================================ */

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(160deg, var(--cx-bg) 0%, var(--cx-primary-lightest) 40%, var(--cx-bg-alt) 70%, var(--cx-bg) 100%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(108,58,225,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(6,182,212,0.06) 0%, transparent 50%),
    radial-gradient(circle at 60% 80%, rgba(139,92,246,0.06) 0%, transparent 40%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-content h1 {
  font-size: var(--cx-text-5xl);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: var(--cx-space-6);
}

.hero-content p {
  font-size: var(--cx-text-xl);
  color: var(--cx-text-secondary);
  margin-bottom: var(--cx-space-8);
  max-width: 560px;
}

.hero-stats {
  display: flex;
  gap: var(--cx-space-10);
  margin-top: var(--cx-space-10);
}

.hero-stat {
  text-align: center;
}

.hero-stat-number {
  font-size: var(--cx-text-3xl);
  font-weight: 800;
  color: var(--cx-primary);
  line-height: 1;
}

.hero-stat-label {
  font-size: var(--cx-text-sm);
  color: var(--cx-text-muted);
  margin-top: var(--cx-space-1);
}

/* Floating geometric elements */
.hero-shapes {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 45%;
  height: 80%;
  pointer-events: none;
}

.hero-shape {
  position: absolute;
  border-radius: var(--cx-radius-xl);
  opacity: 0.6;
  animation: float 8s ease-in-out infinite;
}

.hero-shape-1 {
  width: 200px; height: 200px;
  background: linear-gradient(135deg, rgba(108,58,225,0.15), rgba(139,92,246,0.1));
  top: 10%; right: 20%;
  animation-delay: 0s;
}

.hero-shape-2 {
  width: 120px; height: 120px;
  background: linear-gradient(135deg, rgba(6,182,212,0.12), rgba(34,211,238,0.08));
  top: 60%; right: 10%;
  border-radius: 50%;
  animation-delay: -2s;
}

.hero-shape-3 {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, rgba(108,58,225,0.2), rgba(167,139,250,0.1));
  top: 30%; right: 50%;
  animation-delay: -4s;
  transform: rotate(45deg);
}

@keyframes float {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  25% { transform: translateY(-55%) translateX(5px); }
  75% { transform: translateY(-45%) translateX(-5px); }
}

/* --- Module Cards (Home) --- */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--cx-space-6);
}

.module-card {
  position: relative;
  background: var(--cx-surface);
  border-radius: var(--cx-radius-xl);
  padding: var(--cx-space-8) var(--cx-space-6);
  text-align: center;
  border: 1px solid var(--cx-border-light);
  box-shadow: var(--cx-shadow-sm);
  transition: all var(--cx-transition);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--module-color, var(--cx-primary));
  transition: height var(--cx-transition);
}

.module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--cx-shadow-lg);
  border-color: var(--cx-primary-lighter);
}

.module-card:hover::before { height: 6px; }

.module-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--cx-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--cx-space-5);
  font-size: 28px;
  background: var(--module-bg, var(--cx-primary-lightest));
  color: var(--module-color, var(--cx-primary));
}

.module-card h3 {
  font-size: var(--cx-text-lg);
  margin-bottom: var(--cx-space-3);
}

.module-card p {
  font-size: var(--cx-text-sm);
  color: var(--cx-text-secondary);
  line-height: 1.6;
}

/* Module specific colors */
.module-orienta { --module-color: #6C3AE1; --module-bg: #EDE9FE; }
.module-competencias { --module-color: #06B6D4; --module-bg: #ECFEFF; }
.module-donde { --module-color: #10B981; --module-bg: #D1FAE5; }
.module-certifica { --module-color: #F59E0B; --module-bg: #FEF3C7; }
.module-tutor { --module-color: #8B5CF6; --module-bg: #F5F3FF; }

/* --- Journey --- */
.journey {
  position: relative;
  background: linear-gradient(180deg, var(--cx-bg), var(--cx-primary-lightest), var(--cx-bg));
}

.journey-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--cx-space-2);
  flex-wrap: wrap;
}

.journey-step {
  flex: 1;
  min-width: 160px;
  max-width: 220px;
  text-align: center;
  padding: var(--cx-space-6) var(--cx-space-4);
}

.journey-step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--cx-primary);
  color: white;
  font-weight: 800;
  font-size: var(--cx-text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--cx-space-4);
  box-shadow: 0 4px 15px rgba(108,58,225,0.3);
}

.journey-step h4 {
  font-size: var(--cx-text-base);
  margin-bottom: var(--cx-space-2);
}

.journey-step p {
  font-size: var(--cx-text-sm);
  color: var(--cx-text-secondary);
}

.journey-arrow {
  font-size: var(--cx-text-2xl);
  color: var(--cx-primary-lighter);
  margin-top: var(--cx-space-10);
  flex-shrink: 0;
}

/* --- Search Bar --- */
.search-bar {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-bar input {
  width: 100%;
  padding: var(--cx-space-4) var(--cx-space-6);
  padding-left: 48px;
  font-size: var(--cx-text-lg);
  border: 2px solid var(--cx-border);
  border-radius: var(--cx-radius-2xl);
  background: var(--cx-surface);
  box-shadow: var(--cx-shadow);
  transition: all var(--cx-transition);
}

.search-bar input:focus {
  border-color: var(--cx-primary);
  box-shadow: 0 0 0 4px rgba(108,58,225,0.12), var(--cx-shadow);
}

.search-bar .search-icon {
  position: absolute;
  left: var(--cx-space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--cx-text-muted);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--cx-surface);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-lg);
  box-shadow: var(--cx-shadow-xl);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--cx-space-3);
  padding: var(--cx-space-3) var(--cx-space-4);
  transition: background var(--cx-transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.search-result-item:hover { background: var(--cx-gray-50); }
.search-result-item + .search-result-item { border-top: 1px solid var(--cx-border-light); }

/* --- Catalogo --- */
.area-card {
  display: flex;
  align-items: center;
  gap: var(--cx-space-4);
  padding: var(--cx-space-5);
  background: var(--cx-surface);
  border: 1px solid var(--cx-border-light);
  border-radius: var(--cx-radius-lg);
  transition: all var(--cx-transition);
  text-decoration: none;
  color: inherit;
}

.area-card:hover {
  box-shadow: var(--cx-shadow);
  transform: translateX(4px);
  border-color: var(--cx-primary-lighter);
}

.area-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--cx-radius);
  background: var(--cx-primary-lightest);
  color: var(--cx-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.area-info h3 { font-size: var(--cx-text-base); }
.area-info p { font-size: var(--cx-text-sm); color: var(--cx-text-muted); }

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--cx-space-2);
  font-size: var(--cx-text-sm);
  color: var(--cx-text-muted);
  margin-bottom: var(--cx-space-6);
  flex-wrap: wrap;
}

.breadcrumbs a { color: var(--cx-primary); }
.breadcrumbs .separator { color: var(--cx-gray-300); }

/* --- Exam UI --- */
.exam-container {
  max-width: 800px;
  margin: 0 auto;
}

.exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--cx-space-4) 0;
  border-bottom: 1px solid var(--cx-border-light);
  margin-bottom: var(--cx-space-6);
}

.exam-progress-text {
  font-size: var(--cx-text-sm);
  font-weight: 600;
  color: var(--cx-text-secondary);
}

.exam-question {
  background: var(--cx-surface);
  border-radius: var(--cx-radius-xl);
  padding: var(--cx-space-8);
  box-shadow: var(--cx-shadow);
  margin-bottom: var(--cx-space-6);
}

.exam-question-number {
  font-size: var(--cx-text-sm);
  font-weight: 700;
  color: var(--cx-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--cx-space-4);
}

.exam-enunciado {
  font-size: var(--cx-text-lg);
  line-height: 1.7;
  margin-bottom: var(--cx-space-6);
}

.exam-contexto {
  background: var(--cx-gray-50);
  border-left: 3px solid var(--cx-primary-lighter);
  padding: var(--cx-space-4);
  border-radius: 0 var(--cx-radius) var(--cx-radius) 0;
  margin-bottom: var(--cx-space-6);
  font-size: var(--cx-text-sm);
  color: var(--cx-text-secondary);
  line-height: 1.7;
}

.exam-options { display: flex; flex-direction: column; gap: var(--cx-space-3); }

.exam-option {
  display: flex;
  align-items: flex-start;
  gap: var(--cx-space-3);
  padding: var(--cx-space-4) var(--cx-space-5);
  border: 2px solid var(--cx-border);
  border-radius: var(--cx-radius-lg);
  cursor: pointer;
  transition: all var(--cx-transition);
  background: var(--cx-surface);
}

.exam-option:hover { border-color: var(--cx-primary-lighter); background: var(--cx-primary-lightest); }
.exam-option.selected { border-color: var(--cx-primary); background: var(--cx-primary-lightest); }

.exam-option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cx-gray-100);
  color: var(--cx-text-secondary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--cx-transition);
}

.exam-option.selected .exam-option-letter {
  background: var(--cx-primary);
  color: white;
}

.exam-option-text { padding-top: var(--cx-space-1); line-height: 1.6; }

.exam-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--cx-space-4);
}

/* --- Result --- */
.result-card {
  text-align: center;
  padding: var(--cx-space-10);
}

.result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto var(--cx-space-6);
}

.result-passed .result-icon { background: var(--cx-success-light); color: var(--cx-success); }
.result-failed .result-icon { background: var(--cx-danger-light); color: var(--cx-danger); }

.result-score {
  font-size: var(--cx-text-5xl);
  font-weight: 900;
  line-height: 1;
  margin-bottom: var(--cx-space-2);
}

.result-passed .result-score { color: var(--cx-success); }
.result-failed .result-score { color: var(--cx-danger); }

/* --- Chat UI (Orienta/Tutor) --- */
.chat-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--cx-nav-height) - 160px);
  min-height: 500px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--cx-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--cx-space-4);
}

.chat-message {
  display: flex;
  gap: var(--cx-space-3);
  max-width: 85%;
  animation: fadeInUp 300ms ease-out;
}

.chat-message-user { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: var(--cx-text-sm);
}

.chat-message-ai .chat-avatar { background: var(--cx-primary-lightest); color: var(--cx-primary); }
.chat-message-user .chat-avatar { background: var(--cx-accent); color: white; }

.chat-bubble {
  padding: var(--cx-space-3) var(--cx-space-4);
  border-radius: var(--cx-radius-lg);
  font-size: var(--cx-text-sm);
  line-height: 1.7;
}

.chat-message-ai .chat-bubble {
  background: var(--cx-surface);
  border: 1px solid var(--cx-border-light);
  border-top-left-radius: 4px;
}

.chat-message-user .chat-bubble {
  background: var(--cx-primary);
  color: white;
  border-top-right-radius: 4px;
}

.chat-input-area {
  padding: var(--cx-space-4);
  border-top: 1px solid var(--cx-border-light);
  display: flex;
  gap: var(--cx-space-3);
}

.chat-input-area input {
  flex: 1;
  padding: var(--cx-space-3) var(--cx-space-4);
  border: 2px solid var(--cx-border);
  border-radius: var(--cx-radius-2xl);
  font-size: var(--cx-text-base);
  transition: border-color var(--cx-transition);
}

.chat-input-area input:focus { outline: none; border-color: var(--cx-primary); }

/* --- Certificate Public --- */
.cert-public {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.cert-valid {
  display: inline-flex;
  align-items: center;
  gap: var(--cx-space-2);
  background: var(--cx-success-light);
  color: #065F46;
  padding: var(--cx-space-2) var(--cx-space-4);
  border-radius: var(--cx-radius-full);
  font-weight: 600;
  font-size: var(--cx-text-sm);
  margin-bottom: var(--cx-space-6);
}

/* --- AI Status Banner --- */
.ai-unavailable {
  background: var(--cx-warning-light);
  color: #92400E;
  text-align: center;
  padding: var(--cx-space-3);
  font-size: var(--cx-text-sm);
  font-weight: 500;
}

/* --- Donde Estudiar --- */
.edu-filters {
  display: flex;
  gap: var(--cx-space-3);
  flex-wrap: wrap;
  margin-bottom: var(--cx-space-6);
}

.edu-filter {
  padding: var(--cx-space-2) var(--cx-space-4);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-full);
  font-size: var(--cx-text-sm);
  cursor: pointer;
  transition: all var(--cx-transition);
  background: var(--cx-surface);
  color: var(--cx-text-secondary);
}

.edu-filter:hover,
.edu-filter.active {
  border-color: var(--cx-primary);
  background: var(--cx-primary-lightest);
  color: var(--cx-primary);
}

/* --- Page padding below nav --- */
.page-content {
  padding-top: calc(var(--cx-nav-height) + var(--cx-space-8));
  padding-bottom: var(--cx-space-16);
  min-height: 70vh;
}

/* --- Competencias radar-like display --- */
.competencia-bar {
  display: flex;
  align-items: center;
  gap: var(--cx-space-3);
  margin-bottom: var(--cx-space-4);
}

.competencia-label {
  width: 200px;
  flex-shrink: 0;
  font-size: var(--cx-text-sm);
  font-weight: 500;
  text-align: right;
}

.competencia-track {
  flex: 1;
  height: 12px;
  background: var(--cx-gray-100);
  border-radius: var(--cx-radius-full);
  overflow: hidden;
}

.competencia-fill {
  height: 100%;
  border-radius: var(--cx-radius-full);
  background: linear-gradient(90deg, var(--cx-primary), var(--cx-accent));
  transition: width 1s ease-out;
}

.competencia-value {
  width: 50px;
  font-size: var(--cx-text-sm);
  font-weight: 700;
  color: var(--cx-primary);
}

@media (max-width: 768px) {
  .hero { min-height: 80vh; }
  .hero-content h1 { font-size: var(--cx-text-3xl); }
  .hero-shapes { display: none; }
  .hero-stats { gap: var(--cx-space-6); flex-wrap: wrap; }
  .journey-arrow { display: none; }
  .journey-steps { flex-direction: column; align-items: center; }
  .chat-container { height: calc(100vh - var(--cx-nav-height) - 100px); }
  .competencia-label { width: 120px; font-size: var(--cx-text-xs); }
}
