/* =========================================================
   AQUAG · MATRÍCULA E TURMAS
   Cartão do aluno (matrícula), listas de alunos e a grade
   de turmas/horários com o seletor de aluno por pesquisa.
   ========================================================= */


/* ---------------------------------------------------------
   Cartão do aluno
   --------------------------------------------------------- */

.aquag-student-card {
  overflow: hidden;
}

.aquag-student-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas: "main main" "turma status";
  gap: .75rem;
  align-items: stretch;
}

.aquag-student-main {
  min-width: 0;
  grid-area: main;
}

.aquag-student-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .22);
  color: #fbbf24;
  font-size: .85rem;
  font-weight: 800;
}

.aquag-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
}

.aquag-info-item {
  min-width: 0;
  padding: .48rem .6rem;
  border: 1px solid rgba(71, 85, 105, .5);
  background: rgba(15, 23, 42, .42);
  border-radius: .6rem;
}

.aquag-info-label {
  display: block;
  font-size: .56rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #64748b;
  font-weight: 700;
}

.aquag-info-value {
  display: block;
  margin-top: .28rem;
  color: #e2e8f0;
  font-size: .72rem;
  line-height: 1.15;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aquag-student-turma {
  grid-area: turma;
}

.aquag-student-turma>.w-full {
  width: 100% !important;
  height: 100%;
}

.aquag-student-status {
  min-width: 0;
  grid-area: status;
}

.aquag-status-panel {
  height: 100%;
  border: 1px solid rgba(71, 85, 105, .55);
  background: rgba(15, 23, 42, .48);
  border-radius: .7rem;
  padding: .65rem;
}

.aquag-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, .08);
}

.aquag-student-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
}

.aquag-offline-alert {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .6rem;
  border-radius: .6rem;
  border: 1px solid rgba(248, 113, 113, .18);
  background: rgba(127, 29, 29, .14);
  color: #fca5a5;
  font-size: .66rem;
  font-weight: 600;
}

.aquag-matricula-search-wrap {
  width: 100%;
  margin: .75rem 0 1rem;
}

.aquag-matricula-search {
  width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 12px !important;
  font-size: .85rem !important;
}


/* ---------------------------------------------------------
   Seletor de aluno por pesquisa (usado nos horários de turma)
   --------------------------------------------------------- */

.student-picker {
  min-width: 0;
}

.slot-student-search {
  width: 100%;
  min-height: 46px;
  padding-right: 2.5rem !important;
}

.slot-student-search::placeholder {
  color: rgba(148, 163, 184, .75);
}

.student-picker::after {
  content: '⌄';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-54%);
  color: #94a3b8;
  pointer-events: none;
  font-size: 15px;
}

.slot-student-dropdown {
  scrollbar-width: thin;
  border: 1px solid rgba(100, 116, 139, .72) !important;
  border-radius: 12px !important;
  background: rgba(15, 23, 42, .98) !important;
  box-shadow: 0 14px 32px rgba(0, 0, 0, .28), 0 0 0 1px rgba(255, 255, 255, .025);
  overflow: hidden;
}

.student-picker-option {
  min-height: 46px;
  border-bottom: 1px solid rgba(71, 85, 105, .38) !important;
  padding: 10px 12px !important;
}

.student-picker-option:hover {
  background: rgba(51, 65, 85, .72) !important;
}

.student-picker-option:last-child {
  border-bottom: 0 !important;
}

.student-picker-option:focus-visible {
  outline: 2px solid rgba(56, 189, 248, .65);
  outline-offset: -2px;
}

.student-picker-option+.student-picker-option {
  border-top: 0;
}

.student-picker .slot-student-search:focus {
  border-color: rgba(56, 189, 248, .72) !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .10) !important;
}


/* ---------------------------------------------------------
   Ações do aluno nas listas OFFLINE e MATRICULADOS
   --------------------------------------------------------- */

#list-offline .edit,
#list-offline .pay,
#list-offline .whatsapp,
#list-matriculados .edit,
#list-matriculados .pay,
#list-matriculados .whatsapp {
  width: 118px !important;
  min-width: 118px !important;
  max-width: 118px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: .78rem !important;
}

#list-offline .delete,
#list-matriculados .delete {
  width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}


/* ---------------------------------------------------------
   Grade de turmas e horários
   --------------------------------------------------------- */

#turmas-grid .slot-student {
  width: 100% !important;
  min-width: 0 !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 10px !important;
  font-size: .8rem !important;
  border-radius: .55rem !important;
}

#turmas-grid .slot-add {
  width: 40px !important;
  flex: 0 0 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  border-radius: .55rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#turmas-grid .flex.gap-2.mb-3 {
  gap: 7px !important;
}


