/* ==========================================================================
   DIÁRIO DE CLASSE DIGITAL - COMPONENTS CSS
   Botões, Cards, Modais, Inputs, Toasts e Widgets
   ========================================================================== */

/* --- BOTÕES --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.25;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
}

.btn-success {
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald-700));
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

.btn-success:hover {
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  box-shadow: 0 4px 8px rgba(5, 150, 105, 0.35);
}

.btn-purple {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(124, 58, 237, 0.25);
  border-color: transparent;
}

.btn-purple:hover {
  background: linear-gradient(135deg, #9333ea, #7e22ce);
  color: #ffffff;
  box-shadow: 0 4px 8px rgba(124, 58, 237, 0.35);
}

.btn-primary .badge-count,
.btn-success .badge-count,
.btn-purple .badge-count {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--slate-700);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background-color: var(--slate-50);
  color: var(--slate-900);
  border-color: var(--slate-400);
}

.btn-danger {
  background-color: var(--danger-50);
  color: var(--danger-600);
  border-color: var(--danger-100);
}

.btn-danger:hover {
  background-color: var(--danger-500);
  color: #ffffff;
}

.btn-ghost {
  background-color: transparent;
  color: var(--slate-600);
}

.btn-ghost:hover {
  background-color: var(--slate-100);
  color: var(--slate-900);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: var(--border-radius-lg);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--border-radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

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

.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-200);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--slate-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- KPI STATS WIDGETS --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  position: relative;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 6px 16px -4px rgba(15, 23, 42, 0.04);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: all 0.3s ease;
}

.stat-card.card-blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-card.card-green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.card-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.card-red::before { background: linear-gradient(90deg, #f43f5e, #fb7185); }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -6px rgba(15, 23, 42, 0.09), 0 2px 4px rgba(15, 23, 42, 0.02);
  border-color: rgba(148, 163, 184, 0.4);
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon-wrapper {
  transform: scale(1.06);
}

.stat-icon-blue {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.stat-icon-green {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.28);
}

.stat-icon-red {
  background: linear-gradient(135deg, #dc2626, #f43f5e);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.28);
}

.stat-icon-amber {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.28);
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.15;
  margin-top: 3px;
  letter-spacing: -0.02em;
}

.stat-subtext {
  font-size: 0.78rem;
  color: var(--slate-500);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Micro-animação de ponto pulsante */
.pulse-dot-red {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* --- FORM CONTROLS --- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: " *";
  color: var(--danger-500);
}

.form-control {
  width: 100%;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--slate-800);
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 1.2em 1.2em;
  padding-right: 36px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* --- SEGMENTED BUTTONS / TABS --- */
.segmented-control {
  display: inline-flex;
  background-color: var(--slate-100);
  padding: 4px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-light);
  gap: 2px;
}

.segmented-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--slate-600);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.segmented-btn.active {
  background-color: #ffffff;
  color: var(--primary-700);
  box-shadow: var(--shadow-xs);
}

.segmented-btn:hover:not(.active) {
  color: var(--slate-900);
}

/* --- HEADER & TOPBAR --- */
#top-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-class-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--slate-50);
  padding: 6px 12px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-light);
}

.header-class-selector select {
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-800);
  cursor: pointer;
}

.header-class-selector select:focus {
  outline: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: var(--border-radius-full);
  background: var(--slate-50);
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-600);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-800);
}

/* --- SIDEBAR --- */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  flex-shrink: 0;
  z-index: 45;
  white-space: nowrap;
  overflow: hidden;
}

#sidebar.collapsed,
#app-layout.sidebar-collapsed #sidebar {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  margin-left: 0 !important;
  padding: 0 !important;
  border: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 12px;
}

.btn-collapse-sidebar {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--slate-300);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.btn-collapse-sidebar:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateX(-2px);
}

.btn-toggle-sidebar-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-md);
  background: var(--bg-card);
  color: var(--slate-700);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
}

.btn-toggle-sidebar-header:hover {
  background: var(--primary-50);
  color: var(--primary-600);
  border-color: var(--primary-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-toggle-sidebar-header:active {
  transform: scale(0.96);
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-md);
  background: linear-gradient(135deg, var(--primary-500), var(--emerald-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
}

.brand-text h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.brand-text span {
  font-size: 0.7rem;
  color: var(--emerald-400);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--slate-300);
  border-radius: var(--border-radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: var(--slate-400);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- MODAL --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding: 16px;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.97);
  transition: transform var(--transition-normal);
}

.modal-backdrop.show .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-dialog.modal-lg {
  max-width: 850px;
}

.modal-dialog.modal-xl {
  max-width: 1100px;
}

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

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--slate-400);
  font-size: 1.3rem;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px;
  line-height: 1;
}

.modal-close-btn:hover {
  background: var(--slate-100);
  color: var(--slate-800);
}

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--slate-50);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--slate-900);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  animation: slideUp 0.25s ease-out;
  border-left: 4px solid var(--primary-500);
}

.toast.toast-success {
  border-left-color: var(--emerald-500);
}

.toast.toast-error {
  border-left-color: var(--danger-500);
}

.toast.toast-warning {
  border-left-color: var(--warning-500);
}

.toast.toast-info {
  border-left-color: var(--primary-500);
}

/* --- FICHA INDIVIDUAL DO ALUNO --- */
.ficha-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ficha-student-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--slate-50);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
}

.ficha-profile-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}

.ficha-avatar {
  width: 54px;
  height: 54px;
  border-radius: var(--border-radius-full);
  background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.ficha-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

.ficha-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.ficha-metric-box {
  background: var(--slate-50);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ficha-metric-box.highlight-blue {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

.ficha-metric-box.highlight-green {
  background: var(--emerald-50);
  border-color: var(--emerald-200);
}

.ficha-metric-box.highlight-purple {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

/* Barra de Ações em Massa (Batch Actions) */
.batch-actions-bar {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 1px solid #fecaca;
  border-radius: var(--border-radius-md);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  animation: fadeIn 0.2s ease-in-out;
  box-shadow: var(--shadow-sm);
}

.batch-actions-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--danger-800);
  font-size: 0.92rem;
}

.batch-actions-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

@keyframes loginModalFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes loginModalFadeOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(0.95) translateY(-10px); }
}
