/* ============================================
   Casa y Cuentas - Course Platform Styles
   Brand: #89B8D3 sky blue, #F0E0CE rosy beige,
          #FBF8F4 cream, #C4897A rose, #4A4040 warm dark
   Fonts: DM Sans (body), DM Serif Display (hero headings)
   ============================================ */

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

:root {
  --sky: #89B8D3;
  --sky-dark: #5B8FA8;
  --beige: #F0E0CE;
  --cream: #FBF8F4;
  --rose: #C4897A;
  --rose-light: #D4A090;
  --warm-dark: #4A4040;
  --warm-mid: #7A6A6A;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(74,64,64,0.08);
  --shadow-md: 0 4px 12px rgba(74,64,64,0.1);
  --shadow-lg: 0 8px 24px rgba(74,64,64,0.12);
  --radius: 10px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--warm-dark);
  background: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--sky-dark); text-decoration: none; }
a:hover { color: var(--sky); }

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

.hero-heading {
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Navbar --- */
.navbar {
  background: var(--white);
  border-bottom: 1px solid rgba(74,64,64,0.06);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
  color: var(--warm-dark);
  font-weight: 400;
}

.navbar-brand:hover { color: var(--warm-dark); }

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

.navbar-user {
  font-size: 0.875rem;
  color: var(--warm-mid);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--sky);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--sky-dark);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--sky-dark);
  border: 2px solid var(--sky);
}
.btn-secondary:hover {
  background: var(--sky);
  color: var(--white);
}

.btn-rose {
  background: var(--rose);
  color: var(--white);
}
.btn-rose:hover {
  background: var(--rose-light);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--warm-mid);
  padding: 8px 16px;
}
.btn-ghost:hover {
  color: var(--warm-dark);
  background: rgba(74,64,64,0.04);
}

.btn-sm {
  padding: 6px 16px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1.0625rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* --- Cards --- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-body {
  padding: 24px;
}

/* --- Hero (Landing) --- */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}

.hero-heading {
  font-size: 2.5rem;
  color: var(--warm-dark);
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 1.125rem;
  color: var(--warm-mid);
  max-width: 580px;
  margin: 0 auto 32px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Module Preview (Landing) --- */
.modules-preview {
  padding: 60px 0;
}

.modules-preview h2 {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 32px;
}

.module-preview-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.module-preview-card:hover {
  box-shadow: var(--shadow-md);
}

.module-preview-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.module-number {
  background: var(--beige);
  color: var(--warm-dark);
  font-weight: 700;
  font-size: 0.8125rem;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.module-number.complete-only {
  background: var(--rose);
  color: var(--white);
}

.module-preview-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.module-preview-desc {
  color: var(--warm-mid);
  font-size: 0.9375rem;
  margin-bottom: 12px;
  padding-left: 0;
}

.module-preview-lessons {
  list-style: none;
  padding: 0;
}

.module-preview-lessons li {
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
  font-size: 0.875rem;
  color: var(--warm-mid);
}

.module-preview-lessons li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--beige);
}

.module-preview-lessons li.free-tag::after {
  content: 'GRATIS';
  margin-left: 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--sky-dark);
  background: rgba(137,184,211,0.12);
  padding: 2px 6px;
  border-radius: 4px;
}

/* --- Pricing --- */
.pricing-section {
  padding: 60px 0 80px;
}

.pricing-section h2 {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.pricing-subtitle {
  text-align: center;
  color: var(--warm-mid);
  margin-bottom: 40px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 780px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .pricing-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.pricing-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  position: relative;
  border: 2px solid transparent;
  transition: all var(--transition);
}

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

.pricing-card.featured {
  border-color: var(--rose);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--rose);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

.pricing-tier {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--warm-mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.pricing-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--warm-dark);
  margin-bottom: 4px;
}

.pricing-price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--warm-mid);
}

.pricing-note {
  font-size: 0.8125rem;
  color: var(--warm-mid);
  margin-bottom: 20px;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin-bottom: 28px;
  flex-grow: 1;
}

.pricing-features li {
  padding: 6px 0;
  font-size: 0.9375rem;
  padding-left: 24px;
  position: relative;
}

.pricing-features li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--sky);
  font-weight: 700;
}

/* --- Auth --- */
.auth-wrapper {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 420px;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 1.5rem;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--warm-mid);
  font-size: 0.9375rem;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--warm-dark);
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(74,64,64,0.15);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  color: var(--warm-dark);
  background: var(--cream);
  transition: border-color var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(137,184,211,0.15);
}

.auth-toggle {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--warm-mid);
}

.auth-toggle a {
  font-weight: 600;
}

