/* ══════════════════════════════════════════════════════════════════
   GIF MAKER — Production UI (gm-* prefix)
   ══════════════════════════════════════════════════════════════════ */

.gm-wrapper {
  max-width: 100%;
  margin: 0 auto;
  padding: 24px !important;
}

/* ── Header ─────────────────────────────────────────────────────── */
.gm-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.gm-header-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
}

.gm-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a1a2e;
  margin: 0 !important;
}

.gm-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 4px 0 0 !important;
}

/* ── Upload Zone ────────────────────────────────────────────────── */
.gm-upload-zone {
  border: 2.5px dashed #d1d5db;
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
  background: #fafbfc;
}

.gm-upload-zone:hover {
  border-color: #667eea;
  background: #f5f3ff;
}

.gm-upload-zone.gm-drop-active {
  border-color: #667eea !important;
  background: #eef2ff !important;
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.gm-upload-icon {
  font-size: 2rem;
  color: #667eea;
  margin-bottom: 10px;
}

.gm-upload-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}

.gm-upload-hint {
  font-size: 0.82rem;
  color: #9ca3af;
  margin-bottom: 14px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.gm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.gm-btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
}

.gm-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  color: #fff !important;
}

.gm-btn-outline {
  background: transparent;
  border: 1.5px solid #e5e7eb;
  color: #374151;
}

.gm-btn-outline:hover {
  border-color: #667eea;
  color: #667eea;
  background: #f5f3ff;
}

.gm-btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.gm-btn-danger:hover {
  background: #fecaca;
}

.gm-btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.gm-btn-lg {
  padding: 14px 32px;
  font-size: 1rem;
}

.gm-btn-generate {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff !important;
  padding: 14px 36px;
  font-size: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  border: none;
}

.gm-btn-generate:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.gm-btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Filmstrip Section ──────────────────────────────────────────── */
.gm-filmstrip-section {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  margin-top: 20px;
}

.gm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.gm-section-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 !important;
}

.gm-frame-count {
  color: #6b7280;
  font-weight: 500;
}

.gm-filmstrip-actions {
  display: flex;
  gap: 8px;
}

.gm-filmstrip-hint {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 14px;
}

/* ── Filmstrip (horizontal scroll) ──────────────────────────────── */
.gm-filmstrip {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.gm-filmstrip::-webkit-scrollbar {
  height: 6px;
}

.gm-filmstrip::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.gm-filmstrip::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

/* ── Frame Item ─────────────────────────────────────────────────── */
.gm-frame-item {
  flex: 0 0 100px !important;
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  cursor: grab;
  transition: all 0.2s ease;
  position: relative;
}

.gm-frame-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.gm-frame-item.gm-frame-dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.gm-frame-item.gm-frame-dragover {
  border-color: #667eea !important;
  background: #eef2ff;
  transform: scale(1.05);
}

.gm-frame-thumb {
  width: 100%;
  height: 75px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
}

.gm-frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gm-frame-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
}

.gm-frame-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: #6b7280;
}

.gm-frame-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}

.gm-frame-move-left,
.gm-frame-move-right {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.65rem;
  padding: 2px 3px;
  border-radius: 3px;
  transition: all 0.15s;
  line-height: 1;
}

.gm-frame-move-left:hover:not(:disabled),
.gm-frame-move-right:hover:not(:disabled) {
  color: #667eea;
  background: #eef2ff;
}

.gm-frame-move-left:disabled,
.gm-frame-move-right:disabled {
  opacity: 0.3;
  cursor: default;
}

.gm-frame-remove {
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 0.65rem;
  padding: 2px 3px;
  border-radius: 3px;
  transition: all 0.15s;
  line-height: 1;
}

.gm-frame-remove:hover {
  color: #ef4444;
  background: #fee2e2;
}

/* ── Settings Card ──────────────────────────────────────────────── */
.gm-settings-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 24px;
  margin-top: 16px;
}

.gm-settings-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 20px !important;
}

.gm-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 576px) {
  .gm-settings-grid {
    grid-template-columns: 1fr;
  }
}

.gm-setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gm-setting-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  margin: 0 !important;
}

.gm-setting-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gm-setting-hint {
  font-size: 0.72rem;
  color: #9ca3af;
  margin: 0 !important;
}

.gm-range {
  flex: 1;
  height: 6px;
  accent-color: #667eea;
  cursor: pointer;
}

.gm-range-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: #667eea;
  min-width: 50px;
  text-align: right;
  white-space: nowrap;
}

.gm-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #1f2937;
  background: #fff;
  transition: border-color 0.2s;
}

.gm-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.gm-select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #1f2937;
  background: #fff;
  cursor: pointer;
}

.gm-select:focus {
  outline: none;
  border-color: #667eea;
}

.gm-generate-row {
  margin-top: 24px;
  text-align: center;
}

/* ── Progress Card ──────────────────────────────────────────────── */
.gm-progress-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 24px;
  margin-top: 16px;
  text-align: center;
}

.gm-progress-header {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
}

.gm-progress-bar-wrap {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.gm-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.gm-progress-hint {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* ── Result Card ────────────────────────────────────────────────── */
.gm-result-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 24px;
  margin-top: 16px;
  text-align: center;
}

.gm-result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 16px !important;
}

.gm-preview-wrap {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  display: inline-block;
  max-width: 100%;
}

.gm-preview-img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}

.gm-result-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.gm-result-meta span {
  font-size: 0.82rem;
  color: #6b7280;
  font-weight: 500;
}

.gm-result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Mobile Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .gm-wrapper {
    padding: 16px !important;
  }
  .gm-upload-zone {
    padding: 20px 16px;
  }
  .gm-upload-icon {
    font-size: 1.8rem;
  }
  .gm-header {
    gap: 12px;
  }
  .gm-title {
    font-size: 1.2rem;
  }
  .gm-subtitle {
    font-size: 0.8rem;
  }
  .gm-frame-item {
    flex: 0 0 80px !important;
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
  }
  .gm-frame-thumb {
    height: 60px;
  }
  .gm-result-meta {
    gap: 10px;
  }
  .gm-btn-lg {
    padding: 12px 24px;
    font-size: 0.9rem;
  }
  .gm-settings-card {
    padding: 16px;
  }
  .gm-filmstrip-section {
    padding: 14px;
  }
  .gm-section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
