/* =============================================
   FabricAI — Image Upload Component Styles
   styles/upload.css
   ============================================= */

/* ─── Upload Grid (2-column on desktop) ─────── */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

/* ─── Upload Card ───────────────────────────── */
.upload-card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  overflow: hidden;
  transition: var(--transition-slow);
  box-shadow: var(--shadow-md);
}

.upload-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: var(--glass-border);
}

.upload-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand-soft);
  border: 1px solid hsla(263, 60%, 55%, 0.25);
  flex-shrink: 0;
}

.upload-card-icon svg {
  width: 20px;
  height: 20px;
  color: var(--color-text-brand);
}

.upload-card-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.upload-card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

/* ─── Drop Zone ─────────────────────────────── */
.drop-zone {
  position: relative;
  margin: var(--space-5) var(--space-6) var(--space-6);
  min-height: 220px;
  border: 2px dashed var(--color-border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: var(--transition-slow);
  overflow: hidden;
  background: hsla(240, 10%, 10%, 0.4);
}

/* Hidden file input */
.drop-zone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Drop zone hover state */
.drop-zone:hover,
.drop-zone.drag-hover {
  border-color: var(--color-brand-500);
  background: hsla(263, 70%, 30%, 0.08);
  box-shadow: 0 0 0 4px hsla(263, 70%, 58%, 0.06), inset 0 0 40px hsla(263, 70%, 40%, 0.04);
}

.drop-zone.drag-hover {
  border-style: solid;
  transform: scale(1.01);
}

.drop-zone.drag-hover .drop-zone-icon {
  transform: scale(1.15) translateY(-4px);
  color: var(--color-brand-400);
}

/* Error state */
.drop-zone.error {
  border-color: var(--color-error);
  background: var(--color-error-soft);
  animation: shake 0.5s var(--ease-out);
}

/* ─── Drop Zone Inner Content ───────────────── */
.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  pointer-events: none; /* Let the input handle clicks */
  padding: var(--space-6);
  text-align: center;
}

.drop-zone-icon {
  width: 52px;
  height: 52px;
  color: var(--color-text-tertiary);
  transition: var(--transition-slow);
}

.drop-zone-text-primary {
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  font-size: var(--text-base);
}

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

.drop-zone-text-link {
  color: var(--color-text-brand);
  font-weight: var(--weight-medium);
}

/* File type badges */
.drop-zone-badges {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.drop-zone-badge {
  padding: 2px var(--space-2);
  background: hsla(240, 10%, 20%, 0.6);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.drop-zone-size-limit {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* ─── Preview State ─────────────────────────── */
.drop-zone.has-preview {
  border-style: solid;
  border-color: var(--color-border-brand);
  background: transparent;
  padding: 0;
  cursor: default;
}

.drop-zone.has-preview .drop-zone-input {
  display: none;
}

.drop-zone-preview {
  position: absolute;
  inset: 0;
  display: none;
}

.drop-zone.has-preview .drop-zone-preview {
  display: block;
}

.drop-zone.has-preview .drop-zone-inner {
  display: none;
}

.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* ─── Preview Overlay Controls ──────────────── */
.preview-overlay {
  position: absolute;
  inset: 0;
  background: hsla(240, 14%, 6%, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
  border-radius: inherit;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.drop-zone.has-preview:hover .preview-overlay {
  opacity: 1;
}

.preview-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  border: none;
  transition: var(--transition-base);
  z-index: 3;
}

.preview-action-btn--change {
  background: var(--gradient-brand);
  color: white;
  box-shadow: var(--shadow-brand);
}

.preview-action-btn--change:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-brand-strong);
}

.preview-action-btn--remove {
  background: var(--color-error-soft);
  color: var(--color-error);
  border: 1px solid var(--color-error-border);
}

.preview-action-btn--remove:hover {
  background: var(--color-error);
  color: white;
  transform: translateY(-2px);
}

.preview-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Hidden file input for "Change" button */
.preview-change-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ─── File Info Bar ─────────────────────────── */
.upload-file-info {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-top: var(--glass-border);
  font-size: var(--text-sm);
}

.upload-file-info.visible {
  display: flex;
}

.upload-file-info svg {
  width: 14px;
  height: 14px;
  color: var(--color-success);
  flex-shrink: 0;
}

.upload-file-name {
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.upload-file-size {
  color: var(--color-text-tertiary);
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Upload Error Message ──────────────────── */
.upload-error {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-6);
  font-size: var(--text-sm);
  color: var(--color-error);
}

.upload-error.visible {
  display: flex;
  animation: slideDown var(--duration-base) var(--ease-out);
}

.upload-error svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ─── Upload Progress (during API call) ─────── */
.upload-progress-bar {
  height: 3px;
  background: var(--color-border-subtle);
  margin: 0 var(--space-6) var(--space-4);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: none;
}

.upload-progress-bar.visible {
  display: block;
}

.upload-progress-fill {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}
