/* ========================================================
   Identidade Visual Código Kid - Estilo Personalizado
   ======================================================== */

:root {
  --ck-orange: #ff8b34;
  --ck-orange-dark: #e07622;
  --ck-red: #fd3635;
  --ck-red-dark: #d92423;
  --ck-green: #5cb85c;
  --ck-green-hover: #4cae4c;
  --ck-blue: #3dace1;
  --ck-purple: #a85ad4;
  --ck-yellow: #ffc501;
  
  --text-dark: #323a45;
  --text-muted: #5f6467;
  --bg-light: #f5f7f9;
  --bg-white: #ffffff;
  --border-color: #e9eaec;
  
  --font-title: 'Montserrat', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset de Elementos */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--text-dark);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========================================================
   NAVBAR
   ======================================================== */
.navbar {
  background-color: var(--bg-white);
  height: 80px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
  border-bottom: 4px solid var(--ck-orange);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.navbar-logo img {
  height: 50px;
  width: auto;
  display: block;
  transition: var(--transition);
}

.navbar-logo img:hover {
  transform: scale(1.03);
}

/* Menu de Navegação */
.navbar-menu {
  display: flex;
  align-items: center;
  gap: 15px;
  list-style: none;
}

.navbar-menu li a {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-menu li a:hover {
  background-color: var(--bg-light);
  color: var(--ck-orange);
}

.navbar-menu li a.active {
  background-color: rgba(255, 139, 52, 0.1);
  color: var(--ck-orange);
  font-weight: 700;
}

.navbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--text-dark);
  font-size: 1.1rem;
}

