/* ============================================
   PARCEIROAÍ FORMS — Reusable Components
   Buttons, Inputs, Cards, Badges, etc.
   ============================================ */

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button — CTA Premium com Neon */
.btn--primary {
  background: var(--gradient-primary);
  color: var(--color-bg);
  box-shadow: 0 4px 16px var(--color-primary-glow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn--primary:hover {
  background: var(--gradient-primary);
  box-shadow: 0 8px 28px var(--color-primary-glow), 0 0 0 1px var(--color-border-primary-hover), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--color-primary-glow-sm);
}

/* Secondary Button — Glass */
.btn--secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--color-text);
}

/* Ghost Button */
.btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

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

/* Danger Button */
.btn--danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn--danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Button Sizes */
.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn--xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

.btn--full {
  width: 100%;
}

/* Button Icon */
.btn__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn--lg .btn__icon {
  width: 20px;
  height: 20px;
}

/* Ripple effect */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple-effect 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-effect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}


/* ══════════════════════════════════════════
   INPUTS
   ══════════════════════════════════════════ */

.input-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-group__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.input-group__label .required {
  color: var(--color-primary-lighter);
  font-size: var(--text-xs);
}

.input-group__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-base);
  transition: all var(--duration-normal) var(--ease-out);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--color-border-hover);
}

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

.input::placeholder,
.textarea::placeholder {
  color: var(--color-text-muted);
}

.input--lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.textarea {
  min-height: 120px;
  line-height: var(--leading-relaxed);
}

.textarea--lg {
  min-height: 180px;
  padding: var(--space-5);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.select {
  appearance: none;
  cursor: pointer;
  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='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

.select option {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* Input with icon */
.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper .input {
  padding-left: var(--space-10);
}

.input-icon-wrapper .icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  pointer-events: none;
}

/* Toggle / Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  display: inline-block;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--color-surface-3);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-out);
}

.toggle__slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all var(--duration-normal) var(--ease-spring);
}

.toggle input:checked + .toggle__slider {
  background: var(--color-primary);
}

.toggle input:checked + .toggle__slider::before {
  transform: translateX(22px);
}


/* ══════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════ */

.card {
  background: var(--color-glass-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

/* Shimmer interno sutil */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.025) 0%, transparent 50%);
  pointer-events: none;
  border-radius: inherit;
}

.card--hover:hover {
  background: var(--color-glass-2);
  border-color: var(--color-border-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.card--solid {
  background: var(--color-surface-1);
  backdrop-filter: none;
}

.card--glow {
  box-shadow: var(--shadow-card), 0 0 20px var(--color-primary-glow-sm);
  border-color: var(--color-border-primary);
}

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

.card__title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.card__description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}


/* ══════════════════════════════════════════
   BADGES / TAGS
   ══════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--color-primary-subtle);
  color: var(--color-primary-lighter);
  border: 1px solid var(--color-border-primary);
}

.badge--success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.2);
}

.badge--warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.badge--info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-info);
  border-color: rgba(59, 130, 246, 0.2);
}

.badge--count {
  min-width: 22px;
  height: 22px;
  padding: 0 var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  font-size: 11px;
  font-weight: var(--weight-bold);
  border-radius: var(--radius-full);
  border: none;
}

/* Category tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  border: 1px solid var(--color-border);
  background: var(--color-surface-1);
  color: var(--color-text-secondary);
}

.tag:hover,
.tag--active {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
  color: var(--color-primary-lighter);
}

.tag--active {
  box-shadow: var(--shadow-glow-sm);
}


/* ══════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════ */

.progress {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.progress__bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
  position: relative;
  box-shadow: 0 0 10px var(--color-primary-glow-sm);
}

.progress__bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
  animation: progress-shine 2.5s ease infinite;
}

@keyframes progress-shine {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.progress--thick {
  height: 8px;
}

.progress__label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  text-align: right;
}


/* ══════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  pointer-events: auto;
  animation: toast-in var(--duration-slow) var(--ease-out);
  max-width: 380px;
}

.toast--success {
  border-color: rgba(16, 185, 129, 0.3);
}

.toast--error {
  border-color: rgba(239, 68, 68, 0.3);
}

.toast--info {
  border-color: rgba(59, 130, 246, 0.3);
}

.toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

.toast__close {
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--duration-fast);
}

.toast__close:hover {
  color: var(--color-text);
}

.toast.removing {
  animation: toast-out var(--duration-normal) var(--ease-out) forwards;
}


/* ══════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fade-in var(--duration-normal) var(--ease-out);
}

.modal {
  background: var(--color-glass-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scale-in var(--duration-slow) var(--ease-spring);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

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

.modal__title {
  font-size: var(--text-xl);
  font-weight: 600;
}

.modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: all var(--duration-fast);
}

.modal__close:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}

.modal__body {
  padding: var(--space-6);
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
}


/* ══════════════════════════════════════════
   LOADING / SKELETON
   ══════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface-2) 25%,
    var(--color-surface-3) 50%,
    var(--color-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease infinite;
  border-radius: var(--radius-md);
}

.skeleton--text {
  height: 16px;
  width: 100%;
  margin-bottom: var(--space-2);
}

.skeleton--text:last-child {
  width: 70%;
}

.skeleton--title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-4);
}

.skeleton--circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton--card {
  height: 120px;
  width: 100%;
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--color-surface-3);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.spinner--white {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: white;
}


/* ══════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  opacity: 0.5;
}

.empty-state__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.empty-state__description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 360px;
  margin-bottom: var(--space-6);
}


/* ══════════════════════════════════════════
   DROPDOWN
   ══════════════════════════════════════════ */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 200px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  padding: var(--space-2);
  animation: scale-in var(--duration-normal) var(--ease-out);
  transform-origin: top right;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.dropdown__item:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}

