/* Product page customize button (Journal / default theme) */
.sportswear-designer-link {
  display: block;
  margin: 16px 0;
  clear: both;
}

.sportswear-designer-link .button,
.sportswear-designer-link .btn,
.sportswear-designer-link .sw-customize-btn {
  display: inline-block !important;
  width: 100%;
  max-width: 100%;
  text-align: center;
  text-decoration: none !important;
  padding: 14px 20px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: filter 0.15s ease, transform 0.15s ease;
}

.sportswear-designer-link .sw-customize-btn:hover {
  filter: brightness(1.08);
  color: #fff !important;
  transform: translateY(-1px);
}

.sportswear-designer-link .sw-customize-icon::before {
  content: "✎";
  margin-right: 6px;
}

/* Full-screen designer */
html.sw-designer-active,
body.sw-designer-active {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100%;
  background: #080808;
  color: #f3f4f6;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.sw-designer.sw-fullscreen {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #151515 0%, #080808 55%);
  box-sizing: border-box;
}

/* Top bar */
.sw-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  height: 56px;
  padding: 0 20px;
  background: rgba(12, 12, 12, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
}

.sw-topbar-back {
  color: #9ca3af;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.sw-topbar-back:hover {
  color: #fff;
}

.sw-topbar-title {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sw-topbar-actions {
  display: flex;
  gap: 8px;
}

/* Main layout */
.sw-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sw-col-left {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px;
  background: rgba(14, 14, 14, 0.6);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #404040 transparent;
}

.sw-col-left::-webkit-scrollbar,
.sw-template-scroll::-webkit-scrollbar,
.sw-team-scroll::-webkit-scrollbar,
.sw-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.sw-col-left::-webkit-scrollbar-thumb,
.sw-template-scroll::-webkit-scrollbar-thumb,
.sw-team-scroll::-webkit-scrollbar-thumb,
.sw-dropdown-menu::-webkit-scrollbar-thumb {
  background: #404040;
  border-radius: 3px;
}

.sw-col-canvas {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding: 8px 12px 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: transparent;
}

.sw-canvas-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sw-canvas-inner {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  line-height: 0;
}

.sw-col-right {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: rgba(14, 14, 14, 0.6);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #404040 transparent;
}

.sw-section {
  margin-bottom: 16px;
}

.sw-section-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
}

.sw-mt {
  margin-top: 14px;
}

