/* ============================================================
   LUMOS — Reusable Components
   Modal, Toast, Donut Chart, Tags, etc.
   ============================================================ */

/* ---- MODAL ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-lg), var(--highlight);
  animation: modalIn .35s var(--ease-spring);
  position: relative;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
    animation: sheetIn .35s var(--ease-out);
  }
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-lg { max-width: 680px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-title { font-size: 1.125rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

.modal-body { margin-bottom: 1.5rem; }
.modal-body .form-group + .form-group { margin-top: 1rem; }
.modal-footer {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* ---- TOAST ---- */
.toast-root {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 1rem .7rem .75rem;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), var(--highlight);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: all;
  animation: toastIn .4s var(--ease-spring);
  min-width: 220px;
  max-width: 360px;
  line-height: 1.4;
}
.toast.exiting { animation: toastOut .25s var(--ease-out) forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(8px) scale(.96); } }

.toast-icon {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.toast-icon svg { width: 15px; height: 15px; }
.toast-success .toast-icon { color: var(--success); background: var(--success-soft); }
.toast-error   .toast-icon { color: var(--danger);  background: var(--danger-soft); }
.toast-warning .toast-icon { color: var(--warning); background: var(--warning-soft); }
.toast-info    .toast-icon { color: var(--info);    background: var(--info-soft); }
@media (max-width: 640px) {
  .toast-root { left: 1rem; right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); align-items: center; }
  .toast { max-width: 100%; width: 100%; }
}

/* ---- DONUT CHART ---- */
.donut-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.donut-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-percent {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.donut-sub {
  font-size: .65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ---- TABS ---- */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.tab {
  flex: 1;
  padding: .5rem .75rem;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  border: none;
  background: none;
}
.tab.active {
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tab:hover:not(.active) { color: var(--text-primary); }

/* ---- SEARCH BAR ---- */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}
.search-bar svg {
  position: absolute;
  left: 12px;
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-bar input {
  padding-left: 38px;
  max-width: 300px;
}

/* ---- NOTE CARD ---- */
.note-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: .625rem;
  position: relative;
  overflow: hidden;
}
.note-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--subject-color, var(--primary));
  border-radius: 4px 0 0 4px;
}
.note-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.note-card-title { font-size: 1rem; font-weight: 700; padding-left: .5rem; }
.note-card-subject {
  font-size: .75rem;
  font-weight: 600;
  color: var(--subject-color, var(--primary));
  padding-left: .5rem;
}
.note-card-preview {
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-left: .5rem;
}
.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: .5rem;
  padding-top: .25rem;
}
.note-card-date { font-size: .72rem; color: var(--text-muted); }
.note-card-actions { display: flex; gap: .25rem; opacity: 0; transition: opacity var(--transition); }
.note-card:hover .note-card-actions { opacity: 1; }

/* ---- DEADLINE ITEM ---- */
.deadline-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}
.deadline-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.deadline-item.completed {
  opacity: .55;
}
.deadline-item.completed .deadline-title { text-decoration: line-through; }
.deadline-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  background: transparent;
}
.deadline-check:hover { border-color: var(--primary); background: var(--primary-soft); }
.deadline-item.completed .deadline-check {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.deadline-info { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.deadline-title { font-size: .9rem; font-weight: 600; }
.deadline-meta { font-size: .75rem; color: var(--text-secondary); display: flex; gap: .75rem; flex-wrap: wrap; }
.deadline-subject { color: var(--subject-color, var(--primary)); }
.deadline-right { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.deadline-points {
  font-size: .8rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  padding: 2px 8px;
  border-radius: 99px;
}
.deadline-date-tag {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
}
.deadline-date-tag.urgent { color: var(--danger); }
.deadline-date-tag.soon   { color: var(--warning); }

/* ---- CONFIRM DIALOG ---- */
.confirm-modal .modal-body {
  text-align: center;
  padding: 1rem 0;
}
.confirm-icon {
  width: 56px; height: 56px;
  margin: 0 auto .9rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--warning);
  background: var(--warning-soft);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--warning) 6%, transparent);
}

/* ---- ÍCONES (Lucide) ---- */
svg.lucide { flex-shrink: 0; vertical-align: -0.18em; }
.empty-icon svg.lucide,
.no-class-icon svg.lucide { display: block; margin: 0 auto; }
.section-title svg.lucide { vertical-align: -2px; margin-right: .2rem; }
.tab svg.lucide { margin-right: .25rem; }
.confirm-modal .modal-footer { justify-content: center; }

/* ---- SUBJECT PILL ---- */
.subject-pill {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--subject-color-soft, var(--primary-soft));
  color: var(--subject-color, var(--primary));
  border: 1px solid var(--subject-color, var(--primary));
}

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
  align-items: center;
}
.filter-chip {
  padding: 5px 12px;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }

/* ---- FULLSCREEN LOADING OVERLAY ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

.loading-overlay.is-active {
  opacity: 1;
  pointer-events: all;
}

.loading-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

.loading-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .58rem .95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.36);
}

.loading-logo::after {
  content: '';
  position: absolute;
  inset: -25%;
  width: 35%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(255, 244, 187, 0.55),
    rgba(255, 255, 255, 0)
  );
  transform: translateX(180%) skewX(-18deg);
  animation: lumos-shine 1s linear infinite;
}

.loading-logo-icon {
  font-size: 1.26rem;
  filter: drop-shadow(0 0 10px rgba(255, 221, 120, 0.5));
}

.loading-logo-text {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: #f4e6c6;
  text-transform: uppercase;
}

.loading-overlay-message {
  font-size: .82rem;
  color: rgba(255, 255, 255, 0.86);
  letter-spacing: .02em;
}

@keyframes lumos-shine {
  from { transform: translateX(180%) skewX(-18deg); }
  to   { transform: translateX(-220%) skewX(-18deg); }
}
/* ---- SKELETON (carregamento) ---- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: transparent !important;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}
@keyframes skeletonShimmer { to { transform: translateX(100%); } }
