/* ============================================
   BuildMyListing — Components
   Buttons, modals, forms, cards, upload zone
   ============================================ */

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

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

/* Primary — gold with dark text */
.btn-primary {
  background: var(--gold);
  color: var(--navy-dark);
  border-color: var(--gold);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  box-shadow: var(--shadow-gold);
}

/* Secondary — outlined */
.btn-secondary {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--navy);
  color: var(--cream);
}

/* Ghost — minimal */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: var(--space-2) var(--space-4);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
}

/* Dark variant (for use on dark backgrounds) */
.btn-primary-dark {
  background: var(--gold);
  color: var(--navy-dark);
  border-color: var(--gold);
}

.btn-primary-dark:hover:not(:disabled) {
  background: var(--gold-light);
  border-color: var(--gold-light);
  box-shadow: var(--shadow-gold);
}

.btn-outline-light {
  background: transparent;
  color: var(--cream);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-outline-light:hover:not(:disabled) {
  border-color: var(--cream);
  background: rgba(255, 255, 255, 0.08);
}

/* Sizes */
.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);
}

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

/* Icon button */
.btn-icon {
  padding: var(--space-2);
  width: 40px;
  height: 40px;
}

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

/* Button with loading spinner */
.btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn.loading .spinner {
  display: block;
}

.btn.loading .btn-text {
  opacity: 0.6;
}

/* ── Forms ── */

.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.form-label-hint {
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: normal;
  margin-left: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  outline: none;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-muted);
}

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

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: var(--leading-normal);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.form-help {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Inline form row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ── Cards ── */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: box-shadow var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-elevated {
  box-shadow: var(--shadow-md);
  border: none;
}

.card-gold {
  border: 2px solid var(--gold);
  position: relative;
}

.card-dark {
  background: var(--navy);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--cream);
}

/* ── Listing Card (Dashboard) ── */

.listing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.listing-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.listing-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--cream-dark);
}

.listing-card-body {
  padding: var(--space-4) var(--space-5);
}

.listing-card-address {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.listing-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.listing-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}

/* ── Status Badges ── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-full);
}

.badge-processing {
  background: #eff6ff;
  color: #2563eb;
}

.badge-complete {
  background: #ecfdf5;
  color: var(--emerald);
}

.badge-error {
  background: var(--red-light);
  color: var(--red);
}

.badge-draft {
  background: var(--cream-dark);
  color: var(--slate);
}

.badge-gold {
  background: var(--gold-muted);
  color: var(--gold-dark);
}

/* Pulse dot for processing */
.badge-processing::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2563eb;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

/* ── Upload Zone ── */

.upload-zone {
  position: relative;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  background: var(--cream);
}

.upload-zone:hover {
  border-color: var(--gold);
  background: var(--gold-muted);
}

.upload-zone.drag-over {
  border-color: var(--gold);
  background: var(--gold-muted);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px var(--gold-muted);
}

.upload-zone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  color: var(--gold);
}

.upload-zone-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.upload-zone-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Thumbnail grid for uploaded photos */
.upload-thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.upload-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.upload-thumb:hover .upload-thumb-remove {
  opacity: 1;
}

.upload-thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-1) var(--space-2);
  background: rgba(0, 0, 0, 0.65);
  color: white;
  font-size: var(--text-xs);
  text-align: center;
  backdrop-filter: blur(4px);
}

/* Upload progress bar */
.upload-progress {
  margin-top: var(--space-3);
  height: 4px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: var(--gold);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-out);
}

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 37, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal), visibility var(--duration-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 20px;
}

.modal-close:hover {
  background: var(--cream-dark);
  color: var(--text-primary);
}

.modal-body {
  padding: 0 var(--space-6) 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(--border-subtle);
}

/* ── Tabs ── */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--duration-fast), border-color var(--duration-fast);
  margin-bottom: -1px;
}

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

.tab.active {
  color: var(--gold-dark);
  border-bottom-color: var(--gold);
  font-weight: 600;
}

.tab-panel {
  display: none;
  padding-top: var(--space-6);
}

.tab-panel.active {
  display: block;
}

/* ── Toast / Notifications ── */

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

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--gold);
  min-width: 320px;
  max-width: 420px;
  animation: slide-in-right var(--duration-normal) var(--ease-spring);
}

.toast-success { border-left-color: var(--emerald); }
.toast-error   { border-left-color: var(--red); }

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

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
}

/* ── Processing Progress ── */

.progress-dashboard {
  display: grid;
  gap: var(--space-4);
}

.progress-step {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--duration-normal);
}

.progress-step.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-muted);
}

.progress-step.complete {
  border-color: var(--emerald);
}

.progress-step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream-dark);
  color: var(--text-secondary);
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.progress-step.active .progress-step-icon {
  background: var(--gold-muted);
  color: var(--gold-dark);
  animation: pulse-subtle 2s ease-in-out infinite;
}

.progress-step.complete .progress-step-icon {
  background: #ecfdf5;
  color: var(--emerald);
}

.progress-step-content {
  flex: 1;
}

.progress-step-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.progress-step-status {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Pricing Cards ── */

.pricing-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}

.pricing-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.pricing-card-featured {
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.pricing-card-featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: var(--navy-dark);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
}

.pricing-tier {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: var(--space-4);
}

.pricing-amount {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.pricing-period {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  margin-bottom: var(--space-6);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-8);
  text-align: left;
}

.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-snug);
}

.pricing-features li::before {
  content: '';
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%23059669' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
}

/* ── Skeleton Loaders ── */

.skeleton {
  background: linear-gradient(90deg, var(--cream-dark) 25%, var(--cream-warm) 50%, var(--cream-dark) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

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

.skeleton-image {
  height: 200px;
  border-radius: var(--radius-lg);
}

/* ── Divider ── */

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: var(--space-6) 0;
}

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

/* ── Animations ── */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

@keyframes pulse-subtle {
  0%, 100% { box-shadow: 0 0 0 0 var(--gold-muted); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes count-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Utility: Visually hidden ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
