/**
 * Gang Upload - Type 8 (Upload by Size) Styles
 */

/* Modal */
.gs8-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gs8-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

.gs8-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  max-width: 760px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.gs8-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.gs8-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
}

.gs8-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #9ca3af;
  line-height: 1;
  padding: 0;
  transition: color 0.2s;
}

.gs8-modal-close:hover {
  color: #374151;
}

.gs8-modal-body {
  padding: 0;
}

/* App container */
.gs8-app {
  padding: 20px 24px 24px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a2e;
  font-size: 14px;
}

/* Sections */
.gs8-section {
  margin-bottom: 20px;
}

.gs8-section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: #374151;
}

/* Dropzone */
.gs8-dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fafbfc;
}

.gs8-dropzone:hover,
.gs8-dropzone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

.gs8-upload-icon {
  margin-bottom: 10px;
  color: #9ca3af;
}

.gs8-dropzone-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: #374151;
}

.gs8-dropzone-subtitle {
  font-size: 13px;
  color: #9ca3af;
  margin: 0 0 10px 0;
}

.gs8-browse-btn {
  display: inline-block;
  padding: 8px 20px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.gs8-browse-btn:hover {
  background: #1d4ed8;
}

.gs8-dropzone-formats {
  font-size: 12px;
  color: #9ca3af;
  margin: 10px 0 0 0;
}

/* Uploaded preview */
.gs8-dropzone-filled {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.gs8-preview-wrapper {
  position: relative;
  flex-shrink: 0;
}

.gs8-preview-wrapper img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
  background: repeating-conic-gradient(#f0f0f0 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  border: 1px solid #e5e7eb;
}

.gs8-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.gs8-remove-btn:hover {
  background: #dc2626;
}

.gs8-remove-btn svg {
  width: 14px;
  height: 14px;
}

.gs8-file-info {
  flex: 1;
}

.gs8-file-name {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 4px 0;
  word-break: break-all;
}

.gs8-file-dims {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

/* Size/Qty Grid */
.gs8-size-grid {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.gs8-size-grid thead th {
  background: #f8f9fa;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
}

.gs8-size-grid thead th:last-child {
  text-align: center;
}

.gs8-size-row {
  border-bottom: 1px solid #f0f0f0;
}

.gs8-size-row:last-child {
  border-bottom: none;
}

.gs8-size-name {
  padding: 12px 14px;
  font-weight: 500;
  color: #374151;
}

.gs8-size-price {
  padding: 12px 14px;
  color: #6b7280;
  transition: color 0.2s;
}
.gs8-size-price.gs8-tiered-price {
  color: #059669;
  font-weight: 600;
}

.gs8-size-qty {
  padding: 8px 14px;
  text-align: center;
}

/* Qty controls */
.gs8-qty-controls {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}

.gs8-qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.gs8-qty-btn:hover {
  background: #e5e7eb;
}

.gs8-qty-input {
  width: 44px;
  height: 32px;
  border: none;
  border-left: 1px solid #d1d5db;
  border-right: 1px solid #d1d5db;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  -moz-appearance: textfield;
  appearance: textfield;
}

.gs8-qty-input::-webkit-inner-spin-button,
.gs8-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Summary */
.gs8-summary {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.gs8-summary-items {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 10px;
  line-height: 1.6;
}

.gs8-summary-sep {
  color: #9ca3af;
}

.gs8-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.gs8-summary-label {
  font-weight: 600;
  color: #374151;
}

.gs8-price {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
}

/* Action buttons */
.gs8-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.gs8-submit-btn {
  flex: 1;
  padding: 13px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gs8-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gs8-btn-primary {
  background: #2563eb;
  color: #fff;
}

.gs8-btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.gs8-btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.gs8-btn-secondary:hover:not(:disabled) {
  background: #e5e7eb;
}

.gs8-btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gs8-spinner {
  animation: gs8-spin 0.8s linear infinite;
}

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

/* Success message */
.gs8-success-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #16a34a;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
  animation: gs8-fadeIn 0.3s ease;
}

@keyframes gs8-fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Background removal tools */
.gs8-tools-section {
  padding: 16px;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.gs8-tools-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gs8-bg-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gs8-tool-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.gs8-tool-toggle input[type="checkbox"] {
  display: none;
}

.gs8-toggle-track {
  width: 40px;
  height: 22px;
  background: #d1d5db;
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.gs8-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.gs8-tool-toggle input:checked + .gs8-toggle-track {
  background: #2563eb;
}

.gs8-tool-toggle input:checked + .gs8-toggle-track::after {
  transform: translateX(18px);
}

.gs8-toggle-label {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

.gs8-tool-hint {
  font-size: 12px;
  color: #9ca3af;
  margin: 0 0 0 50px;
}

/* Color picker */
.gs8-color-picker-wrap {
  margin: 8px 0 0 50px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.gs8-color-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #374151;
}

.gs8-color-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.gs8-color-preset {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid #d1d5db;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s, transform 0.1s;
}

.gs8-color-preset:hover {
  transform: scale(1.1);
}

.gs8-color-preset.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.gs8-color-custom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gs8-color-custom input[type="color"] {
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
}

.gs8-color-custom span {
  font-size: 12px;
  color: #6b7280;
}

/* Responsive */
@media (max-width: 500px) {
  .gs8-app {
    padding: 16px;
  }

  .gs8-actions {
    flex-direction: column;
  }

  .gs8-modal-content {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* ========== DRIVER.JS TOUR OVERRIDES ========== */
/* Overlay must be above .gs8-modal (z-index:999999) but below popover */
.driver-overlay {
  z-index: 10000000 !important;
}
/* Popover must be above the overlay so buttons are clickable */
.driver-popover {
  z-index: 10000002 !important;
}
/* Highlighted element needs to sit between overlay and popover */
.driver-active-element {
  z-index: 10000001 !important;
}
