/**
 * Patch Designer Styles
 * 
 * @package Patch_Designer
 */

/* ==========================================================================
   Terms of Use Modal
   ========================================================================== */

.pd-terms-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.pd-terms-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.pd-terms-content {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  animation: pd-modal-slide-in 0.3s ease-out;
}

@keyframes pd-modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pd-terms-header {
  padding: 2rem 2rem 1rem;
  border-bottom: 2px solid #e5e7eb;
  text-align: center;
}

.pd-terms-icon {
  color: #2563eb;
  margin-bottom: 1rem;
}

.pd-terms-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
}

.pd-terms-body {
  padding: 2rem;
}

.pd-terms-intro {
  font-size: 1rem;
  color: #4b5563;
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.pd-terms-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.pd-term-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
  border-left: 4px solid #2563eb;
}

.pd-term-icon {
  flex-shrink: 0;
  color: #2563eb;
  margin-top: 2px;
}

.pd-term-content {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #374151;
}

.pd-term-content strong {
  display: block;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.pd-terms-footer {
  font-size: 0.95rem;
  font-weight: 500;
  color: #1f2937;
  padding: 1rem;
  background: #fef3c7;
  border-radius: 8px;
  border-left: 4px solid #f59e0b;
  margin: 0;
  line-height: 1.6;
}

.pd-terms-actions {
  padding: 1.5rem 2rem 2rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  border-top: 2px solid #e5e7eb;
}

.pd-terms-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.pd-terms-btn svg {
  flex-shrink: 0;
}

.pd-terms-btn-decline {
  background: white;
  color: #6b7280;
  border-color: #d1d5db;
}

.pd-terms-btn-decline:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #374151;
}

