:root {
  /* ── PALETA FILAH 37 ── */
  --azul: #284d98;
  --azul-dark: #1c3a73;
  --azul-light: #eaf0fc;
  --rojo: #d23930;
  --rojo-dark: #a82a23;
  --rojo-light: #fdf0ef;
  --verde: #dfd97c;
  --verde-dark: #c9c466;
  --verde-light: #f3f0ce;
  --cafe: #5c3e35;
  --cafe-dark: #4a3128;
  --cafe-light: #f5efed;
  --crema: #faf5ec;

  /* Aliases */
  --primary: var(--rojo);
  --primary-dark: var(--rojo-dark);
  --secondary: var(--azul);
  --accent: var(--verde);
  --text-main: var(--cafe);
  --text-muted: #8a7a72;
  --white: #fff;
}

body {
  margin: 0;
  font-family: "Noto Sans", sans-serif;
  color: var(--text-main);
}

.page-layout {
  display: flex;
}

.filah-program-container {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* ════════════ ANIMACIONES DE ENTRADA ════════════ */
@keyframes fadeUpCat {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .toolbar {
    animation: fadeUpCat 0.6s ease-out both;
  }
  .events-container {
    animation: fadeUpCat 0.7s ease-out 0.1s both;
  }
  .event-card {
    animation: fadeUpCat 0.5s ease-out 0.2s both;
  }
  .pagination-controls {
    animation: fadeUpCat 0.5s ease-out 0.4s both;
  }
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-box i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 13px 15px 13px 45px;
  border: 1px solid #ddd4cf;
  border-radius: 12px;
  outline: none;
  font-size: 0.95rem;
  font-family: "Noto Sans", sans-serif;
  box-sizing: border-box;
  background: #fff;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.search-box input:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(40, 77, 152, 0.12);
}

.toolbar-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-action {
  padding: 11px 20px;
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.3s;
  font-family: "Noto Sans", sans-serif;
  font-size: 0.85rem;
}

.btn-custom {
  background: var(--rojo);
}

.btn-custom:hover {
  background: var(--rojo-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(210, 57, 48, 0.3);
}

.btn-custom:disabled {
  background: #ddd4cf;
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-pdf-all {
  background: var(--azul);
}

.btn-pdf-all:hover {
  background: var(--azul-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 77, 152, 0.25);
}

/* ── Cards grid ── */
.events-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

.event-card {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(92, 62, 53, 0.06);
  border: 1px solid #ebe5e1;
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
  position: relative;
}

.event-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(92, 62, 53, 0.14);
}

.event-card.selected {
  border-color: var(--verde-dark);
  box-shadow: 0 0 0 3px rgba(223, 217, 124, 0.6);
}

.card-date-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--cafe-light);
  border-bottom: 1px solid #ebe5e1;
}

.date-box {
  background: var(--cafe);
  color: #fff;
  border-radius: 10px;
  width: 48px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(92, 62, 53, 0.25);
}

.date-box .day-num {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
}

.date-box .month {
  font-size: 0.6rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.date-info {
  flex: 1;
}

.date-info .day-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.date-info .time-range {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cafe);
}

.card-image {
  width: 100%;
  height: 280px;
  background: var(--crema);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
  box-sizing: border-box;
}

.card-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.card-body {
  padding: 16px 18px;
  flex-grow: 1;
}

.card-category {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--cafe);
  background: var(--verde-light);
  padding: 3px 9px;
  border-radius: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.card-title {
  font-size: 1.05rem;
  color: var(--cafe);
  font-weight: 700;
  margin: 0;
  line-height: 1.35;
}

