@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  /* System Name */
  --system-name: 'Doçura';

  /* Primary */
  --rose-50:  #FFF0F5;
  --rose-100: #FFD6E7;
  --rose-200: #FFB3CF;
  --rose-400: #F0628E;
  --rose-500: #D94F7A;
  --rose-600: #B83D64;
  --rose-800: #7A1E3C;
  --rose-900: #4A0E22;

  /* Gold */
  --gold-50:  #FFFBF0;
  --gold-100: #FFF0C2;
  --gold-200: #FFE08A;
  --gold-400: #F0B429;
  --gold-500: #D49A0E;
  --gold-600: #A87800;
  --gold-800: #6B4A00;

  /* Neutral */
  --neutral-0:   #FFFFFF;
  --neutral-50:  #FDFBF9;
  --neutral-100: #F5F1ED;
  --neutral-200: #EAE4DC;
  --neutral-300: #D4CBBF;
  --neutral-400: #A8998A;
  --neutral-500: #7C6D5E;
  --neutral-700: #3D3028;
  --neutral-900: #1A1208;

  /* Semantics */
  --success: #2E9E6B;
  --success-bg: #EDFAF3;
  --warning: #C47D0E;
  --warning-bg: #FEF5E0;
  --danger:  #C43B3B;
  --danger-bg: #FDECEC;
  --info:    #2E6FC4;
  --info-bg: #EBF2FD;

  /* Fonts */
  --font-display: 'DM Serif Display', serif;
  --font-body:    'DM Sans', sans-serif;

  /* Text Sizes & Line Heights */
  --text-xs:   11px;
  --lh-xs:     1.5;
  --text-sm:   13px;
  --lh-sm:     1.5;
  --text-base: 14px;
  --lh-base:   1.6;
  --text-md:   16px;
  --lh-md:     1.6;
  --text-lg:   20px;
  --lh-lg:     1.3;
  --text-xl:   26px;
  --lh-xl:     1.2;
  --text-2xl:  34px;
  --lh-2xl:    1.1;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Borders & Shadows */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  --border-color: var(--neutral-200);
  --border-input: var(--neutral-300);

  --shadow-xs: 0 1px 2px rgba(26,18,8, 0.06);
  --shadow-sm: 0 2px 8px rgba(26,18,8, 0.08);
  --shadow-md: 0 4px 16px rgba(26,18,8, 0.10);
  --shadow-lg: 0 8px 32px rgba(26,18,8, 0.12);
  --shadow-rose: 0 4px 20px rgba(217,79,122, 0.25);
}

/* 1. RESET E BASE */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--neutral-50);
  color: var(--neutral-700);
  font-size: var(--text-base);
  line-height: var(--lh-base);
}

::selection {
  background: var(--rose-400);
  color: white;
}

:focus-visible {
  outline: 2px solid var(--rose-400);
  outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--neutral-100);
}
::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-400);
}

/* Typography elements base */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400; /* display light or regular */
}

a {
  text-decoration: none;
  color: var(--rose-500);
}

/* 2. COMPONENTES — BOTÕES */
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  transition: all 150ms ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  text-decoration: none;
  line-height: normal;
  white-space: nowrap;
}

.btn:disabled, .btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--rose-500);
  color: white;
  border-color: var(--rose-500);
}
.btn-primary:hover:not(:disabled) {
  background: var(--rose-600);
  box-shadow: var(--shadow-rose);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.btn-secondary {
  background: white;
  color: var(--neutral-700);
  border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--neutral-50);
  border-color: var(--neutral-300);
}

.btn-ghost {
  background: transparent;
  color: var(--neutral-500);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--neutral-100);
  color: var(--neutral-700);
}

.btn-danger {
  background: white;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-bg);
}

.btn-gold {
  background: var(--gold-500);
  color: white;
}
.btn-gold:hover:not(:disabled) {
  background: var(--gold-600);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 14px;
}
.btn-lg {
  font-size: 16px;
  padding: 12px 24px;
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}
.btn-block {
  width: 100%;
}

.btn .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: rotate 0.75s linear infinite;
}
@keyframes rotate {
  100% { transform: rotate(360deg); }
}

/* 3. COMPONENTES — FORMULÁRIOS */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--neutral-700);
  letter-spacing: 0.02em;
}

.form-control {
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--neutral-700);
  background: white;
  transition: border-color 150ms, box-shadow 150ms;
  font-family: inherit;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--rose-400);
  box-shadow: 0 0 0 3px rgba(240,98,142,0.15);
}
.form-control::placeholder {
  color: var(--neutral-400);
}
.form-control:hover:not(:focus) {
  border-color: var(--neutral-400);
}

textarea.form-control {
  height: auto;
  min-height: 100px;
  padding: 12px 14px;
  resize: vertical;
}

.form-select {
  height: 40px;
  padding: 0 36px 0 14px;
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--neutral-700);
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23A8998A'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") no-repeat right 12px center/16px;
  appearance: none;
  transition: border-color 150ms, box-shadow 150ms;
  font-family: inherit;
  width: 100%;
}
.form-select:focus {
  outline: none;
  border-color: var(--rose-400);
  box-shadow: 0 0 0 3px rgba(240,98,142,0.15);
}

.form-hint {
  font-size: 12px;
  color: var(--neutral-400);
  margin-top: 4px;
}
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.has-error .form-control, .has-error .form-select {
  border-color: var(--danger);
}
.has-error .form-error {
  display: block;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.form-check input[type=checkbox], .form-check input[type=radio] {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-input);
  background: white;
  transition: all 100ms;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.form-check input[type=radio] {
  border-radius: 50%;
}
.form-check input[type=checkbox]:checked {
  background: var(--rose-500);
  border-color: var(--rose-500);
}
.form-check input[type=checkbox]:checked::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.form-check input[type=radio]:checked {
  border: 5px solid var(--rose-500);
}
.form-check-label {
  font-size: 14px;
  color: var(--neutral-700);
  cursor: pointer;
}

/* 4. COMPONENTES — CARDS */
.card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--neutral-700);
  margin: 0;
}