.pd-terms-btn-accept {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.pd-terms-btn-accept:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.pd-terms-btn:active {
  transform: translateY(0);
}

/* Shake animation for when user clicks overlay */
@keyframes pd-terms-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.pd-terms-shake {
  animation: pd-terms-shake 0.5s ease-in-out;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .pd-terms-content {
    max-height: 95vh;
    border-radius: 0;
  }
  
  .pd-terms-header {
    padding: 1.5rem 1.5rem 1rem;
  }
  
  .pd-terms-title {
    font-size: 1.25rem;
  }
  
  .pd-terms-body {
    padding: 1.5rem;
  }
  
  .pd-term-item {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .pd-terms-actions {
    flex-direction: column-reverse;
    padding: 1rem 1.5rem 1.5rem;
  }
  
  .pd-terms-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   Container & Layout
   ========================================================================== */

.patch-designer-container {
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.patch-designer-wrapper {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Header
   ========================================================================== */

.patch-designer-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.patch-designer-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 0.5rem 0;
}

.patch-designer-description {
    font-size: 1.125rem;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ==========================================================================
   Two-Column Layout
   ========================================================================== */

.patch-designer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Preview Column (Left) */
.patch-designer-preview {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Chat Column (Right) */
.patch-designer-chat {
    grid-column: 2;
}

/* ==========================================================================
   Card Styles
   ========================================================================== */

.preview-card,
.chat-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: 100%;
}

.preview-title,
.chat-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #0084ff;
}

/* ==========================================================================
   Preview Area
   ========================================================================== */

.preview-area {
    background: #f0f4f8;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    text-align: center;
    color: #94a3b8;
}

.preview-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.preview-placeholder-text {
    font-size: 1rem;
    margin: 0;
}

.preview-image {
    max-width: 100%;
    max-height: 600px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.preview-actions {
    margin-top: 1rem;
    text-align: center;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.preview-download-btn {
    background: #0084ff;
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.preview-download-btn:hover {
    background: #0A1C43;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
}

.preview-download-btn:active {
    transform: translateY(0);
}

/* Image download button - secondary style */
.preview-download-image {
    background: #ffffff;
    color: #0084ff;
    border: 2px solid #0084ff;
}

.preview-download-image:hover {
    background: #f0f7ff;
    color: #0A1C43;
    border-color: #0A1C43;
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.2);
}

/* PDF download button uses default .preview-download-btn primary styles */

/* ==========================================================================
   Chat Interface Customization
   ========================================================================== */

.chat-interface {
    /* Hide the chat interface visually but keep it in DOM for functionality */
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    
    /* Original properties (kept for reference) */
    /* min-height: 500px; */
}

/* Override AI Engine Pro styles for better integration */
.chat-interface .mwai-chatbot {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.chat-interface .mwai-chat {
    max-height: 600px !important;
    background: #ffffff !important;
}

.chat-interface .mwai-input {
    border-color: #cbd5e0 !important;
}

.chat-interface .mwai-input:focus {
    border-color: #0084ff !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.1) !important;
}

/* Submit button styling */
.chat-interface button[type="submit"],
.chat-interface .mwai-submit {
    background: #0084ff !important;
    color: #ffffff !important;
}

.chat-interface button[type="submit"]:hover,
.chat-interface .mwai-submit:hover {
    background: #0A1C43 !important;
}

/* ==========================================================================
   Page Content Area
   ========================================================================== */

.patch-designer-page-content {
    background: #ffffff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}

.patch-designer-page-content h2,
.patch-designer-page-content h3 {
    color: #2c3e50;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet */
@media (max-width: 968px) {
    .patch-designer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .patch-designer-preview,
    .patch-designer-chat {
        grid-column: 1;
    }
    
    .patch-designer-title {
        font-size: 2rem;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .patch-designer-container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }
    
    .patch-designer-wrapper {
        padding: 1rem;
    }
    
    .patch-designer-title {
        font-size: 1.75rem;
    }
    
    .patch-designer-description {
        font-size: 1rem;
    }
    
    .preview-card,
    .chat-card {
        padding: 1rem;
    }
    
    .preview-area {
        min-height: 300px;
    }
    
    .chat-interface {
        min-height: 400px;
    }
}

/* ==========================================================================
   PATCH DESIGNER BLOCKS STYLING
   ========================================================================== */

/* Block Container Base Styles */
.pd-block {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.pd-block h3,
.pd-block h4 {
    margin: 0;
    font-size: 1.125rem;
    color: #1f2937;
    font-weight: 600;
}

.pd-block {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.pd-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background-color 0.2s ease;
}

/* Make collapsed headers clickable with hover effect */
.pd-block-collapsed .pd-block-header {
  cursor: pointer;
  border-radius: 4px;
}

.pd-block-collapsed .pd-block-header:hover {
  background-color: #f9fafb;
}

.pd-block-collapsed .pd-block-header:active {
  background-color: #f3f4f6;
}

.pd-block-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pd-block-status-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pd-block-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
}

.pd-block-status-complete {
  background: #dcfce7;
  color: #166534;
  max-width: fit-content;
}

.pd-block-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #6b7280;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.pd-block-toggle:focus {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.pd-block-toggle:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.pd-toggle-icon {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.2s ease;
}

.pd-block-collapsed .pd-toggle-icon {
  transform: rotate(-90deg);
}

/* Step Preview */
.pd-step-preview {
  display: none; /* Hidden by default when step is expanded */
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  min-width: 80px;
  max-width: 150px;
}

/* Show preview only when step is collapsed */
.pd-block-collapsed .pd-step-preview {
  display: flex;
}

.pd-preview-thumbnail {
  display: block;
  max-width: 60px;
  max-height: 60px;
  border-radius: 4px;
  object-fit: cover;
  border: 2px solid #e5e7eb;
  visibility: visible;
  opacity: 1;
}

.pd-preview-images {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    justify-content: flex-end;
}

.pd-preview-images .pd-preview-thumbnail {
    max-width: 40px;
    max-height: 40px;
}

.pd-preview-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 999px;
    background: #0ea5e9;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Style thumbnail in preview - smaller than reference image */
.pd-step-preview .pd-style-thumbnail {
  max-width: 50px;
  max-height: 50px;
}

.pd-step-preview .pd-shape-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 4px;
  border: 2px solid #e7e7eb;
}


.pd-preview-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
  text-align: right;
}

.pd-block-body {
    margin-top: 1.25rem;
}

.pd-block-helper {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #475569;
}

.pd-block-collapsed .pd-block-body {
    display: none;
}

.pd-block-complete {
    border-color: #bbf7d0;
}

.pd-block-complete .pd-block-header h4 {
    color: #0A1C43;
}

/* Welcome Block */
.pd-welcome-block {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #bae6fd;
}

.patch-designer-preview .pd-welcome-block {
    margin-bottom: 0;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.pd-welcome-block h3 {
    color: #0369a1;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.pd-welcome-block p {
    color: #475569;
    margin: 0 0 0.75rem 0;
    line-height: 1.6;
}

.pd-steps {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
    color: #334155;
}

.pd-steps li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.pd-tip {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    padding: 0.75rem 1rem;
    margin: 1rem 0 0 0;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #78350f;
}

.pd-tip strong {
    color: #b45309;
}

/* Shape Selector Block */
.pd-shape-selector h4 {
    color: #2c3e50;
}

.pd-shape-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.pd-shape-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    text-align: left;
    min-height: 70px;
}

.pd-shape-btn:hover {
    background: #f3f4f6;
    border-color: #0084ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pd-shape-btn.selected {
    background: #0084ff;
    border-color: #0084ff;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
}

.pd-shape-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-right: 1rem;
    flex-shrink: 0;
}

.pd-shape-thumb {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.pd-shape-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pd-btn-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.pd-shape-label {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
    line-height: 1.2;
}

.pd-shape-description {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.2;
    font-weight: 400;
}

/* Shape Icons using CSS */
.pd-shape-square::before {
    content: "";
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid currentColor;
    border-radius: 4px;
}

.pd-shape-circle::before {
    content: "";
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid currentColor;
    border-radius: 50%;
}

.pd-shape-rectangle::before {
    content: "";
    position: absolute;
    width: 48px;
    height: 28px;
    border: 3px solid currentColor;
    border-radius: 4px;
}

.pd-shape-oval::before {
    content: "";
    position: absolute;
    width: 48px;
    height: 28px;
    border: 3px solid currentColor;
    border-radius: 50%;
}

.pd-shape-custom::before {
    content: "";
    display: block;
    width: 36px;
    height: 36px;
    border: 3px solid currentColor;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    transform: rotate(45deg);
}

.pd-shape-label {
    display: block;
    text-align: center;
    font-size: 0.8125rem;
}

/* Color Picker Block */
.pd-color-picker h4 {
    color: #2c3e50;
}

.pd-color-swatches {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.pd-color-swatch {
    aspect-ratio: 1;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
    padding: 0;
}

.pd-color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #6b7280;
    z-index: 10;
}

.pd-color-swatch.selected {
    border-color: #0084ff;
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.2);
    transform: scale(1.05);
    z-index: 20;
}

.pd-swatch-border {
    position: absolute;
    inset: 2px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    pointer-events: none;
}

.pd-color-name {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: #6b7280;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.pd-color-swatch:hover .pd-color-name {
    opacity: 1;
}

/* Size Input Block */
.pd-size-input h4 {
    color: #2c3e50;
}

.pd-size-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pd-size-field {
    position: relative;
}

.pd-size-field label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    color: #4b5563;
    font-weight: 500;
}

.pd-size-input-field {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    color: #1f2937;
    transition: all 0.2s ease;
}

.pd-size-input-field:focus {
    outline: none;
    border-color: #0084ff;
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.1);
}

.pd-unit {
    position: absolute;
    right: 0.75rem;
    bottom: 0.625rem;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none;
}

.pd-size-submit {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: #0084ff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pd-size-submit:hover {
    background: #0A1C43;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 132, 255, 0.25);
}

.pd-size-submit:active {
    transform: translateY(0);
}

.pd-size-note {
    margin: 0.75rem 0 0 0;
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: center;
}

/* ==========================================================================
   Spec Card Display (Below Preview)
   ========================================================================== */

.pd-spec-card-container {
    margin-top: 1.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pd-spec-card-title {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    border-bottom: 2px solid #0084ff;
    padding-bottom: 0.5rem;
}

.pd-spec-card-content {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #374151;
}

/* Handle both div.spec-card and section.spec-card */
.pd-spec-card-content .spec-card {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.pd-spec-card-content .spec-card h3 {
    display: none; /* Hide duplicate title */
}

.pd-spec-card-content .spec-card strong {
    color: #1f2937;
    font-weight: 600;
}

.pd-spec-card-content .spec-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pd-spec-card-content .spec-card li {
    margin-bottom: 0.75rem;
    padding-left: 0;
}

.pd-spec-card-content .spec-card li:last-child {
    margin-bottom: 0;
}

.pd-spec-card-content .spec-card a {
    color: #0084ff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.pd-spec-card-content .spec-card a:hover {
    color: #0A1C43;
    text-decoration: underline;
}

/* Handle inline spec-card (div with br tags) */
.pd-spec-card-content .spec-card br {
    display: block;
    content: "";
    margin-bottom: 0.5rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .pd-spec-card-container {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .pd-spec-card-title {
        font-size: 1rem;
    }
    
    .pd-spec-card-content {
        font-size: 0.875rem;
    }
}

/* ==========================================================================
   Preview Image Lightbox / Zoom
   ========================================================================== */

/* Make preview image clickable */
.pd-preview-image {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pd-preview-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Lightbox overlay */
.pd-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.pd-lightbox-overlay.pd-active {
    display: flex;
    opacity: 1;
}

/* Lightbox content container */
.pd-lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.pd-lightbox-overlay.pd-active .pd-lightbox-content {
    transform: scale(1);
}

/* Full-size image in lightbox */
.pd-lightbox-image {
    max-width: 100%;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Close button */
.pd-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.pd-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* Download button in lightbox */
.pd-lightbox-download {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 132, 255, 0.9);
    color: #ffffff;
    border: none;
    border-radius: 24px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.pd-lightbox-download:hover {
    background: rgba(0, 132, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.4);
}

.pd-lightbox-download svg {
    width: 16px;
    height: 16px;
}

/* Zoom hint text */
.pd-lightbox-hint {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pd-lightbox-overlay.pd-active .pd-lightbox-hint {
    opacity: 1;
    animation: pd-hint-fade 3s ease forwards;
}

@keyframes pd-hint-fade {
    0%, 80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .pd-lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .pd-lightbox-download {
        bottom: 0.5rem;
        right: 0.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    .pd-lightbox-hint {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}

/* AI Engine Pro Shortcuts Override */
.mwai-chatbot .mwai-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.mwai-chatbot .mwai-shortcut {
    padding: 0.5rem 1rem !important;
    background: #f3f4f6 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 20px !important;
    font-size: 0.875rem !important;
    color: #374151 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
}

.mwai-chatbot .mwai-shortcut:hover {
    background: #0084ff !important;
    border-color: #0084ff !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 132, 255, 0.2) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pd-shape-buttons {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .pd-color-swatches {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
    }
    
    .pd-shape-btn {
        padding: 0.75rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .pd-shape-icon {
        width: 36px;
        height: 36px;
    }
    
    .pd-shape-square::before,
    .pd-shape-circle::before {
        width: 28px;
        height: 28px;
    }
    
    .pd-shape-rectangle::before,
    .pd-shape-oval::before {
        width: 36px;
        height: 20px;
    }
    
    .pd-shape-custom::before {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    .pd-shape-buttons {
        grid-template-columns: 1fr;
    }
    
    .pd-size-fields {
        grid-template-columns: 1fr;
    }
    
    .pd-block {
        padding: 1rem;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.patch-designer-page .hidden {
    display: none !important;
}

.patch-designer-page .loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ==========================================================================
   IMAGE UPLOAD BLOCK STYLING
   ========================================================================== */

/* Upload Block Container */
.pd-upload-block {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.pd-upload-block h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    color: #1f2937;
    font-weight: 600;
}

.pd-upload-description {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Upload Area */
.pd-upload-area {
    position: relative;
    min-height: 200px;
}

/* Dropzone */
.pd-upload-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    background: #f9fafb;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pd-upload-dropzone:hover,
.pd-upload-dropzone.pd-dragover {
    border-color: #0084ff;
    background: #f0fdf4;
}

.pd-upload-icon {
    color: #9ca3af;
    margin: 0 auto 1rem;
    display: block;
}

.pd-upload-dropzone.pd-dragover .pd-upload-icon {
    color: #0084ff;
}

.pd-upload-text {
    font-size: 1rem;
    color: #4b5563;
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

.pd-upload-or {
    font-size: 0.875rem;
    color: #9ca3af;
    margin: 0.5rem 0;
}

.pd-upload-button {
    background: #0084ff;
    color: #ffffff;
    border: none;
    padding: 0.625rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pd-upload-button:hover {
    background: #0A1C43;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 132, 255, 0.25);
}

.pd-upload-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin: 0.75rem 0 0 0;
}

.pd-dropzone {
    margin-top: 1rem;
    padding: 1.25rem;
    border: 2px dashed #cbd5f5;
    border-radius: 10px;
    background: #f5f7fb;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.pd-dropzone:hover,
.pd-dropzone.pd-dragover {
    border-color: #0084ff;
    background: #eef6ff;
}

.pd-dropzone-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pd-dropzone-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
    color: #0084ff;
}

.pd-dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: #374151;
}

.pd-dropzone-meta {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Upload Preview */
.pd-upload-preview {
    text-align: left;
}

.pd-upload-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.pd-upload-count {
    font-size: 0.85rem;
    color: #4b5563;
    font-weight: 600;
}

.pd-upload-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pd-upload-thumb {
    position: relative;
    width: 95px;
    height: 95px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.pd-upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pd-upload-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(15, 23, 42, 0.8);
    color: #fff;
    border: none;
    border-radius: 999px;
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pd-upload-thumb-remove:hover {
    background: rgba(220, 38, 38, 0.9);
}

.pd-upload-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.pd-upload-remove,
.pd-upload-use {
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.pd-upload-remove {
    background: #ef4444;
    color: #ffffff;
}

.pd-upload-remove:hover {
    background: #dc2626;
}

.pd-upload-use {
    background: #0084ff;
    color: #ffffff;
}

.pd-upload-use:hover {
    background: #0A1C43;
}

/* Upload Loading */
.pd-upload-loading {
    text-align: center;
    padding: 2rem 1rem;
}

.pd-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #0084ff;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: pd-spin 0.8s linear infinite;
}

@keyframes pd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pd-upload-loading p {
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 0;
}

/* Upload Error */
.pd-upload-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    color: #991b1b;
    font-size: 0.875rem;
}

/* ==========================================================================
   Step 1: Description + Image Input
   ========================================================================== */

/* Description Section */
.pd-description-section {
    border-top: 1px solid #e5e7eb;
}

.pd-description-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    color: #1f2937;
}

.pd-field-note {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 400;
    margin-left: 0.5rem;
}

.pd-optional-note {
    color: #0084ff;
    font-style: italic;
}

.pd-field-helper {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.pd-step-requirement-note {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #f0f9ff;
    border-left: 3px solid #0084ff;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #1f2937;
    line-height: 1.5;
}

/* Step 1 Actions */
.pd-step1-actions {
    /* margin-top: 1.5rem;
    padding-top: 1.5rem; */
    /* border-top: 1px solid #e5e7eb; */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.pd-step1-confirm-btn {
    padding: 0.75rem 2rem;
    background: #d1d5db;
    color: #9ca3af;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.2s ease;
}

.pd-step1-confirm-btn-enabled {
    background: #0084ff;
    color: #ffffff;
    border-color: #0084ff;
    cursor: pointer;
}

.pd-step1-confirm-btn-enabled:hover {
    background: #0A1C43;
    border-color: #0A1C43;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 132, 255, 0.2);
}

.pd-step1-confirm-btn-enabled:active {
    transform: translateY(0);
}

.pd-step1-status-message {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
}

.pd-step1-status-message.pd-status-success {
    color: #0A1C43;
    background: #dcfce7;
}

.pd-step1-status-message.pd-status-error {
    color: #dc2626;
    background: #fee2e2;
}

.pd-description-textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.pd-description-textarea:focus {
    outline: none;
    border-color: #0084ff;
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.1);
}

.pd-description-textarea::placeholder {
    color: #9ca3af;
}

.pd-description-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.pd-char-count {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Image Section */
.pd-image-section {
    margin-bottom: 1.5rem;
}

.pd-image-section-header {
    margin-bottom: 0.5rem;
}

.pd-image-section-header strong {
    font-size: 0.9375rem;
    color: #1f2937;
}

.pd-image-options {
    display: flex;
    gap: 0.75rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
    justify-content: space-between;
}

.pd-image-option-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #0084ff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pd-image-option-btn:hover {
    background: #0A1C43;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 132, 255, 0.25);
}

.pd-image-option-btn svg {
    flex-shrink: 0;
}

/* Hide camera button on desktop - only show on mobile/tablet */
#pdCameraButton {
    display: none;
}

/* Preview Area Enhancements (in main template) */
.preview-area.has-image {
    border-style: solid;
    border-color: #0084ff;
}

.preview-area.has-image .preview-placeholder {
    display: none;
}

/* Responsive */
@media (max-width: 640px) {
    .pd-upload-dropzone {
        padding: 1.5rem 1rem;
    }
    
    .pd-upload-preview img {
        max-height: 150px;
    }
    
    .pd-upload-actions {
        flex-direction: column;
    }
    
    .pd-upload-remove,
    .pd-upload-use {
        width: 100%;
    }
    
    .pd-image-options {
        flex-direction: column;
    }
    
    .pd-image-option-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Show camera button only on mobile/tablet */
    #pdCameraButton {
        display: inline-flex;
    }
}

/* Tablet range - also show camera button */
@media (min-width: 641px) and (max-width: 1024px) {
    #pdCameraButton {
        display: inline-flex;
    }
}

/* ==========================================================================
   SPEC CARD STYLING
   ========================================================================== */

.pd-spec-card {
    background: linear-gradient(135deg, #f7f7f7 0%, #ecf1ff 100%);
    border: 2px solid #0084ff;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pd-spec-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0A1C43;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #0084ff;
}

.pd-spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
}

.pd-spec-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pd-spec-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.pd-spec-value {
    font-size: 1rem;
    color: #1f2937;
    font-weight: 500;
}

.pd-spec-colors .pd-spec-value {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pd-spec-notes {
    background: #ffffff;
    border-left: 3px solid #0084ff;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.pd-spec-notes .pd-spec-label {
    display: block;
    margin-bottom: 0.5rem;
}

.pd-spec-notes .pd-spec-value {
    margin: 0;
    color: #4b5563;
    line-height: 1.6;
}

.pd-spec-links {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #bbf7d0;
}

.pd-spec-links .pd-spec-label {
    display: block;
    margin-bottom: 0.75rem;
}

.pd-spec-link-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pd-spec-link {
    color: #0084ff;
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.pd-spec-link:hover {
    color: #0A1C43;
    text-decoration: underline;
}

.pd-spec-link::before {
    content: '\2192';
    margin-right: 0.5rem;
    font-weight: 600;
}

/* Legacy button styles (keep for backwards compatibility) */
.pd-spec-link-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pd-spec-link-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #0084ff;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.pd-spec-link-btn:hover {
    background: #0A1C43;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 132, 255, 0.25);
}

/* Account Upload Message */
.pd-account-message {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
    border: 2px solid #0084ff;
    border-radius: 6px;
}

.pd-account-message p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #0A1C43;
}

.pd-account-message a {
    color: #0084ff;
    text-decoration: underline;
    font-weight: 600;
}

.pd-account-message a:hover {
    color: #0062cc;
}

/* Refinement Shortcuts Styling */
.mwai-chatbot .mwai-shortcut[data-variant="warning"] {
    background: #fef3c7 !important;
    border-color: #f59e0b !important;
    color: #92400e !important;
}

.mwai-chatbot .mwai-shortcut[data-variant="warning"]:hover {
    background: #fbbf24 !important;
    border-color: #f59e0b !important;
    color: #ffffff !important;
}

/* Responsive - Spec Card */
@media (max-width: 640px) {
    .pd-spec-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .pd-spec-card {
        padding: 1rem;
    }
    
    .pd-spec-link-buttons {
        flex-direction: column;
    }
    
    .pd-spec-link-btn {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   LOADING STATES & ANIMATIONS
   ========================================================================== */

/* Loading Overlay */
.pd-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.pd-loading-overlay.hidden {
    display: none;
}

/* Spinner */
.pd-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #dcfce7;
    border-top-color: #0084ff;
    border-radius: 50%;
    animation: pd-spin 0.8s linear infinite;
}

@keyframes pd-spin {
    to { transform: rotate(360deg); }
}

.pd-loading-text {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #0A1C43;
    font-weight: 500;
}

/* Progressive Loading Status */
.pd-progressive-status {
    margin-top: 1.5rem;
    width: 100%;
    max-width: 300px;
    text-align: center;
}

.pd-progressive-text {
    font-size: 0.875rem;
    color: #0A1C43;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.pd-progressive-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.pd-progressive-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0084ff 0%, #0066cc 100%);
    border-radius: 3px;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 8px rgba(0, 132, 255, 0.5);
}

.pd-progressive-percent {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 600;
}

/* Button Loading State */
.pd-btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.pd-btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: pd-spin 0.6s linear infinite;
}

/* Fade Transitions */
.pd-fade-in {
    animation: pd-fadeIn 0.3s ease-in;
}

@keyframes pd-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Success/Error States */
.pd-message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pd-message-success {
    background: #d1fae5;
    border: 1px solid #10b981;
    color: #065f46;
}

.pd-message-error {
    background: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

.pd-message-info {
    background: #dbeafe;
    border: 1px solid #3b82f6;
    color: #1e40af;
}

/* Progress Bar */
.pd-progress-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.pd-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0084ff, #22c55e);
    transition: width 0.3s ease;
    animation: pd-progressShimmer 1.5s infinite;
}

@keyframes pd-progressShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Skeleton Loading */
.pd-skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: pd-skeleton 1.5s infinite;
    border-radius: 4px;
}

@keyframes pd-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Tooltip */
.pd-tooltip {
    position: relative;
    display: inline-block;
}

.pd-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #1f2937;
    color: #ffffff;
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.pd-tooltip:hover::after {
    opacity: 1;
}

/* ==========================================================================
   WORKFLOW ENHANCEMENTS
   ========================================================================== */

/* Hide color picker and size input */
.pd-color-picker,
.pd-size-input {
    display: none !important;
}

/* Step indicators */
.pd-steps {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.pd-steps li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6b7280;
    transition: color 0.2s;
}

.pd-steps li.complete {
    color: #0084ff;
    font-weight: 600;
}

.pd-step-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.pd-steps li.complete .pd-step-status {
    background: #0084ff;
    color: #ffffff;
}

/* Style and Garment selectors */
.pd-style-selector,
.pd-garment-selector {
    margin: 1.5rem 0;
}

.pd-style-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.pd-garment-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.pd-style-btn,
.pd-garment-btn {
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 400;
    color: #374151;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pd-style-thumbnail {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.pd-garment-thumb {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pd-garment-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pd-garment-label {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
    line-height: 1.2;
}

.pd-garment-description {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.2;
    font-weight: 400;
}

.pd-style-label {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
    line-height: 1.2;
}

.pd-style-description {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.2;
    font-weight: 400;
}

.pd-style-btn:hover,
.pd-garment-btn:hover {
    border-color: #0084ff;
    background: #f0fdf4;
}

.pd-style-btn.selected,
.pd-garment-btn.selected {
    background: #0084ff;
    border-color: #0084ff;
    color: #ffffff;
}

.pd-style-btn.selected .pd-style-description {
    color: rgba(255, 255, 255, 0.9);
}

/* Style Tooltip */
.pd-style-tooltip {
    position: relative;
}

/* Info Icon */
.pd-info-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    color: #0084ff;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pd-info-icon:hover {
    background: #0084ff;
    color: #ffffff;
    transform: scale(1.1);
}

.pd-info-icon:focus-visible {
    outline: 2px solid #0084ff;
    outline-offset: 2px;
}

.pd-info-icon svg {
    width: 16px;
    height: 16px;
}

.pd-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    background: #ffffff;
    border: 2px solid #0084ff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 132, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    width: 320px;
    max-width: 90vw;
}

.pd-style-btn.pd-tooltip-active .pd-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
    pointer-events: auto;
}

.pd-style-btn.pd-tooltip-active .pd-info-icon {
    background: #0084ff;
    color: #ffffff;
}

.pd-tooltip::before,
.pd-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    pointer-events: none;
}

.pd-tooltip::before {
    top: 100%;
    border-top-color: #ffffff;
    z-index: 1;
}

.pd-tooltip::after {
    top: calc(100% + 2px);
    border-top-color: #0084ff;
    z-index: 0;
}

.pd-tooltip-image {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    display: block;
    max-height: 200px;
    object-fit: cover;
}

.pd-tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: auto;
}

.pd-tooltip-content::after {
    content: none;
}

.pd-tooltip-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0A1C43;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.pd-tooltip-description {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
}

.pd-tooltip-link {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: #0A1C43;
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
    pointer-events: auto;
    cursor: pointer;
}

.pd-tooltip-link:hover {
    background: #1e3a8a;
    transform: translateX(2px);
    color: #ffffff;
    text-decoration: none;
}

.pd-tooltip-link:active {
    transform: translateX(0);
}

/* Custom Instructions (Step 5) */
.pd-custom-instructions {
    margin: 1.5rem 0;
}

.pd-optional-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.pd-custom-instructions-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem;
    margin-top: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s;
}

.pd-custom-instructions-textarea:focus {
    outline: none;
    border-color: #0084ff;
    box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.1);
}

.pd-custom-instructions-textarea::placeholder {
    color: #9ca3af;
}

.pd-instructions-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.pd-char-count {
    font-size: 0.75rem;
    color: #6b7280;
    transition: color 0.2s ease;
}

.pd-char-count.warning {
    color: #f59e0b;
    font-weight: 600;
}

.pd-char-count.error {
    color: #dc2626;
    font-weight: 600;
}

.pd-char-count.pd-char-count-valid {
    color: #0084ff;
    font-weight: 500;
}

.pd-char-count.pd-char-count-invalid {
    color: #dc2626;
}

.pd-clear-instructions-btn {
    padding: 0.375rem 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pd-clear-instructions-btn:hover {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
}

.pd-instructions-examples {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
}

.pd-instructions-examples p {
    margin: 0 0 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.pd-example-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pd-example-btn {
    padding: 0.375rem 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    color: #374151;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pd-example-btn:hover {
    border-color: #0084ff;
    background: #f0fdf4;
    color: #0084ff;
}

.pd-custom-instructions-preview {
    font-style: italic;
    color: #6b7280;
}

/* Generate button */
.pd-generate-block {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #0084ff;
    border-radius: 8px;
}

.pd-generate-btn {
    width: 100%;
    padding: 1rem;
    background: #0084ff;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
}

.pd-generate-btn:not(.disabled):hover {
    background: #0A1C43;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
}

.pd-generate-btn.disabled {
    background: #d1d5db;
    cursor: not-allowed;
    color: #9ca3af;
}

.pd-reset-btn {
    width: 100%;
    padding: 0.75rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pd-reset-btn:hover {
    border-color: #f59e0b;
    background: #fef3c7;
    color: #92400e;
}

/* ==========================================================================
   Loading Overlay & Spinner
   ========================================================================== */

.pd-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.pd-loading-spinner {
    text-align: center;
    padding: 2rem;
}

.pd-spinner-circle {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    border: 4px solid #e5e7eb;
    border-top-color: #0084ff;
    border-radius: 50%;
    animation: pd-spin 1s linear infinite;
}

@keyframes pd-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.pd-loading-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.pd-loading-dots::after {
    content: '';
    animation: pd-dots 1.5s steps(4, end) infinite;
}

@keyframes pd-dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

.pd-loading-time-estimate {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .pd-spinner-circle {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
    }
    
    .pd-loading-text {
        font-size: 1rem;
    }
    
    .pd-loading-time-estimate {
        font-size: 0.8125rem;
    }
}

/* Workflow message */
#pdWorkflowMessage {
    margin-bottom: 1rem;
}

/* ==========================================================================
   Gallery Styles
   ========================================================================== */

/* Gallery Toggle Button */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #0084ff;
}

.preview-header .preview-title {
  margin: 0;
  padding: 0;
  border: none;
}

.pd-gallery-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #0084ff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pd-gallery-toggle-btn:hover {
  background: #0A1C43;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 132, 255, 0.3);
}

.pd-gallery-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* Gallery View Container */
.pd-gallery-view {
  margin-bottom: 1.5rem;
}

.pd-gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e5e7eb;
}

.pd-gallery-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
}

.pd-gallery-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #f3f4f6;
  border: none;
  border-radius: 6px;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pd-gallery-close-btn:hover {
  background: #e5e7eb;
  color: #1f2937;
}

/* Gallery Grid */
.pd-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  min-height: 200px;
  max-height: 500px;
  overflow-y: auto;
  padding: 0.5rem;
}

/* Gallery Item */
.pd-gallery-item {
  position: relative;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pd-gallery-item:hover {
  border-color: #0084ff;
  box-shadow: 0 4px 12px rgba(0, 132, 255, 0.2);
  transform: translateY(-2px);
}

.pd-gallery-thumbnail {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  background: #f3f4f6;
  overflow: hidden;
}

.pd-gallery-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pd-gallery-info {
  padding: 0.75rem;
  background: white;
}

.pd-gallery-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-gallery-date {
  font-size: 0.75rem;
  color: #6b7280;
}

/* Gallery Action Buttons */
.pd-gallery-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.pd-gallery-preview-btn,
.pd-gallery-add-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.pd-gallery-preview-btn {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
}

.pd-gallery-preview-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.pd-gallery-add-btn {
  background: #0084ff;
  color: white;
  border: 1px solid #0A1C43;
}

.pd-gallery-add-btn:hover {
  background: #0A1C43;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 132, 255, 0.3);
}

.pd-gallery-add-btn:disabled,
.pd-gallery-preview-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Button spinner */
.pd-btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: pd-spin 0.6s linear infinite;
}

/* Gallery Delete Button */
.pd-gallery-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 10;
}

.pd-gallery-item:hover .pd-gallery-delete {
  opacity: 1;
}

.pd-gallery-delete:hover {
  background: rgba(220, 38, 38, 1);
  transform: scale(1.1);
}

/* Gallery Loading State */
.pd-gallery-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: #6b7280;
}