/* Template scroll — 2 per row */
.sw-template-scroll {
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.sw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sw-template-card {
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  background: rgba(26, 26, 26, 0.9);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.sw-template-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.sw-template-card.active {
  border-color: #3b82f6;
  background: rgba(30, 58, 95, 0.5);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.sw-template-card .sw-template-name {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #e5e7eb;
  line-height: 1.2;
}

.sw-template-preview {
  min-height: 96px;
  background: #1f1f1f;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  padding: 4px;
}

.sw-tpl-duo {
  display: flex;
  gap: 6px;
  width: 100%;
}

.sw-tpl-view {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.sw-tpl-view-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ca3af;
  line-height: 1;
}

.sw-jersey-mini {
  position: relative;
  width: 100%;
  height: 52px;
  background: #374151;
  border-radius: 3px;
  overflow: hidden;
}

.sw-j-block {
  pointer-events: none;
}

.sw-canvas-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  flex-shrink: 0;
  margin-top: 8px;
  padding-top: 4px;
}

.sw-canvas-footer .sw-hint {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.4;
}

.sw-view-toggle {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}

.sw-view-side {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.sw-view-side:hover {
  color: #e5e7eb;
}

.sw-view-side.active {
  background: #3b82f6;
  color: #fff;
}

/* Dropdowns */
.sw-dropdown {
  position: relative;
  margin-bottom: 10px;
}

.sw-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  background: rgba(22, 22, 22, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f3f4f6;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sw-dropdown-trigger:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: #1f1f1f;
}

.sw-dropdown-trigger[aria-expanded="true"] {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.sw-dropdown-trigger:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.sw-dropdown-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sw-dropdown-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #9ca3af;
  flex-shrink: 0;
}

.sw-dropdown-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.sw-dropdown-menu-colors {
  padding: 10px;
  max-height: 280px;
}

.sw-palette-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #e8e8e8;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.sw-palette-option:hover {
  background: #2a2a2a;
}

.sw-palette-option.active {
  background: #1e3a5f;
}

.sw-palette-trigger-swatches,
.sw-palette-swatches {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.sw-palette-trigger-swatches span,
.sw-palette-swatches span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sw-color-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: #d1d5db;
}

.sw-color-slot input[type="color"] {
  width: 44px;
  height: 32px;
  padding: 0;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

.sw-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 12px;
  color: #9ca3af;
  cursor: pointer;
}

/* Canvas */
.sw-canvas-inner .canvas-container {
  transition: transform 0.15s ease;
  will-change: transform;
  transform-origin: top left !important;
}

#sw-canvas {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1a1a1a;
  border-radius: 8px;
  display: block;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.sw-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
}

.sw-team-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.sw-team-table tbody tr.sw-team-row-active {
  background: rgba(59, 130, 246, 0.22);
  outline: 1px solid rgba(59, 130, 246, 0.55);
}

.sw-team-table tbody tr.sw-team-row-active td {
  color: #f3f4f6;
}

/* Buttons */
.sw-btn {
  display: inline-block;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.sw-btn-block {
  display: block;
  width: 100%;
  margin-bottom: 8px;
}

.sw-btn-primary {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.sw-btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
}

.sw-btn-primary:active {
  transform: scale(0.98);
}

.sw-btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.sw-btn-secondary {
  background: #374151;
  color: #fff;
}

.sw-btn-secondary:hover {
  background: #4b5563;
}

.sw-upload-btn {
  cursor: pointer;
  background: #1a1a1a;
  border: 1px dashed #444;
  color: #e8e8e8;
}

/* Team table */
.sw-team-scroll {
  max-height: calc(100vh - 280px);
  overflow: auto;
  margin-bottom: 10px;
}

.sw-team-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sw-team-table th {
  background: #1a1a1a;
  color: #9ca3af;
  padding: 6px 4px;
  text-align: left;
  font-weight: 600;
}

.sw-team-table td {
  padding: 4px 2px;
  border-bottom: 1px solid #2a2a2a;
}

.sw-team-table input,
.sw-team-table select {
  width: 100%;
  padding: 6px 4px;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e8e8e8;
  font-size: 12px;
  box-sizing: border-box;
}

.sw-team-table .sw-remove-row {
  padding: 4px 8px;
  background: #7f1d1d;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.sw-status {
  font-size: 12px;
  min-height: 18px;
  color: #9ca3af;
  margin-top: 8px;
}

.sw-desktop-only {
  display: block;
}

.sw-mobile-only {
  display: none;
}

.sw-mobile-stepper {
  display: none;
}

/* Mobile */
@media (max-width: 991px) {
  .sw-desktop-only {
    display: none !important;
  }

  .sw-mobile-only {
    display: block;
  }

  .sw-mobile-tabs {
    display: flex;
  }

  .sw-mobile-stepper {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
    padding: 8px 10px;
    background: rgba(10, 10, 10, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sw-step {
    flex: 1 0 auto;
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
  }

  .sw-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
  }

  .sw-step.active {
    color: #e5e7eb;
  }

  .sw-step.active .sw-step-num {
    background: #3b82f6;
    color: #fff;
  }

  .sw-step-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .sw-main {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .sw-col-canvas {
    order: -1;
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 0;
    max-height: none;
    padding: 8px 10px 6px;
    background: rgba(8, 8, 8, 0.97);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sw-canvas-stage {
    height: 36vh;
    min-height: 200px;
    max-height: 360px;
  }

  .sw-canvas-footer {
    margin-top: 6px;
    padding-top: 0;
  }

  .sw-col-left,
  .sw-col-right {
    display: none !important;
    width: 100%;
    flex: none !important;
    min-height: auto !important;
    overflow: visible !important;
    padding: 12px 12px 20px;
    border: none;
  }

  .sw-col-left.sw-tab-panel-active,
  .sw-col-right.sw-tab-panel-active {
    display: block !important;
    order: 1;
  }

  .sw-section[data-mobile-tab] {
    display: none;
  }

  .sw-section[data-mobile-tab].sw-tab-active {
    display: block;
  }

  .sw-template-scroll {
    max-height: none;
    overflow: visible;
    margin: 0 -4px;
  }

  .sw-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 8px 12px;
    scrollbar-width: thin;
  }

  .sw-template-card {
    flex: 0 0 88%;
    max-width: 88%;
    scroll-snap-align: center;
    min-width: 260px;
  }

  .sw-mobile-hint {
    margin: 4px 0 0;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
  }

  .sw-mobile-continue {
    margin-top: 14px;
  }

  .sw-dropdown-mobile-open .sw-dropdown-menu {
    display: block !important;
    position: static !important;
    margin-top: 8px;
    max-height: none;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(20, 20, 20, 0.95);
  }

  .sw-dropdown-mobile-open .sw-palette-option {
    width: 100%;
    margin-bottom: 6px;
  }

  .sw-dropdown-menu-colors {
    padding: 10px;
  }

  .sw-team-scroll {
    max-height: none;
    overflow: visible;
  }

  .sw-team-table {
    font-size: 12px;
  }

  .sw-mobile-tabs {
    flex-shrink: 0;
    display: flex;
    height: 52px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(12, 12, 12, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .sw-mobile-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    padding: 8px 4px;
    transition: color 0.2s ease;
  }

  .sw-mobile-tab.active {
    color: #60a5fa;
    box-shadow: inset 0 -2px 0 #3b82f6;
  }

  .sw-topbar-title {
    font-size: 13px;
  }

  .sw-mobile-actions {
    display: block;
    margin-top: 12px;
  }
}

/* Desktop: show all sections in sidebars */
@media (min-width: 992px) {
  .sw-section[data-mobile-tab] {
    display: block !important;
  }

  .sw-mobile-actions {
    display: none !important;
  }
}