.card-sede {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.card-footer {
  padding: 12px 18px;
  background: #fbf8f1;
  border-top: 1px solid #f3eee9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-more {
  background: transparent;
  border: 2px solid var(--azul);
  color: var(--azul);
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.3s;
  font-size: 0.85rem;
}

.btn-more:hover {
  background: var(--azul);
  color: #fff;
  transform: translateY(-1px);
}

.custom-checkbox {
  position: relative;
  cursor: pointer;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 30px;
  width: 30px;
  background: #fff;
  border-radius: 50%;
  border: 2px solid #ddd4cf;
  transition: 0.2s;
}

.custom-checkbox input:checked ~ .checkmark {
  background: var(--verde);
  border-color: var(--verde-dark);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 10px;
  top: 5px;
  width: 7px;
  height: 12px;
  border: solid var(--cafe);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
}

/* ── Floating bar ── */
.floating-selection-bar {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(210, 57, 48, 0.96);
  backdrop-filter: blur(10px);
  color: var(--white);
  padding: 14px 28px;
  border-radius: 50px;
  transition: 0.4s;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 8px 30px rgba(210, 57, 48, 0.35);
}

.floating-selection-bar.visible {
  bottom: 30px;
}

.floating-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.85rem;
}

.btn-floating-action {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: "Noto Sans", sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
}

.btn-floating-action:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ── PAGINATION ── */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.pagination-controls button {
  padding: 9px 18px;
  border: 1.5px solid #ddd4cf;
  border-radius: 10px;
  background: var(--white);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: "Noto Sans", sans-serif;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-controls button:hover:not(:disabled) {
  border-color: var(--azul);
  color: var(--azul);
  background: var(--azul-light);
}

.pagination-controls button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 9px 14px;
  background: var(--white);
  border: 1.5px solid #ebe5e1;
  border-radius: 10px;
}

/* ── MODAL ── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(92, 62, 53, 0.65);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content {
  background: var(--white);
  border-radius: 22px;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(92, 62, 53, 0.3);
  position: relative;
  animation: modalIn 0.25s ease-out;
}

.modal-left {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(155deg, var(--crema) 0%, var(--cafe-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  border-right: 1px solid #ebe5e1;
}

.modal-left img {
  max-width: 100%;
  max-height: 310px;
  object-fit: contain;
  box-shadow: 0 8px 28px rgba(92, 62, 53, 0.2);
}

.modal-right {
  flex: 1;
  overflow-y: auto;
  padding: 30px 32px;
  min-width: 0;
  scroll-behavior: smooth;
}

.modal-right::-webkit-scrollbar {
  width: 5px;
}
.modal-right::-webkit-scrollbar-track {
  background: var(--cafe-light);
}
.modal-right::-webkit-scrollbar-thumb {
  background: var(--cafe);
  border-radius: 4px;
  opacity: 0.5;
}

#modalTitle {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--cafe);
  line-height: 1.35;
  margin: 0 0 8px;
  padding-right: 42px;
}

.modal-tipo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--verde-light);
  color: var(--cafe);
  padding: 4px 13px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 22px;
  border: 1px solid var(--verde);
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 11px;
}

.info-row > .fas {
  width: 18px;
  text-align: center;
  color: var(--azul);
  font-size: 0.88rem;
  margin-top: 3px;
  flex-shrink: 0;
}

.info-row > div {
  flex: 1;
  min-width: 0;
}

.info-label {
  display: block;
  font-size: 0.67rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.info-value {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.5;
}

.desc-box {
  margin-top: 6px;
  background: var(--crema);
  border-left: 4px solid var(--rojo);
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  font-size: 0.875rem;
  line-height: 1.75;
  color: var(--cafe);
  word-break: break-word;
}

.desc-box p {
  margin: 0 0 8px;
}
.desc-box p:last-child {
  margin-bottom: 0;
}

.separator {
  border: none;
  border-top: 1px solid #ebe5e1;
  margin: 18px 0;
}

.close-modal {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 18px;
  cursor: pointer;
  z-index: 100;
  background: var(--white);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(92, 62, 53, 0.12);
  border: 1px solid #ebe5e1;
  color: var(--cafe);
  transition: 0.25s;
}

.close-modal:hover {
  background: var(--rojo);
  color: #fff;
  transform: scale(1.1) rotate(90deg);
  border-color: var(--rojo);
}

#no-results {
  display: none;
  text-align: center;
  padding: 80px;
  grid-column: 1/-1;
  color: var(--text-muted);
}

@keyframes slideUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ── PDF hidden container ── */
#pdfContent {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 800px;
  font-family: "Noto Sans", sans-serif;
}