.pd-gallery-loading p {
  margin-top: 1rem;
  font-size: 0.875rem;
}

.pd-spinner-small {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #0084ff;
  border-radius: 50%;
  animation: pd-spin 0.8s linear infinite;
}

/* Gallery Empty State */
.pd-gallery-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: #9ca3af;
  text-align: center;
}

.pd-gallery-empty svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.pd-gallery-empty p {
  font-size: 0.875rem;
  color: #6b7280;
}

/* Gallery Messages */
.pd-gallery-message {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  animation: pd-slide-in 0.3s ease;
}

.pd-gallery-message.pd-message-success {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

.pd-gallery-message.pd-message-error {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.pd-gallery-message.pd-message-info {
  background: #dbeafe;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

@keyframes pd-slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Save to Gallery Button */
.preview-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.preview-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #0084ff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-save-btn:hover {
  background: #0A1C43;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
}

.preview-save-btn svg {
  width: 20px;
  height: 20px;
}

.preview-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.pd-spinner-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: pd-spin 0.6s linear infinite;
}

/* Mobile Responsive - Gallery */
@media (max-width: 768px) {
  .pd-gallery-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .pd-gallery-toggle-text {
    display: none;
  }
  
  .pd-gallery-toggle-btn {
    padding: 0.5rem;
  }
  
  .preview-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .preview-save-btn,
  .preview-download-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Step headers on mobile */
  .pd-block-header {
    flex-wrap: wrap;
  }
  
  .pd-step-preview {
    width: 100%;
    justify-content: flex-start;
    margin-top: 0.5rem;
  }
  
  /* Style buttons single column on mobile */
  .pd-style-buttons,
  .pd-garment-buttons {
    grid-template-columns: 1fr;
  }
}

/* Tablet Responsive - Gallery */
@media (min-width: 769px) and (max-width: 1024px) {
  .pd-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ==========================================================================
   Unified AI Composer (Step 1 Redesign)
   ========================================================================== */

.pd-ai-composer {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pd-composer-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.pd-input-wrapper {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.pd-input-wrapper:focus-within,
.pd-input-wrapper.pd-dragover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pd-input-wrapper.pd-dragover {
    background: #f0f9ff;
}

/* Thumbnails inside the wrapper */
.pd-composer-thumbnails {
    padding: 12px 12px 0;
}

.pd-upload-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pd-upload-thumb {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.pd-upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pd-upload-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pd-upload-thumb-remove::before {
    content: "×";
    font-size: 14px;
    line-height: 1;
}

/* Textarea */
.pd-composer-textarea {
    width: 100%;
    border: none;
    padding: 16px;
    min-height: 120px;
    resize: none;
    font-size: 15px;
    line-height: 1.5;
    color: #334155;
    background: transparent;
    outline: none;
}

.pd-composer-textarea::placeholder {
    color: #94a3b8;
}

/* Toolbar */
.pd-composer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.pd-toolbar-actions {
    display: flex;
    gap: 8px;
}

.pd-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.pd-tool-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.pd-tool-btn svg {
    width: 20px;
    height: 20px;
}

.pd-toolbar-status {
    font-size: 12px;
    color: #94a3b8;
}

/* Submit Button Area */
.pd-step1-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pd-step1-confirm-btn {
    width: 100%;
    padding: 12px;
    background: #e2e8f0;
    color: #94a3b8;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.2s;
}

.pd-step1-confirm-btn-enabled {
    background: #3b82f6;
    color: #fff;
    cursor: pointer;
}

.pd-step1-confirm-btn-enabled:hover {
    background: #2563eb;
}

/* Loading & Error */
.pd-upload-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #64748b;
    padding: 8px 0;
}

.pd-upload-error {
    color: #ef4444;
    font-size: 14px;
    padding: 8px 0;
}

/* Hide old elements if they somehow persist or conflict */
.pd-image-section,
.pd-description-section {
    display: none !important;
}




