/* ============================================
   EduLar — Component Library
   ============================================ */

/* ── Botões ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  transition: all var(--transition-normal);
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid transparent;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: hsl(0,0%,100%,0);
  transition: background var(--transition-fast);
}

.btn:hover::after { background: hsl(0,0%,100%,0.05); }
.btn:active::after { background: hsl(0,0%,0%,0.1); }

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 2px 12px var(--color-primary-glow);
}
.btn-primary:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary-light);
  box-shadow: 0 4px 20px var(--color-primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
  border-color: var(--color-secondary);
}
.btn-secondary:hover {
  background: var(--color-secondary-light);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-danger:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border-color: var(--glass-border);
  color: var(--text-primary);
}
.btn-glass:hover {
  background: hsl(237, 14%, 20%, 0.8);
  border-color: var(--border-default);
}

.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); border-radius: var(--radius-lg); }
.btn-xl { padding: var(--space-5) var(--space-10); font-size: var(--text-lg); border-radius: var(--radius-lg); }
.btn-icon { padding: var(--space-2); aspect-ratio: 1; border-radius: var(--radius-md); }
.btn-round { border-radius: var(--radius-full); }

/* ── Cards ── */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-normal);
}

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

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

.card-clickable {
  cursor: pointer;
}
.card-clickable:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary-subtle);
  box-shadow: 0 8px 24px hsl(0,0%,0%,0.3), 0 0 0 1px var(--color-primary-subtle);
}

/* ── Barra de Progresso ── */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
}

.progress-value {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.progress-track {
  height: 8px;
  background: var(--surface-4);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-track-lg {
  height: 12px;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  width: 0;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, transparent, hsl(0,0%,100%,0.3));
  border-radius: var(--radius-full);
}

.progress-fill-primary {
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  box-shadow: 0 0 12px var(--color-primary-glow);
}

.progress-fill-success {
  background: linear-gradient(90deg, var(--color-secondary), var(--color-secondary-light));
  box-shadow: var(--shadow-glow-secondary);
}

.progress-fill-warning {
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
  box-shadow: var(--shadow-glow-accent);
}

.progress-fill-danger {
  background: linear-gradient(90deg, var(--color-danger), hsl(4,72%,68%));
}

.progress-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
}

.progress-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

.badge-primary  { background: var(--color-primary-subtle); color: var(--color-primary-light); }
.badge-success  { background: var(--color-success-subtle); color: var(--color-secondary-light); }
.badge-warning  { background: var(--color-warning-subtle); color: var(--color-accent-light); }
.badge-danger   { background: var(--color-danger-subtle); color: var(--color-danger); }
.badge-muted    { background: var(--surface-3); color: var(--text-muted); }

/* ── Inputs ── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
}

.field-label span { color: var(--color-danger); margin-left: 2px; }

.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  outline: none;
}

.input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
  background: var(--surface-2);
}

.input::placeholder { color: var(--text-disabled); }

.input-error { border-color: var(--color-danger) !important; }
.field-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

textarea.input { resize: vertical; min-height: 80px; }

/* ── Checkbox Customizado ── */
.check-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.check-item:hover {
  background: var(--surface-2);
  border-color: var(--border-default);
}

.check-item.completed {
  background: var(--color-success-subtle);
  border-color: var(--color-secondary);
}

.check-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.check-item.completed .check-box {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: #fff;
}

.check-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  flex: 1;
}

.check-item.completed .check-label {
  text-decoration: line-through;
  color: var(--text-muted);
}

.check-type-badge {
  font-size: 0.65rem;
  font-weight: var(--fw-semibold);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Avatar ── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--border-default);
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; border-width: 3px; }

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  color: #fff;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  border: none;
  margin: var(--space-4) 0;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 200ms ease;
}

.modal {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 560px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: fadeInScale 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--surface-3);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--surface-4); color: var(--text-primary); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

/* ── Toast / Notifications ── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideInRight var(--transition-normal) ease;
  border-left: 3px solid var(--color-primary);
}

.toast-success { border-left-color: var(--color-secondary); }
.toast-error   { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-accent); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--surface-1);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.tab-btn:hover { color: var(--text-secondary); background: var(--surface-2); }

.tab-btn.active {
  background: var(--surface-3);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ── Stat Cards ── */
.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--fw-extrabold);
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.stat-trend {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Loading Skeleton ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 50%,
    var(--surface-2) 75%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
  border-radius: var(--radius-md);
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.empty-state-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}

.empty-state-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 320px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .modal { padding: var(--space-6); margin: var(--space-4); border-radius: var(--radius-lg); }
  .tabs { overflow-x: auto; }
  .tab-btn { flex: none; }
}
