/* ==========================================================================
   COMPONENTS CSS: UI Reusable Elements & Sheet Activity Components
   ========================================================================== */

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: #CBD5E1;
}

.btn-accent {
  background: var(--accent-amber);
  color: #78350F;
}

.btn-accent:hover {
  background: #D97706;
  color: white;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.btn-icon:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* Tarjetas */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--secondary-light); color: var(--secondary); }
.badge-amber { background: var(--accent-amber-light); color: #B45309; }
.badge-emerald { background: var(--accent-emerald-light); color: #047857; }
.badge-pink { background: var(--accent-pink-light); color: #BE185D; }

/* Controles de Formulario */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.form-input, .form-select {
  padding: 9px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Buscador y Barra de Filtros */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-icon-inside {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input-wrapper input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  outline: none;
}

.search-input-wrapper input:focus {
  border-color: var(--border-focus);
}

/* Grillas del Dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   COMPONENTES EDUCATIVOS DE FICHA (PARA RENDERIZADO US LETTER)
   ========================================================================== */

/* 1. Letra Gigante con Trazo Didáctico */
.sheet-letter-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 12px;
  background: #F8FAFC;
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
}

.big-letter-display {
  font-size: 5.5rem;
  font-family: var(--font-kids);
  font-weight: 900;
  line-height: 1;
  color: #1E293B;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.big-letter-display .lowercase {
  font-size: 4rem;
  color: var(--primary);
}

/* 2. Pauta Escolar de Caligrafía (Triple Línea) */
.handwriting-row {
  width: 100%;
  height: 60px;
  position: relative;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 18px,
    #CBD5E1 19px,
    transparent 20px,
    transparent 38px,
    #93C5FD 39px,
    transparent 40px,
    transparent 58px,
    #CBD5E1 59px,
    transparent 60px
  );
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 24px;
}

.dotted-char {
  font-family: var(--font-kids);
  font-size: 2.4rem;
  font-weight: 700;
  color: #94A3B8;
  letter-spacing: 0.1em;
  stroke-dasharray: 2, 2;
  user-select: none;
}

/* 3. Cuadrícula de Ilustraciones para Colorear / Identificar */
.sheet-exercise-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: 100%;
}

.sheet-item-card {
  border: 2px solid #E2E8F0;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #FFFFFF;
  position: relative;
}

.sheet-item-img {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.sheet-item-img svg, .sheet-item-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sheet-item-name {
  font-family: var(--font-kids);
  font-size: 1.1rem;
  font-weight: 700;
  color: #1E293B;
}

.sheet-checkbox-circle {
  width: 24px;
  height: 24px;
  border: 2px solid #64748B;
  border-radius: 50%;
  margin-top: 6px;
}

/* 4. Recuadros de descomposición silábica */
.syllable-boxes {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.syllable-box {
  width: 38px;
  height: 38px;
  border: 2px solid #334155;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-kids);
  font-size: 1.15rem;
  font-weight: 700;
  background: #FFFFFF;
}

/* Modal de Vista Previa */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 950px;
  width: 100%;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

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

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-muted);
}