.pdf-header {
  background: #284d98;
  color: #fff;
  padding: 25px 30px;
  margin-bottom: 20px;
  border-radius: 8px;
}

.pdf-header h1 {
  margin: 0;
  font-size: 1.3rem;
}
.pdf-header p {
  margin: 5px 0 0;
  font-size: 0.8rem;
  opacity: 0.8;
}

.pdf-event {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 15px;
  page-break-inside: avoid;
}

.pdf-event h3 {
  color: #284d98;
  margin: 0 0 8px;
  font-size: 1rem;
}
.pdf-event .pdf-meta {
  font-size: 0.8rem;
  color: #5c3e35;
  margin-bottom: 4px;
}

/* ── RESPONSIVE ── */
@media (min-width: 601px) and (max-width: 900px) {
  .modal-content {
    flex-direction: column;
    max-height: 92vh;
  }
  .modal-left {
    width: 100%;
    height: 210px;
    border-right: none;
    border-bottom: 1px solid #ebe5e1;
    padding: 18px;
    border-radius: 0;
  }
  .modal-left img {
    max-height: 175px;
    max-width: 160px;
  }
  .modal-right {
    overflow-y: auto;
  }
}

@media (max-width: 600px) {
  .filah-program-container {
    padding: 0px;
  }
  .events-container {
    grid-template-columns: 1fr;
  }
  .toolbar {
    flex-direction: column;
  }
  .search-box {
    min-width: 100%;
    width: 100%;
  }
  .toolbar-buttons {
    width: 100%;
    justify-content: stretch;
  }
  .toolbar-buttons .btn-action {
    flex: 1;
    justify-content: center;
    padding: 9px 10px;
    font-size: 0.78rem;
  }

  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal-content {
    flex-direction: column;
    border-radius: 22px 22px 0 0;
    max-height: 93vh;
    max-width: 100%;
    width: 100%;
    animation: sheetUp 0.28s ease-out;
  }

  @keyframes sheetUp {
    from {
      transform: translateY(60px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .modal-left {
    width: 100%;
    height: 175px;
    border-right: none;
    border-bottom: 1px solid #ebe5e1;
    padding: 14px;
    border-radius: 0;
    flex-direction: row;
    gap: 16px;
    justify-content: center;
  }
  .modal-left img {
    max-height: 145px;
    max-width: 110px;
  }
  .modal-right {
    padding: 18px 16px 24px;
    overflow-y: auto;
  }
  #modalTitle {
    font-size: 1rem;
    padding-right: 36px;
  }
  .modal-tipo {
    font-size: 0.68rem;
    margin-bottom: 14px;
  }
  .info-row {
    gap: 9px;
  }
  .info-value {
    font-size: 0.84rem;
  }
  .desc-box {
    font-size: 0.84rem;
    line-height: 1.7;
  }
  .close-modal {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .floating-selection-bar {
    min-width: auto;
    width: 92%;
    padding: 12px 18px;
  }
}

/* ── FIX: Botón Mi Selección compacto en móvil ── */
@media (max-width: 600px) {
  .toolbar-buttons .btn-action {
    padding: 8px 10px;
    font-size: 0.72rem;
    gap: 5px;
  }
  .toolbar-buttons .btn-action i {
    font-size: 0.7rem;
  }
  .btn-custom .btn-text-mobile {
    display: none;
  }
}

/* ── FIX: Modal más grande en desktop ── */
@media (min-width: 1100px) {
  .modal-content {
    max-width: 1300px;
  }
  .modal-left {
    width: 500px;
  }
  .modal-left img {
    max-height: 500px;
  }
  .modal-right {
    padding: 35px 40px;
  }
  #modalTitle {
    font-size: 1.35rem;
  }
}

/* ── FIX: Descripción en móvil ── */
@media (max-width: 600px) {
  .desc-box {
    padding: 12px 14px;
    font-size: 0.82rem;
    line-height: 1.65;
    border-left-width: 4px;
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .desc-box::-webkit-scrollbar {
    width: 3px;
  }
  .desc-box::-webkit-scrollbar-thumb {
    background: var(--cafe);
    border-radius: 2px;
  }

  .modal-right {
    padding: 16px 14px 22px;
  }
  .info-row {
    gap: 8px;
    margin-bottom: 9px;
  }
  .info-label {
    font-size: 0.62rem;
  }
  .info-value {
    font-size: 0.82rem;
  }
}

/* ── FIX: Barra flotante en móvil ── */
@media (max-width: 600px) {
  .floating-selection-bar {
    padding: 10px 14px;
    border-radius: 16px;
  }
  .floating-content {
    gap: 10px;
  }
  .floating-content > div:first-child span:not(.badge) {
    display: none;
  }
  .btn-floating-action {
    padding: 6px 12px;
    font-size: 0.75rem;
  }
}

/* ── Participante clickeable ── */
.participant-link {
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px dashed rgba(40, 77, 152, 0.4);
  transition: 0.2s;
}

.participant-link:hover {
  color: var(--azul);
  border-bottom-color: var(--azul);
  border-bottom-style: solid;
}

/* ── Modal participante ── */
.part-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(92, 62, 53, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.part-modal-overlay.active {
  display: flex;
}

.part-modal-box {
  background: #fff;
  border-radius: 18px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(92, 62, 53, 0.3);
  animation: modalIn 0.25s ease-out;
}

.part-modal-header {
  padding: 20px 24px 12px;
  border-bottom: 2px solid var(--verde-light);
}

.part-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--azul);
}

.part-modal-header p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.part-modal-list {
  padding: 16px 24px 24px;
}

.part-act-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid #f3eee9;
  transition:
    background 0.2s,
    padding 0.2s;
}

.part-act-item:last-child {
  border-bottom: none;
}

.part-act-item:hover {
  background: var(--crema);
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 8px;
}

.part-act-date {
  background: var(--cafe);
  color: #fff;
  border-radius: 8px;
  width: 40px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
}

.part-act-date .pday {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}
.part-act-date .pmon {
  font-size: 0.55rem;
  text-transform: uppercase;
  font-weight: 600;
}

.part-act-info h4 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--cafe);
  font-weight: 700;
}

.part-act-info p {
  margin: 3px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.part-role-tag {
  display: inline-block;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  margin-top: 4px;
  margin-right: 3px;
  border: 1px solid transparent;
}

.part-role-autor {
  background: var(--azul-light);
  color: var(--azul);
  border-color: var(--azul);
}
.part-role-editor {
  background: var(--verde-light);
  color: var(--cafe);
  border-color: var(--verde);
}
.part-role-coordinador {
  background: var(--rojo-light);
  color: var(--rojo);
  border-color: var(--rojo);
}
.part-role-moderador {
  background: var(--cafe-light);
  color: var(--cafe);
  border-color: var(--cafe);
}
.part-role-participante {
  background: #f1eee5;
  color: var(--text-muted);
  border-color: #ddd4cf;
}

.part-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cafe-light);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--cafe);
  transition: 0.25s;
}

.part-modal-close:hover {
  background: var(--rojo);
  color: #fff;
  transform: rotate(90deg);
}

@media (max-width: 600px) {
  .part-modal-box {
    max-height: 85vh;
    border-radius: 18px 18px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
  }
  .part-modal-overlay {
    align-items: flex-end;
  }
}
