/* ============================================
   TAKU LEARNING PLATFORM - MAIN CSS
   Variables, Reset, Layout Global
   ============================================ */

/* CSS Variables */
:root {
  --primary:          #6C63FF;
  --primary-dark:     #5A52D5;
  --primary-light:    #8B85FF;
  --secondary:        #FF6584;
  --accent:           #43E97B;
  --warning:          #F7B731;
  --danger:           #FC5C65;
  --info:             #3498DB;
  
  --dark-bg:          #0D1117;
  --dark-surface:     #161B22;
  --dark-card:        #1C2333;
  --dark-card-hover:  #252D3D;
  --dark-border:      rgba(108, 99, 255, 0.25);
  --dark-border-solid: #30363D;
  
  --text-primary:     #E6EDF3;
  --text-secondary:   #8B949E;
  --text-muted:       #484F58;
  --text-inverse:     #0D1117;
  
  --radius-sm:        6px;
  --radius-md:        12px;
  --radius-lg:        20px;
  --radius-xl:        28px;
  
  --shadow-sm:        0 2px 8px rgba(0,0,0,0.2);
  --shadow-card:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:        0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow:      0 0 20px rgba(108, 99, 255, 0.3);
  
  --transition:       all 0.2s ease;
  --transition-slow:  all 0.3s ease;
  
  --sidebar-width:    280px;
  --sidebar-collapsed: 72px;
  --header-height:    64px;
  --footer-height:    48px;
  
  --font-body:        'Inter', sans-serif;
  --font-heading:     'Poppins', sans-serif;
  --font-mono:        'Fira Code', monospace;
  
  --z-header:         100;
  --z-sidebar:        90;
  --z-modal:          200;
  --z-lightbox:       300;
  --z-toast:          400;
}

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

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

body {
  font-family: var(--font-body);
  background-color: var(--dark-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-light);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

code {
  background: var(--dark-surface);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

pre {
  background: var(--dark-surface);
  padding: 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1rem 0;
}

pre code {
  background: transparent;
  padding: 0;
}

/* App Layout */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#layout {
  display: flex;
  flex: 1;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

#app-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-right: 0;
  padding: 2rem;
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  transition: margin-right 0.3s ease;
}

/* Cuando el admin sidebar está visible */
body.admin-mode #app-content {
  margin-right: 260px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--dark-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Selection */
::selection {
  background: var(--primary);
  color: white;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--dark-surface);
  color: var(--text-primary);
  border: 1px solid var(--dark-border-solid);
}

.btn-secondary:hover {
  background: var(--dark-card);
  border-color: var(--primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent) 0%, #2ECC71 100%);
  color: var(--text-inverse);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(67, 233, 123, 0.3);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: var(--text-inverse);
}

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

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--dark-surface);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-beginner {
  background: rgba(67, 233, 123, 0.15);
  color: var(--accent);
}

.badge-intermediate {
  background: rgba(247, 183, 49, 0.15);
  color: var(--warning);
}

.badge-advanced {
  background: rgba(252, 92, 101, 0.15);
  color: var(--danger);
}

.badge-category {
  background: var(--dark-surface);
  color: var(--text-secondary);
}