.auth-error {
  background: #FEF2F2;
  color: #B91C1C;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: none;
}

.auth-error.visible {
  display: block;
}

/* --- Dashboard --- */
.dashboard {
  padding: 40px 0 80px;
}

.dashboard-header {
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 1.75rem;
  margin-bottom: 4px;
}

.dashboard-header p {
  color: var(--warm-mid);
}

.progress-overview {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.progress-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sky-dark);
  background: conic-gradient(var(--sky) var(--progress, 0%), var(--beige) 0%);
  position: relative;
  flex-shrink: 0;
}

.progress-circle::after {
  content: attr(data-percent) '%';
  position: absolute;
  background: var(--white);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.progress-text {
  font-size: 0.9375rem;
  color: var(--warm-mid);
}

.progress-text strong {
  color: var(--warm-dark);
}

/* --- Module List (Dashboard) --- */
.module-section {
  margin-bottom: 24px;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  padding: 4px 0;
}

.module-header h3 {
  font-size: 1.0625rem;
  flex-grow: 1;
}

.module-header .module-progress {
  font-size: 0.8125rem;
  color: var(--warm-mid);
  font-weight: 500;
}

.lesson-list {
  list-style: none;
  padding: 0;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  border-radius: var(--radius);
  margin-bottom: 6px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--warm-dark);
}

.lesson-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
  color: var(--warm-dark);
}

.lesson-item.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.lesson-item.locked:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.lesson-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--beige);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  transition: all var(--transition);
}

.lesson-check.completed {
  background: var(--sky);
  border-color: var(--sky);
  color: var(--white);
}

.lesson-info {
  flex-grow: 1;
  min-width: 0;
}

.lesson-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.lesson-meta {
  font-size: 0.8125rem;
  color: var(--warm-mid);
  display: flex;
  gap: 12px;
  margin-top: 2px;
}

.lesson-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  align-self: center;
}

.badge-free {
  background: rgba(137,184,211,0.12);
  color: var(--sky-dark);
}

.badge-complete {
  background: rgba(196,137,122,0.12);
  color: var(--rose);
}

.badge-lock {
  color: var(--warm-mid);
  font-size: 0.875rem;
}

/* Upgrade banner */
.upgrade-banner {
  background: linear-gradient(135deg, var(--beige) 0%, #F8EDE0 100%);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  margin-top: 32px;
  box-shadow: var(--shadow-sm);
}

.upgrade-banner h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
}

.upgrade-banner p {
  color: var(--warm-mid);
  font-size: 0.9375rem;
  margin-bottom: 16px;
}

/* --- Lesson Player --- */
.lesson-view {
  padding: 24px 0 80px;
}

.lesson-back {
  margin-bottom: 20px;
}

.video-wrapper {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  aspect-ratio: 16 / 9;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  font-size: 0.9375rem;
  gap: 8px;
}

.video-placeholder-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.lesson-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.lesson-header h1 {
  font-size: 1.5rem;
}

.lesson-header .lesson-module-tag {
  font-size: 0.8125rem;
  color: var(--warm-mid);
  margin-top: 4px;
}

.lesson-description {
  color: var(--warm-mid);
  font-size: 0.9375rem;
  margin-bottom: 24px;
  max-width: 700px;
}

.lesson-nav {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid rgba(74,64,64,0.08);
}

/* --- Thank You --- */
.thankyou-wrapper {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.thankyou-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 36px;
  max-width: 520px;
  box-shadow: var(--shadow-md);
}

.thankyou-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.thankyou-card h1 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.thankyou-card p {
  color: var(--warm-mid);
  font-size: 1rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* --- Footer --- */
.footer {
  background: var(--white);
  border-top: 1px solid rgba(74,64,64,0.06);
  padding: 24px 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--warm-mid);
}

/* --- Loading / Spinner --- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--beige);
  border-top-color: var(--sky);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  flex-direction: column;
  gap: 12px;
  color: var(--warm-mid);
}

/* --- Utility --- */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* --- Responsive --- */
@media (min-width: 640px) {
  .hero { padding: 100px 0 80px; }
  .hero-heading { font-size: 3.25rem; }
  .hero-sub { font-size: 1.25rem; }
}

@media (min-width: 768px) {
  .container { padding: 0 32px; }
}

@media (max-width: 639px) {
  .hero-heading { font-size: 2rem; }
  .pricing-card { padding: 24px 20px; }
  .auth-card { padding: 28px 20px; }
  .lesson-header { flex-direction: column; }
  .lesson-nav { flex-direction: column; }
  .lesson-nav .btn { width: 100%; }
  .progress-overview { flex-direction: column; text-align: center; }
}
