﻿/* =========================================
   COMPONENTS — BOTONES, CARDS, FORMS, NAV
   ========================================= */

/* ── BOTONES ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: 0.75rem 1.75rem;
  border-radius: var(--border-radius-md); font-family: var(--font-sans);
  font-size: var(--font-sm); font-weight: 600; letter-spacing: 0.03em;
  cursor: pointer; border: none; transition: all var(--tr-base);
  position: relative; overflow: hidden; white-space: nowrap; text-decoration: none; line-height: 1.4;
}
.btn::after { content: ''; position: absolute; inset: 0; background: white; opacity: 0; transition: opacity var(--tr-fast); }
.btn:hover::after { opacity: 0.08; }
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--gradient-violet); color: white; box-shadow: var(--shadow-violet); }
.btn-primary:hover { box-shadow: 0 0 40px rgba(155,126,222,0.4); transform: translateY(-1px); color: white; }

.btn-gold { background: var(--gradient-gold); color: var(--text-inverse); box-shadow: var(--shadow-gold); }
.btn-gold:hover { box-shadow: 0 0 40px rgba(212,175,122,0.4); transform: translateY(-1px); color: var(--text-inverse); }

.btn-outline { background: transparent; color: var(--accent-violet); border: 1.5px solid var(--accent-violet); }
.btn-outline:hover { background: rgba(155,126,222,0.1); }

.btn-outline-gold { background: transparent; color: var(--accent-gold); border: 1.5px solid var(--accent-gold); }
.btn-outline-gold:hover { background: rgba(212,175,122,0.1); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-card); }

.btn-sm { padding: 0.5rem 1.25rem; font-size: var(--font-xs); }
.btn-lg { padding: 1rem 2.25rem; font-size: var(--font-base); }
.btn-xl { padding: 1.1rem 2.5rem; font-size: var(--font-md); }
.btn-block { width: 100%; }
.btn-icon { padding: 0.6rem; border-radius: var(--border-radius-md); aspect-ratio: 1; }
.btn[disabled], .btn.loading { opacity: 0.55; pointer-events: none; }

/* ── CARDS ──────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-lg); overflow: hidden; transition: all var(--tr-base); }
.card:hover { border-color: var(--border-color-hover); box-shadow: var(--shadow-violet); transform: translateY(-2px); }
.card-body { padding: var(--sp-6); }
.card-header { padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border-color); }
.card-footer { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border-color); background: rgba(0,0,0,0.08); }
.card-cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; transition: transform var(--tr-slow); }
.card:hover .card-cover { transform: scale(1.04); }
.card-course { display: flex; flex-direction: column; height: 100%; cursor: pointer; text-decoration: none; color: inherit; }

/* ── FORMULARIOS ────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.form-label { font-size: var(--font-sm); font-weight: 500; color: var(--text-secondary); }
.form-label.required::after { content: ' *'; color: var(--color-error); }

.form-input, .form-select, .form-textarea {
  width: 100%; padding: 0.75rem 1rem;
  background: var(--bg-secondary); border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-md); color: var(--text-primary);
  font-size: var(--font-base); transition: all var(--tr-fast); appearance: none; -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--accent-violet); background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(155,126,222,0.15);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input.error, .form-select.error, .form-textarea.error { border-color: var(--color-error); }
.form-error { font-size: var(--font-xs); color: var(--color-error); display: none; }
.form-error.visible { display: block; }
.form-hint { font-size: var(--font-xs); color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.form-checkbox { display: flex; align-items: flex-start; gap: var(--sp-3); cursor: pointer; }
.form-checkbox input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-violet); flex-shrink: 0; margin-top: 2px; cursor: pointer; }

/* ── NAVBAR ─────────────────────────────────── */
.navbar { position: fixed; top: 0; left: 0; right: 0; height: var(--header-height); z-index: var(--z-sticky); transition: all var(--tr-slow); }
.navbar-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); }
.navbar.scrolled { background: var(--bg-overlay); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--border-color); }
.navbar-logo { display: flex; align-items: center; gap: var(--sp-3); text-decoration: none; flex-shrink: 0; }
.navbar-logo-icon { width: 36px; height: 36px; flex-shrink: 0; }
.navbar-logo-text { font-family: var(--font-serif); font-size: var(--font-lg); font-weight: 600; color: var(--text-primary); line-height: 1; }
.navbar-logo-text span { color: var(--accent-gold); }
.navbar-nav { display: flex; align-items: center; gap: var(--sp-1); list-style: none; }
.navbar-link { font-size: var(--font-sm); font-weight: 500; color: var(--text-secondary); padding: var(--sp-2) var(--sp-4); border-radius: var(--border-radius-md); transition: all var(--tr-fast); display: block; text-decoration: none; }
.navbar-link:hover, .navbar-link.active { color: var(--text-primary); background: rgba(155,126,222,0.1); }
.navbar-actions { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
.theme-toggle { width: 38px; height: 38px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-muted); transition: all var(--tr-fast); cursor: pointer; }
.theme-toggle:hover { color: var(--accent-gold); border-color: var(--accent-gold); }
.user-avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; background: var(--gradient-violet); display: flex; align-items: center; justify-content: center; font-size: var(--font-sm); font-weight: 700; color: white; cursor: pointer; border: 2px solid transparent; transition: all var(--tr-fast); }
.user-avatar-placeholder:hover { border-color: var(--accent-gold); }
.navbar-mobile-toggle { display: none; width: 38px; height: 38px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; background: none; border: none; }
.navbar-mobile-toggle span { display: block; width: 22px; height: 2px; background: var(--text-primary); transition: all var(--tr-base); border-radius: 2px; }
.navbar-mobile-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.navbar-mobile-toggle.open span:nth-child(2) { opacity: 0; }
.navbar-mobile-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