.dropdown__divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2) 0;
}


/* ══════════════════════════════════════════
   AVATAR / ICON CIRCLE
   ══════════════════════════════════════════ */

.icon-circle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--color-primary-subtle);
  color: var(--color-primary-lighter);
  flex-shrink: 0;
}

.icon-circle--sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
}

.icon-circle--lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
}

.icon-circle svg {
  width: 20px;
  height: 20px;
}

.icon-circle--sm svg {
  width: 16px;
  height: 16px;
}

.icon-circle--lg svg {
  width: 28px;
  height: 28px;
}

/* ── Custom Searchable Select for Models ── */
.custom-select {
  position: relative;
  width: 100%;
}

.custom-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-base);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.custom-select__trigger:hover {
  border-color: var(--color-border-hover);
}

.custom-select__arrow {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  transition: transform var(--duration-normal) var(--ease-out);
}

.custom-select.active .custom-select__arrow {
  transform: rotate(180deg);
}

.custom-select__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scale-in var(--duration-normal) var(--ease-out);
  transform-origin: top center;
}

.custom-select__dropdown.hidden {
  display: none !important;
}

.model-search-bar {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.model-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.model-filters .btn {
  padding: 4px var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
}

.model-filters .btn:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}

.model-filters .btn.active {
  background: var(--color-primary-subtle);
  color: var(--color-primary-lighter);
  border-color: var(--color-border-primary);
}

.model-list {
  max-height: 280px;
  overflow-y: auto;
  background: var(--color-surface-1);
}

.model-option-empty {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: all var(--duration-fast);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.model-option:last-child {
  border-bottom: none;
}

.model-option:hover {
  background: var(--color-surface-2);
}

.model-option.active {
  background: var(--color-primary-subtle);
  border-left: 3px solid var(--color-primary);
  padding-left: calc(var(--space-4) - 3px);
}

.model-option__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.model-option__name-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.model-option__name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.model-option__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 11px;
  color: var(--color-text-muted);
}

.model-option__id {
  font-family: var(--font-body);
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.model-option__prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 11px;
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  flex-shrink: 0;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.model-badge--free {
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
}

.model-badge--value {
  background: rgba(59, 130, 246, 0.12);
  color: #3B82F6;
}

.model-badge--paid {
  background: rgba(139, 92, 246, 0.12);
  color: #8B5CF6;
}