.card-subtitle {
  font-size: 13px;
  color: var(--neutral-500);
  margin-top: 2px;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--neutral-50);
}

.card-hover {
  cursor: pointer;
  transition: box-shadow 200ms, transform 200ms;
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* 5. COMPONENTES — STAT CARDS */
.stat-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card-icon.icon-rose { background: var(--rose-50); color: var(--rose-500); }
.stat-card-icon.icon-gold { background: var(--gold-50); color: var(--gold-600); }
.stat-card-icon.icon-green { background: var(--success-bg); color: var(--success); }
.stat-card-icon.icon-blue { background: var(--info-bg); color: var(--info); }
.stat-card-icon i, .stat-card-icon svg { font-size: 20px; }

.stat-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--neutral-400);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--neutral-900);
  font-family: var(--font-display);
  line-height: 1;
}

.stat-card-delta {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.stat-card-delta.delta-up { color: var(--success); }
.stat-card-delta.delta-down { color: var(--danger); }

/* 6. COMPONENTES — TABELAS */
.table-wrapper {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  background: white;
}

table.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  padding: 11px 16px;
  background: var(--neutral-50);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 600;
  color: var(--neutral-500);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.table thead th.sortable {
  cursor: pointer;
  user-select: none;
}
.table thead th.sortable:hover {
  background: var(--neutral-100);
}

.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--neutral-100);
  font-size: 14px;
  color: var(--neutral-700);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: var(--rose-50);
  transition: background 100ms;
}

.table-actions {
  display: flex;
  gap: 6px;
}

/* 7. COMPONENTES — BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: normal;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-neutral { background: var(--neutral-100); color: var(--neutral-500); }
.badge-rose    { background: var(--rose-50);    color: var(--rose-600); }
.badge-gold    { background: var(--gold-50);    color: var(--gold-600); }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  margin-right: 6px;
}

/* 8. COMPONENTES — ALERTS / FLASH MESSAGES */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border-left: 3px solid;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

.alert-success { background: var(--success-bg); border-left-color: var(--success); color: var(--neutral-700); }
.alert-warning { background: var(--warning-bg); border-left-color: var(--warning); color: var(--neutral-700); }
.alert-danger  { background: var(--danger-bg);  border-left-color: var(--danger); color: var(--neutral-700); }
.alert-info    { background: var(--info-bg);    border-left-color: var(--info); color: var(--neutral-700); }

.alert-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: -1px;
}
.alert-success .alert-icon { color: var(--success); }
.alert-warning .alert-icon { color: var(--warning); }
.alert-danger .alert-icon { color: var(--danger); }
.alert-info .alert-icon { color: var(--info); }

.alert-content {
  flex: 1;
}

.alert-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
}
.alert-close:hover { opacity: 1; }

.alert-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  width: 100%;
  opacity: 0.2;
  transform-origin: left;
}

/* 9. COMPONENTES — MODAIS */
.modal-overlay {
  background: rgba(26,18,8, 0.55);
  backdrop-filter: blur(4px);
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 200ms;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 24px 28px 20px;
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--neutral-900);
}
.modal-header .btn-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--neutral-400);
  cursor: pointer;
  padding: 0;
}
.modal-header .btn-close:hover {
  color: var(--neutral-700);
}

.modal-body {
  padding: 0 28px 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 10. COMPONENTES — PAGINAÇÃO */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--neutral-500);
  background: white;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}
.page-btn:hover:not(:disabled):not(.active) {
  background: var(--neutral-100);
}
.page-btn.active {
  background: var(--rose-500);
  color: white;
  font-weight: 600;
  border-color: var(--rose-500);
}
.page-btn:disabled, .page-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* 11. COMPONENTES — DROPDOWN MENU */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: 6px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 150ms ease, transform 150ms ease;
}
.dropdown.open .dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dropdown-menu.left { left: 0; right: auto; }

.dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--neutral-700);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: background 100ms;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.dropdown-item:hover {
  background: var(--neutral-100);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}
.dropdown-item.danger {
  color: var(--danger);
}
.dropdown-item.danger:hover {
  background: var(--danger-bg);
}

/* 12. COMPONENTES — EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--rose-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rose-400);
  font-size: 32px;
}

.empty-state-title {
  font-size: 18px;
  font-family: var(--font-display);
  color: var(--neutral-700);
  margin: 0;
}

.empty-state-text {
  font-size: 14px;
  color: var(--neutral-400);
  max-width: 320px;
  margin: 0;
}

/* 13. COMPONENTES — TOOLTIPS (JS fallback) */
.tooltip {
  position: absolute;
  background: var(--neutral-900);
  color: white;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 2000;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms, transform 150ms;
}
.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}
.tooltip::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px 4px 0;
  border-style: solid;
  border-color: var(--neutral-900) transparent transparent transparent;
}

/* 14. COMPONENTES — AVATAR */
.avatar {
  border-radius: 50%;
  background: var(--rose-100);
  color: var(--rose-700);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  user-select: none;
  font-size: 14px;
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-md { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
}
.toast {
  min-width: 280px;
  max-width: 360px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border-left: 4px solid;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInRight 300ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  position: relative;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-body { flex: 1; font-size: 14px; color: var(--neutral-700); margin-top: 1px; }

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