@media (max-width: 768px) {
  .navbar-nav { display: none; }
  .navbar-mobile-toggle { display: flex; }
  .navbar-nav.open { display: flex; flex-direction: column; position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0; background: var(--bg-primary); padding: var(--sp-8) var(--sp-6); gap: var(--sp-2); overflow-y: auto; z-index: var(--z-sticky); }
  .navbar-link { font-size: var(--font-md); padding: var(--sp-4); }
}

/* ── HERO ───────────────────────────────────── */
.hero { min-height: 100vh; display: flex; align-items: center; position: relative; overflow: hidden; padding-top: var(--header-height); }
.hero-bg { position: absolute; inset: 0; background: var(--gradient-hero); z-index: 0; }
.hero-content { position: relative; z-index: 2; width: 100%; }

/* ── MODAL ──────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14,11,26,0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: var(--z-overlay); display: flex; align-items: center; justify-content: center; padding: var(--sp-4); opacity: 0; visibility: hidden; transition: all var(--tr-slow); }
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-xl); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); transform: scale(0.92) translateY(20px); transition: transform var(--tr-xslow); }
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-6); border-bottom: 1px solid var(--border-color); }
.modal-title { font-family: var(--font-serif); font-size: var(--font-xl); font-weight: 600; }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--border-radius-sm); color: var(--text-muted); transition: all var(--tr-fast); background: none; border: none; cursor: pointer; font-size: 1.2rem; }
.modal-close:hover { color: var(--text-primary); background: var(--bg-secondary); }
.modal-body { padding: var(--sp-6); }
.modal-footer { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border-color); display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* ── TOASTS ─────────────────────────────────── */
#toast-container { position: fixed; top: var(--sp-5); right: var(--sp-5); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--sp-3); pointer-events: none; max-width: 360px; width: calc(100% - var(--sp-10)); }
.toast { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-md); box-shadow: var(--shadow-lg); pointer-events: all; transform: translateX(120%); transition: transform var(--tr-xslow); position: relative; overflow: hidden; }
.toast.show { transform: translateX(0); }
.toast.hide { transform: translateX(120%); }
.toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.toast-success::before { background: var(--color-success); }
.toast-error::before { background: var(--color-error); }
.toast-warning::before { background: var(--color-warning); }
.toast-info::before { background: var(--color-info); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-error); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--color-info); }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: var(--font-sm); margin-bottom: 2px; }
.toast-message { font-size: var(--font-xs); color: var(--text-secondary); }
.toast-close { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: var(--border-radius-sm); color: var(--text-muted); flex-shrink: 0; cursor: pointer; font-size: 0.8rem; transition: all var(--tr-fast); background: none; border: none; }
.toast-close:hover { color: var(--text-primary); background: var(--bg-secondary); }

/* ── SKELETON ───────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--border-radius-md); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-text { height: 1em; margin-bottom: 0.5em; }
.skeleton-img { aspect-ratio: 16/9; width: 100%; }
.skeleton-circle { border-radius: 50%; aspect-ratio: 1; }

/* ── PROGRESS BAR ───────────────────────────── */
.progress-bar { width: 100%; height: 6px; background: var(--bg-secondary); border-radius: var(--border-radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient-violet); border-radius: var(--border-radius-full); transition: width var(--tr-slow); }