/* Callouts */
.callout {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.callout-info {
  background: rgba(52, 152, 219, 0.1);
  border-color: var(--info);
}

.callout-info::before {
  content: '\f05a';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-right: 0.5rem;
  color: var(--info);
}

.callout-tip {
  background: rgba(67, 233, 123, 0.1);
  border-color: var(--accent);
}

.callout-tip::before {
  content: '\f0eb';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-right: 0.5rem;
  color: var(--accent);
}

.callout-warning {
  background: rgba(247, 183, 49, 0.1);
  border-color: var(--warning);
}

.callout-warning::before {
  content: '\f071';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-right: 0.5rem;
  color: var(--warning);
}

.callout-danger {
  background: rgba(252, 92, 101, 0.1);
  border-color: var(--danger);
}

.callout-danger::before {
  content: '\f06a';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-right: 0.5rem;
  color: var(--danger);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  background: var(--dark-surface);
  border: 1px solid var(--dark-border-solid);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

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

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238B949E' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--dark-surface);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: calc(var(--header-height) + 1rem);
  right: 1rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.875rem 1.25rem;
  background: var(--dark-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-left: 4px solid var(--accent);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

.toast.info {
  border-left: 4px solid var(--info);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox.hidden {
  display: none;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
}

.lightbox-caption {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 1rem;
  font-size: 0.875rem;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* Modal */
#modal-container {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
}

#modal-container.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
}

.modal {
  position: relative;
  z-index: 1;
  background: var(--dark-card);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--dark-border-solid);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--dark-border-solid);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin: 1.5rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--dark-border-solid);
}

th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--dark-surface);
}

td {
  color: var(--text-secondary);
}

tr:hover td {
  background: var(--dark-surface);
}

/* Checklist */
.checklist {
  list-style: none;
  margin: 1rem 0;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  color: var(--text-secondary);
}

.checklist li::before {
  content: '\f0c8';
  font-family: 'Font Awesome 6 Free';
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.checklist li.checked::before {
  content: '\f14a';
  font-weight: 900;
  color: var(--accent);
}

/* Document Generator */
.doc-generator {
  background: var(--dark-surface);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.doc-generator-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--dark-border);
}

.doc-generator-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.125rem;
}

.doc-generator-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.doc-preview {
  background: var(--dark-bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
  max-height: 250px;
  overflow-y: auto;
}

.doc-preview table {
  width: 100%;
  font-size: 0.875rem;
}

.doc-preview th,
.doc-preview td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--dark-border-surface);
}

.doc-preview th {
  font-weight: 600;
  color: var(--text-primary);
}

.doc-preview td {
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1024px) {
  #sidebar-container {
    transform: translateX(-100%);
  }
  
  #sidebar-container.open {
    transform: translateX(0);
  }
  
  #app-content {
    margin-left: 0;
  }
}

@media (max-width: 1200px) {
  body.admin-mode #app-content {
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  #app-content {
    padding: 1rem;
  }
  
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ============================================
   GUEST BANNER - Invitación a registro
   ============================================ */

.guest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.15) 0%, rgba(255, 101, 132, 0.1) 100%);
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

.guest-banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.guest-banner-content > i {
  font-size: 2rem;
  color: var(--primary);
}

.guest-banner-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.guest-banner-text strong {
  color: var(--text-primary);
  font-size: 1rem;
}

.guest-banner-text span {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .guest-banner {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .guest-banner-content {
    flex-direction: column;
  }
}

/* ============================================
   HOME PAGE STYLES
   ============================================ */

.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Hero Header */
.hero-header {
  position: relative;
  background: linear-gradient(135deg, var(--dark-card) 0%, var(--dark-surface) 100%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-header-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.hero-header-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(13,17,23,0.8) 0%, rgba(13,17,23,0.5) 50%, rgba(13,17,23,0.3) 100%);
  z-index: 1;
  transition: opacity 0.3s;
}

.hero-header-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Cuando hay imagen personalizada, hacer overlay más sutil */
.hero-header.has-image .hero-header-overlay {
  background: linear-gradient(to right, rgba(13,17,23,0.6) 0%, rgba(13,17,23,0.3) 50%, rgba(13,17,23,0.1) 100%);
}

.hero-header-content {
  position: relative;
  z-index: 2;
  padding: 3rem 2rem;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Filters bar centered */
.filters-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.filters-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

/* Tutorial section */
.tutorial-section {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Edit home header button */
.btn-edit-home {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 100;
  padding: 10px 18px;
  background: rgba(108, 99, 255, 0.9);
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.btn-edit-home:hover {
  background: rgba(0,0,0,0.9);
}
