/* assets/css/styles.css - Sistema de diseño moderno para Control de Alumnos y Clases */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #0f172a;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #0ea5e9;
  
  --paid-bg: rgba(16, 185, 129, 0.15);
  --paid-border: #10b981;
  --paid-text: #34d399;

  --pending-bg: rgba(245, 158, 11, 0.15);
  --pending-border: #f59e0b;
  --pending-text: #fbbf24;

  --capacity-ok: #38bdf8;
  --capacity-full: #f43f5e;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Nav */
header.app-header {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(90deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Main Container */
main.container {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Controls Bar */
.calendar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 1.25rem 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-main);
  flex-wrap: wrap;
  gap: 1rem;
}

.week-navigator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.current-week-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 220px;
  text-align: center;
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: white;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background: #475569;
  border-color: #64748b;
}

.danger-btn {
  color: #f43f5e !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
}

.danger-btn:hover {
  background: rgba(244, 63, 94, 0.15) !important;
  border-color: #f43f5e !important;
}

/* Calendar Grid */
.calendar-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-main);
}

.calendar-grid {
  display: grid;
  grid-template-columns: 75px repeat(5, minmax(170px, 1fr));
  border-collapse: collapse;
  min-width: 950px;
}

.calendar-header-cell {
  background: #151e2e;
  padding: 0.85rem 0.5rem;
  text-align: center;
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.calendar-header-cell .day-name {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.calendar-header-cell .day-number {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.2rem;
}

.calendar-header-cell.today .day-number {
  color: var(--accent-secondary);
}

.time-column-cell {
  background: #151e2e;
  padding: 0.75rem 0.5rem;
  text-align: center;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 5;
}

.calendar-slot-cell {
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  min-height: 85px;
  padding: 0.4rem;
  background: rgba(15, 23, 42, 0.4);
  position: relative;
  transition: background 0.15s ease;
}

.calendar-slot-cell:hover {
  background: rgba(99, 102, 241, 0.08);
}

/* Class Card */
.class-card {
  background: #1e293b;
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  margin-bottom: 0.4rem;
  border-left: 4px solid var(--accent-primary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
  position: relative;
}

.class-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

.class-card.duracion-120 {
  border-left-color: #a855f7;
  background: linear-gradient(180deg, #1e293b 0%, #2e1065 100%);
}

.class-card.duracion-120.is-first-hour {
  border-bottom: 2px dashed rgba(168, 85, 247, 0.4);
}

.class-card.duracion-120.is-second-hour {
  background: linear-gradient(180deg, #2e1065 0%, #1e293b 100%);
  border-left-style: dashed;
  border-top: 2px dashed rgba(168, 85, 247, 0.4);
  opacity: 0.95;
}

.continuation-tag {
  font-size: 0.68rem;
  color: #c084fc;
  font-weight: 600;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.calendar-slot-cell.slot-full {
  background: rgba(244, 63, 94, 0.05);
}

.class-card.estado-pagado {
  border-left-color: var(--paid-border);
}

.class-card.estado-pendiente {
  border-left-color: var(--pending-border);
}

.class-student-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.class-time-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.3rem 0;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-paid {
  background: var(--paid-bg);
  color: var(--paid-text);
  border: 1px solid var(--paid-border);
  cursor: pointer;
}

.badge-pending {
  background: var(--pending-bg);
  color: var(--pending-text);
  border: 1px solid var(--pending-border);
  cursor: pointer;
}

.badge-duration {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.badge-level {
  background: rgba(14, 165, 233, 0.18);
  color: #38bdf8;
  border: 1px solid #0ea5e9;
}

.class-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.4rem;
  justify-content: flex-end;
}

.icon-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.15);
}

.icon-btn.danger:hover {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.15);
  border-color: #f43f5e;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

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

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-main);
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Alumnos List View */
.alumnos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.alumno-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-main);
}

.alumno-card:hover {
  border-color: #475569;
  transform: translateY(-2px);
}

.alumno-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.alumno-nombre {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.alumno-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.alumno-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.share-link-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem;
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--accent-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  gap: 0.5rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  max-width: 90vw;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-primary);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  margin-top: 0.5rem;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
}

.toast.error {
  border-left-color: var(--capacity-full);
}

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

/* Adaptación Responsiva para Celulares / Móviles */
@media (max-width: 768px) {
  header.app-header {
    padding: 0.85rem 1rem;
    justify-content: center;
    flex-direction: column;
    text-align: center;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .nav-btn {
    flex: 1;
    justify-content: center;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }

  main.container {
    padding: 1rem 0.75rem;
  }

  .calendar-controls {
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .week-navigator {
    justify-content: space-between;
    width: 100%;
  }

  .current-week-label {
    min-width: unset;
    font-size: 0.95rem;
    order: 3;
    width: 100%;
    text-align: center;
    margin-top: 0.3rem;
  }

  .action-buttons {
    width: 100%;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .alumnos-grid {
    grid-template-columns: 1fr;
  }

  .alumno-actions {
    flex-direction: column;
  }

  .alumno-actions button,
  .alumno-actions a {
    width: 100%;
    justify-content: center;
  }
}

/* Checkboxes de Configuración de Horarios */
.horarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.6rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.horario-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
  user-select: none;
}

.horario-checkbox-label:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.horario-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Time Slot Pills for Parent Portal Agendar */
.time-slots-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
  margin-top: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.time-slot-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.time-slot-pill:hover:not(.disabled) {
  border-color: var(--accent-secondary);
  background: rgba(14, 165, 233, 0.15);
}

.time-slot-pill.selected {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.time-slot-pill.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(15, 23, 42, 0.6);
  border-style: dashed;
  text-decoration: line-through;
}

.btn-whatsapp-parent {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white;
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
  transition: all 0.25s ease;
  justify-content: center;
}

.btn-whatsapp-parent:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(37, 211, 102, 0.5);
  color: white;
}