/* ── TAGS ───────────────────────────────────── */
.tag { display: inline-flex; align-items: center; gap: var(--sp-1); padding: var(--sp-1) var(--sp-3); border-radius: var(--border-radius-full); font-size: var(--font-xs); font-weight: 500; background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border-color); transition: all var(--tr-fast); cursor: pointer; }
.tag:hover, .tag.active { background: rgba(155,126,222,0.15); color: var(--accent-violet); border-color: rgba(155,126,222,0.4); }

/* ── FOOTER ─────────────────────────────────── */
.footer { background: var(--bg-secondary); border-top: 1px solid var(--border-color); padding-block: var(--sp-16); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--sp-10); margin-bottom: var(--sp-12); }
.footer-brand p { font-size: var(--font-sm); color: var(--text-muted); margin-top: var(--sp-4); max-width: 40ch; }
.footer-col-title { font-size: var(--font-sm); font-weight: 700; color: var(--text-primary); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: var(--sp-5); }
.footer-links { display: flex; flex-direction: column; gap: var(--sp-3); }
.footer-links a { font-size: var(--font-sm); color: var(--text-muted); transition: color var(--tr-fast); text-decoration: none; }
.footer-links a:hover { color: var(--accent-violet); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: var(--sp-8); border-top: 1px solid var(--border-color); font-size: var(--font-xs); color: var(--text-muted); }
@media (max-width: 1024px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr; } .footer-bottom { flex-direction: column; gap: var(--sp-3); text-align: center; } }

/* ── AUTH PAGES ─────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--sp-8) var(--sp-4); background: var(--gradient-hero); position: relative; overflow: hidden; }
.auth-card { width: 100%; max-width: 440px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-xl); padding: var(--sp-10) var(--sp-8); position: relative; z-index: 1; box-shadow: var(--shadow-lg), var(--shadow-violet); }
.auth-title { font-family: var(--font-serif); font-size: var(--font-3xl); text-align: center; margin-bottom: var(--sp-2); }
.auth-subtitle { font-size: var(--font-sm); color: var(--text-muted); text-align: center; margin-bottom: var(--sp-8); }
.auth-divider { display: flex; align-items: center; gap: var(--sp-4); margin-block: var(--sp-6); color: var(--text-muted); font-size: var(--font-xs); }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
.btn-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: var(--sp-3); padding: 0.75rem 1.5rem; background: var(--bg-secondary); border: 1.5px solid var(--border-color); border-radius: var(--border-radius-md); color: var(--text-primary); font-size: var(--font-sm); font-weight: 500; cursor: pointer; transition: all var(--tr-fast); text-decoration: none; }
.btn-google:hover { border-color: #4285F4; color: var(--text-primary); background: rgba(66,133,244,0.08); }
.auth-footer { text-align: center; margin-top: var(--sp-6); font-size: var(--font-sm); color: var(--text-muted); }
.auth-footer a { color: var(--accent-violet); font-weight: 500; }

/* ── DROPDOWN ───────────────────────────────── */
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-lg); box-shadow: var(--shadow-lg); min-width: 200px; overflow: hidden; z-index: var(--z-dropdown); transform: translateY(-8px); opacity: 0; visibility: hidden; transition: all var(--tr-base); }
.user-dropdown.open { transform: translateY(0); opacity: 1; visibility: visible; }
.user-dropdown-header { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-color); background: var(--bg-secondary); }
.user-dropdown-name { font-weight: 600; font-size: var(--font-sm); }
.user-dropdown-email { font-size: var(--font-xs); color: var(--text-muted); }
.user-dropdown-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); font-size: var(--font-sm); color: var(--text-secondary); cursor: pointer; transition: all var(--tr-fast); text-decoration: none; }
.user-dropdown-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.user-dropdown-item.danger { color: var(--color-error); }
.user-dropdown-item.danger:hover { background: rgba(224,112,112,0.08); }
.user-menu-wrapper { position: relative; }