/* ---------------------------------------------------------
   Responsivo — tablets e telas médias
   --------------------------------------------------------- */

@media (max-width: 1199px) {

  .aquag-student-turma {
    align-self: stretch;
    padding-right: 0;
  }
}


/* ---------------------------------------------------------
   Responsivo — celular
   --------------------------------------------------------- */

@media (max-width: 767px) {

  #matricula-search-wrap,
  #show-financial-data {
    width: 100%;
  }

  /* INÍCIO */
  #section-inicio>.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .55rem !important;
  }

  #section-inicio>.grid .card-modern {
    min-width: 0;
    padding: .8rem !important;
  }

  #section-inicio>.grid .text-2xl {
    font-size: 1.35rem !important;
  }

  #section-inicio .card-modern .flex.flex-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .7rem;
  }

  #section-inicio .card-modern .flex.flex-wrap>div,
  #financial-filter,
  #filter-date-start,
  #filter-date-end {
    width: 100% !important;
    min-width: 0 !important;
  }

  #show-financial-data {
    min-height: 46px;
  }

  /* MATRÍCULA */
  #section-matricula {
    gap: .8rem !important;
  }

  #section-matricula>.card-modern {
    padding: 1rem !important;
  }

  #section-matricula .card-modern>.flex {
    align-items: flex-start;
  }

  #client-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: .9rem !important;
  }

  #client-form>div,
  #client-form>button {
    min-width: 0;
    width: 100%;
  }

  #client-form label {
    display: block;
    font-size: .75rem;
    margin-bottom: .35rem;
  }

  #client-form .input {
    min-height: 48px;
    padding: .75rem .85rem;
    font-size: .95rem;
  }

  #client-form>button {
    min-height: 50px;
    margin-top: .1rem;
  }

  #section-matricula>.grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: .65rem !important;
  }

  #section-matricula>.grid .btn {
    width: 100%;
    min-height: 52px;
  }

  /* Listas de alunos: ações quebram em linhas sem apertar o nome. */
  #list-offline,
  #list-matriculados {
    width: 100%;
  }

  #list-offline .card-modern,
  #list-matriculados .card-modern {
    padding: .85rem !important;
  }

  #list-offline .flex.flex-wrap,
  #list-matriculados .flex.flex-wrap {
    width: 100%;
  }

  #list-offline .edit,
  #list-offline .pay,
  #list-offline .whatsapp,
  #list-matriculados .edit,
  #list-matriculados .pay,
  #list-matriculados .whatsapp {
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
    height: 40px !important;
    min-height: 40px !important;
    font-size: .74rem !important;
  }

  /* TURMAS */
  #section-turma {
    gap: .65rem !important;
  }

  #turmas-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: .75rem !important;
    width: 100%;
  }

  #turmas-grid>.card-modern {
    min-width: 0;
    width: 100%;
    padding: .85rem !important;
  }

  #turmas-grid>.card-modern>div:last-child {
    gap: .65rem !important;
  }

  #turmas-grid .rounded-xl.border {
    min-width: 0;
    width: 100%;
    /* Sem overflow:hidden aqui: cortava o dropdown de seleção de aluno
       (.slot-student-dropdown) bem na borda do card no celular. */
    padding: .8rem !important;
  }

  #turmas-grid .slot-student {
    height: 40px !important;
    min-height: 40px !important;
    font-size: .76rem !important;
  }

  #turmas-grid .slot-student-search {
    min-height: 46px;
    font-size: .88rem;
  }

  #turmas-grid .flex.gap-2.mb-3 {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px !important;
    align-items: stretch;
  }

  #turmas-grid .flex.justify-between.items-center {
    min-width: 0;
    align-items: flex-start;
  }

  #turmas-grid h3,
  #turmas-grid p,
  #turmas-grid strong,
  #turmas-grid span {
    overflow-wrap: anywhere;
  }

  #turmas-grid .status {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Layout do cartão do aluno em coluna única */
  .aquag-student-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "main" "turma" "status";
    gap: .65rem;
  }

  .aquag-student-main,
  .aquag-student-turma,
  .aquag-student-status {
    grid-column: auto;
    grid-row: auto;
  }

  .aquag-student-actions {
    justify-content: stretch;
  }

  .aquag-student-actions .delete {
    margin-left: auto;
  }
}

@media (max-width: 380px) {

  #section-inicio>.grid .card-modern {
    padding: .7rem !important;
  }

  #list-offline .edit,
  #list-offline .pay,
  #list-offline .whatsapp,
  #list-matriculados .edit,
  #list-matriculados .pay,
  #list-matriculados .whatsapp {
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
    font-size: .7rem !important;
  }
}
