/* Ofertex – Design System */

/* ─── Design Tokens ─── */
:root {
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;

  --accent-400: #fbbf24;
  --accent-500: #f59e0b;
  --accent-600: #d97706;

  --success-50:  #ecfdf5;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.02);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Base ─── */
body {
  opacity: 1;
  transition: opacity var(--transition-base);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--gray-50);
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ─── Focus Ring ─── */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ─── Images ─── */
img {
  content-visibility: auto;
}

/* ─── Number Input Spinners ─── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* ─── Animations ─── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse-dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.anim-item {
  opacity: 0;
  animation: fadeSlideUp 0.4s ease-out forwards;
}
.anim-delay-1 { animation-delay: 0.06s; }
.anim-delay-2 { animation-delay: 0.12s; }
.anim-delay-3 { animation-delay: 0.18s; }
.anim-delay-4 { animation-delay: 0.24s; }
.anim-delay-5 { animation-delay: 0.30s; }

@keyframes flash-green {
  0% { background-color: var(--success-100); }
  100% { background-color: transparent; }
}
.flash-success {
  animation: flash-green 1s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Skeleton Loading ─── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Card Hover ─── */
.group:hover img {
  transform: scale(1.03);
}

/* ─── Drop Zone ─── */
#dropZone.dragover,
#photoDropzone.dragover {
  border-color: var(--brand-500);
  background-color: var(--brand-50);
}

/* ─── Category Scroll ─── */
.category-scroll {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-scroll::-webkit-scrollbar {
  display: none;
}
.category-scroll {
  mask-image: linear-gradient(to right, transparent 0, black 8px, black calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, black 8px, black calc(100% - 24px), transparent 100%);
  padding-right: 24px;
}

/* ─── Map Defaults ─── */
#map {
  height: 400px;
  width: 800px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  background-color: var(--gray-100);
}

/* ─── Shared Button Styles ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--brand-600);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
  background: var(--brand-700);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--success-600);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-success:hover {
  background: var(--success-700);
  transform: translateY(-1px);
}

/* ─── Shared Card Styles ─── */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-interactive:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ─── Badge Styles ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-brand {
  background: var(--brand-100);
  color: var(--brand-700);
}
.badge-success {
  background: var(--success-100);
  color: var(--success-700);
}
.badge-amber {
  background: #fef3c7;
  color: #92400e;
}
.badge-red {
  background: #fee2e2;
  color: #991b1b;
}
.badge-blue {
  background: #dbeafe;
  color: #1e40af;
}
.badge-gray {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ─── Input Styles ─── */
.input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-800);
  background: white;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input:focus {
  border-color: var(--brand-500);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.input::placeholder {
  color: var(--gray-400);
}

/* ─── Section Title ─── */
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 16px;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-lg);
}
.empty-state svg {
  margin: 0 auto 12px;
  color: var(--gray-300);
}
.empty-state p {
  color: var(--gray-500);
  font-size: 14px;
}

/* ─── Toast Notifications ─── */
.toast-container {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
}

@media (max-width: 640px) {
  .toast-container {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: white;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--gray-700);
  animation: toastSlideIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
  backdrop-filter: blur(8px);
}

.toast.toast-exit {
  animation: toastSlideOut 0.25s ease-in forwards;
}

.toast-success {
  border-color: var(--success-500);
  background: var(--success-50);
  color: var(--success-700);
}

.toast-error {
  border-color: #ef4444;
  background: #fef2f2;
  color: #b91c1c;
}

.toast-warning {
  border-color: var(--accent-500);
  background: #fffbeb;
  color: #92400e;
}

.toast-info {
  border-color: var(--brand-500);
  background: var(--brand-50);
  color: var(--brand-700);
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.toast-message {
  flex: 1;
  line-height: 1.45;
  font-weight: 500;
}

.toast-close {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
  background: none;
  border: none;
  padding: 0;
  color: currentColor;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(24px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(24px) scale(0.96); }
}

/* ─── Confirmation Dialog ─── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  animation: confirmFadeIn 0.2s ease;
}

.confirm-dialog {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  animation: confirmScaleIn 0.25s cubic-bezier(0.21, 1.02, 0.73, 1);
}

.confirm-dialog p {
  margin: 0 0 20px 0;
  font-size: 15px;
  color: var(--gray-700);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes confirmFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes confirmScaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