/* ── VIDEO PLAYER ───────────────────────────── */
.player-container { position: relative; background: #000; border-radius: var(--border-radius-lg); overflow: hidden; aspect-ratio: 16/9; width: 100%; }
.player-container video { width: 100%; height: 100%; object-fit: contain; }
.player-controls { position: absolute; bottom: 0; left: 0; right: 0; padding: var(--sp-4); background: linear-gradient(transparent, rgba(0,0,0,0.7)); display: flex; align-items: center; gap: var(--sp-3); opacity: 0; transition: opacity var(--tr-base); }
.player-container:hover .player-controls { opacity: 1; }
.player-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,0.15); color: white; transition: background var(--tr-fast); cursor: pointer; border: none; font-size: 1rem; }
.player-btn:hover { background: rgba(255,255,255,0.3); }
.player-progress { flex: 1; height: 4px; background: rgba(255,255,255,0.2); border-radius: var(--border-radius-full); cursor: pointer; position: relative; }
.player-progress-fill { height: 100%; background: var(--accent-violet); border-radius: var(--border-radius-full); pointer-events: none; }
.player-time { font-size: var(--font-xs); color: rgba(255,255,255,0.8); white-space: nowrap; min-width: 80px; text-align: right; }

/* ── LESSON CHECK ───────────────────────────── */
.lesson-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-color); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all var(--tr-base); cursor: pointer; }
.lesson-check.done { background: var(--color-success); border-color: var(--color-success); animation: checkBounce 0.4s cubic-bezier(0.68,-0.55,0.27,1.55); }
@keyframes checkBounce { 0% { transform: scale(0.7); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* ── CALENDARIO ─────────────────────────────── */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--sp-2); }
.calendar-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: var(--border-radius-md); font-size: var(--font-sm); cursor: pointer; transition: all var(--tr-fast); border: 1px solid transparent; position: relative; }
.calendar-day:hover { background: rgba(155,126,222,0.15); }
.calendar-day.today { border-color: var(--accent-violet); color: var(--accent-violet); font-weight: 600; }
.calendar-day.selected { background: var(--accent-violet); color: white; border-color: transparent; }
.calendar-day.disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.calendar-day.has-slots::after { content: ''; width: 4px; height: 4px; background: var(--accent-gold); border-radius: 50%; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); }
.time-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: var(--sp-2); margin-top: var(--sp-4); }
.time-slot { padding: var(--sp-2) var(--sp-3); border: 1.5px solid var(--border-color); border-radius: var(--border-radius-md); font-size: var(--font-sm); text-align: center; cursor: pointer; transition: all var(--tr-fast); background: var(--bg-card); color: var(--text-primary); }
.time-slot:hover { border-color: var(--accent-violet); color: var(--accent-violet); }
.time-slot.selected { background: var(--accent-violet); color: white; border-color: var(--accent-violet); }
.time-slot.taken { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; pointer-events: none; }

/* ── UPLOAD ─────────────────────────────────── */
.upload-area { border: 2px dashed var(--border-color); border-radius: var(--border-radius-lg); padding: var(--sp-10); text-align: center; cursor: pointer; transition: all var(--tr-base); }
.upload-area:hover, .upload-area.dragover { border-color: var(--accent-violet); background: rgba(155,126,222,0.05); }
.upload-progress { width: 100%; height: 4px; background: var(--bg-secondary); border-radius: var(--border-radius-full); overflow: hidden; margin-top: var(--sp-4); display: none; }
.upload-progress.visible { display: block; }
.upload-progress-fill { height: 100%; background: var(--gradient-violet); border-radius: var(--border-radius-full); transition: width 0.3s ease; }

/* ── SPINNER ────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.25); border-top-color: white; border-radius: 50%; animation: spin 0.65s linear infinite; display: inline-block; vertical-align: middle; }

/* ── CURSOR ─────────────────────────────────── */
#cursor-dot { position: fixed; width: 8px; height: 8px; background: var(--accent-violet); border-radius: 50%; pointer-events: none; z-index: var(--z-cursor); transform: translate(-50%, -50%); transition: transform 0.1s ease, opacity 0.3s ease; }
#cursor-halo { position: fixed; width: 36px; height: 36px; border: 1.5px solid var(--accent-violet); border-radius: 50%; pointer-events: none; z-index: var(--z-cursor); transform: translate(-50%, -50%); transition: transform 0.25s ease, width 0.3s ease, height 0.3s ease, opacity 0.3s ease; opacity: 0.5; }
body.cursor-hover #cursor-dot { transform: translate(-50%, -50%) scale(2); }
body.cursor-hover #cursor-halo { width: 52px; height: 52px; opacity: 0.8; }
@media (hover: none) { #cursor-dot, #cursor-halo { display: none; } }