.navbar-title .badge {
  background-color: var(--ck-orange);
  color: var(--bg-white);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.navbar-title .badge.badge-admin {
  background-color: var(--ck-purple);
}

@media (max-width: 768px) {
  .navbar {
    height: auto;
    padding: 15px 0;
  }
  .navbar-container {
    flex-direction: column;
    gap: 15px;
  }
  .navbar-title {
    display: none;
  }
}

/* ========================================================
   HERO BANNER
   ======================================================== */
.hero-banner {
  background: linear-gradient(135deg, var(--ck-orange) 0%, var(--ck-red) 100%);
  color: var(--bg-white);
  padding: 60px 0 100px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-content h1 {
  color: var(--bg-white);
  font-size: 2.8rem;
  font-weight: 900;
  margin-bottom: 15px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.hero-content p {
  font-size: 1.2rem;
  max-width: 700px;
  margin: 0 auto;
  opacity: 0.95;
  font-weight: 300;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

/* Divisor de Onda SVG */
.wave-shape {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
}

.wave-shape svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px);
  height: 50px;
}

.wave-shape .shape-fill {
  fill: var(--bg-light);
}

/* ========================================================
   CORPO PRINCIPAL & LAYOUT GRID
   ======================================================== */
.main-content {
  margin-top: -40px;
  position: relative;
  z-index: 10;
  padding-bottom: 80px;
}

/* Alerta Banco de Dados */
.db-status-banner {
  background-color: #fff3cd;
  border-left: 5px solid #ffc107;
  border-radius: 12px;
  padding: 15px 20px;
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.4s ease-out;
}

.db-status-banner.hidden {
  display: none;
}

.db-status-content {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #856404;
}

.db-status-content i {
  font-size: 1.5rem;
}

.btn-retry {
  background-color: #856404;
  color: var(--bg-white);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-retry:hover {
  background-color: #6d5203;
  transform: translateY(-2px);
}

/* Grid Principal */
.grid-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

@media (min-width: 992px) {
  .grid-container {
    grid-template-columns: 1fr 1.3fr;
  }
}

.centered-form-container {
  max-width: 650px;
  margin: 0 auto;
  width: 100%;
}

/* Cards de Seção */
.card-section {
  background-color: var(--bg-white);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.card-section:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.icon-title {
  font-size: 1.6rem;
}

.color-orange { color: var(--ck-orange); }
.color-blue { color: var(--ck-blue); }
.color-red { color: var(--ck-red); }

.section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 25px;
}

/* ========================================================
   FORMULÁRIO DE CADASTRO
   ======================================================== */
.form-cadastro {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-grow: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row {
  display: flex;
  gap: 15px;
}

.col-half {
  flex: 1;
  width: 50%;
}

label {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

label i {
  color: var(--text-muted);
  font-size: 0.9rem;
}

input[type="text"],
input[type="number"],
input[type="email"],
select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-dark);
  background-color: var(--bg-white);
  transition: var(--transition);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--ck-orange);
  box-shadow: 0 0 0 4px rgba(255, 139, 52, 0.12);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6467' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Botões */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 10px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.button-success {
  background-color: var(--ck-green);
  color: var(--bg-white);
  box-shadow: 0 4px 12px rgba(92, 184, 92, 0.3);
}

.button-success:hover {
  background-color: var(--ck-green-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(92, 184, 92, 0.4);
}

.button-success:active {
  transform: translateY(0);
}

.button-light {
  background-color: #e9eaec;
  color: var(--text-dark);
}

.button-light:hover {
  background-color: #dbdcde;
}

.button-danger {
  background-color: var(--ck-red);
  color: var(--bg-white);
  box-shadow: 0 4px 12px rgba(253, 54, 53, 0.3);
}

.button-danger:hover {
  background-color: var(--ck-red-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(253, 54, 53, 0.4);
}

/* ========================================================
   LISTA E CARDS DE ALUNOS
   ======================================================== */
.count-badge {
  background-color: var(--ck-blue);
  color: var(--bg-white);
  font-size: 0.85rem;
  padding: 2px 10px;
  border-radius: 20px;
  margin-left: auto;
  font-weight: 700;
}

/* Caixa de Busca */
.search-box {
  position: relative;
  margin-bottom: 25px;
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.05rem;
}

.search-box input {
  padding-left: 45px;
  border-radius: 12px;
}

/* Container de Listagem */
.students-list-wrapper {
  position: relative;
  min-height: 250px;
  flex-grow: 1;
}

/* Loading Spinner */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 0;
  gap: 15px;
  color: var(--text-muted);
}

.spinner {
  width: 45px;
  height: 45px;
  border: 4px solid var(--border-color);
  border-top-color: var(--ck-orange);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3.5rem;
  color: var(--border-color);
  margin-bottom: 15px;
}

.empty-state p {
  font-weight: 600;
  font-size: 1.1rem;
}

.empty-state .subtext {
  font-size: 0.85rem;
  opacity: 0.8;
}

.hidden {
  display: none !important;
}

/* Grid de Cards */
.students-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Scrollbar Customizado */
.students-grid::-webkit-scrollbar {
  width: 6px;
}

.students-grid::-webkit-scrollbar-track {
  background: var(--bg-light);
  border-radius: 10px;
}

.students-grid::-webkit-scrollbar-thumb {
  background: #ccd1d9;
  border-radius: 10px;
}

/* Aluno Card */
.student-card {
  background-color: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.student-card:hover {
  transform: translateX(4px);
  border-color: #ccd1d9;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

/* Borda colorida lateral indicando o tipo de curso */
.student-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background-color: var(--ck-orange);
}

/* Cores de borda com base na tag de curso */
.student-card.course-KidCoding::before { background-color: var(--ck-green); }
.student-card.course-KidRobot::before { background-color: var(--ck-red); }
.student-card.course-KidGames::before { background-color: var(--ck-orange); }
.student-card.course-KidApp::before { background-color: var(--ck-blue); }
.student-card.course-KidTech::before { background-color: var(--ck-purple); }
.student-card.course-KidMath::before { background-color: var(--ck-yellow); }

.student-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-grow: 1;
}

.student-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.student-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-dark);
}

.student-age {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Badges/Tags de Cursos */
.course-tag {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Cores específicas das tags */
.tag-KidCoding { background-color: #e8f5e9; color: #2e7d32; }
.tag-KidRobot { background-color: #ffebee; color: #c62828; }
.tag-KidGames { background-color: #fff3e0; color: #ef6c00; }
.tag-KidApp { background-color: #e1f5fe; color: #0277bd; }
.tag-KidTech { background-color: #f3e5f5; color: #6a1b9a; }
.tag-KidMath { background-color: #fffde7; color: #fbc02d; }
.tag-default { background-color: #eceff1; color: #37474f; }

.student-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-item {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-item i {
  width: 14px;
  text-align: center;
  color: #aab2bd;
}

.student-actions {
  display: flex;
  align-items: center;
}

.btn-delete {
  background: none;
  border: none;
  color: #ff8a80;
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.btn-delete:hover {
  background-color: #ffebee;
  color: var(--ck-red);
  transform: scale(1.1);
}

/* ========================================================
   MODAL DE CONFIRMAÇÃO (CANCELAMENTO)
   ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(20, 28, 39, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s ease;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background-color: var(--bg-white);
  border-radius: 20px;
  width: 90%;
  max-width: 480px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(1);
  animation: popUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 15px;
}

.modal-header i {
  font-size: 2.2rem;
}

.modal-header h3 {
  font-size: 1.35rem;
  font-weight: 700;
}

.modal-body p {
  color: var(--text-dark);
  font-size: 0.95rem;
}

.modal-warning {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--ck-red);
  font-weight: 600;
  background-color: #ffebee;
  padding: 10px 15px;
  border-radius: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 5px;
}

.modal-actions .button {
  padding: 10px 20px;
  font-size: 0.9rem;
}

/* ========================================================
   TOAST DE NOTIFICAÇÃO
   ======================================================== */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: #1c2833;
  color: var(--bg-white);
  padding: 15px 25px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1001;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
  animation: slideInRight 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border-left: 5px solid var(--ck-green);
}

.toast.error {
  border-left-color: var(--ck-red);
}

.toast.error i {
  color: var(--ck-red);
}

.toast i {
  color: var(--ck-green);
  font-size: 1.25rem;
}

/* ========================================================
   FOOTER
   ======================================================== */
.footer {
  background-color: var(--bg-white);
  padding: 30px 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* ========================================================
   ANIMAÇÕES
   ======================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popUp {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

.animate-up {
  animation: fadeInUp 0.8s both;
}

.animate-up-delay {
  animation: fadeInUp 0.8s 0.2s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================================
   TELA DE LOGIN ADMINISTRATIVO
   ======================================================== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.login-card {
  background-color: var(--bg-white);
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  padding: 40px 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: popUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-header img {
  height: 55px;
  width: auto;
  margin-bottom: 5px;
}

.login-header h2 {
  font-size: 1.4rem;
  color: var(--text-dark);
  font-weight: 700;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

