:root {
    --primary: #1fd655; /* 23 Hour Tees Green */
    --primary-hover: #17b946;
    --primary-dark: #0a7d2f; /* Darker green for text on light backgrounds */
    --primary-glow: rgba(31, 214, 85, 0.2);
    --dark: #000000;
    --dark-surface: #ffffff;
    --glass-border: rgba(0, 0, 0, 0.08);
    --light-text: #111111;
    --gray-text: #555555;
    --border: #e2e2e2;
    --font: 'Outfit', 'Inter', system-ui, sans-serif;
}

/* App Container */
.ht23-app-container {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    color: var(--light-text);
    font-family: var(--font);
    padding: 40px 5%;
    background: #fdfdfd;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--glass-border);
    position: relative;
    overflow: visible; /* Changed from hidden to allow sticky/fixed elements to breathe */
}

.ht23-app-container * {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

.ht23-app-container h1,
.ht23-app-container h2,
.ht23-app-container h3,
.ht23-app-container h4,
.ht23-app-container h5,
.ht23-app-container p,
.ht23-app-container label {
    color: var(--light-text) !important;
    margin-top: 0;
}

.ht23-app-container p {
    color: var(--gray-text) !important;
}

/* Header & Stepper */
.ht23-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative; /* For native back button positioning */
}

.ht23-floating-back-btn {
    background: #f8fafc !important;
    color: #64748b !important;
    border-radius: 14px !important;
    height: 54px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 0 20px !important;
    margin: 0 !important;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.2s;
    display: none !important;
    flex: 0 0 auto !important; /* Don't grow, just take needed space */
}

.ht23-floating-back-btn.visible {
    display: flex !important;
}

.ht23-floating-back-btn:hover {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

.ht23-header h2 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 45px; /* Prevent text overlap with back button */
}

.ht23-stepper-indicator {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    margin-bottom: 50px;
    height: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.step-line-bg {
    position: absolute;
    top: 50%;
    left: 5%;
    right: 5%;
    height: 4px;
    background: #f0f0f0;
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 4px;
}

.step-line-progress {
    height: 100%;
    background: var(--primary);
    width: 20%;
    transition: width 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 15px var(--primary-glow);
    border-radius: 4px;
}

.step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #888;
    position: relative;
    z-index: 2;
    transition: all 0.4s ease;
    cursor: pointer;
}

/* Step numbers will show naturally since we aren't overriding content */
.step-dot.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000 !important;
    transform: scale(1.2);
    box-shadow: 0 0 20px var(--primary-glow);
}

.step-dot.completed {
    background: var(--primary);
    border-color: var(--primary);
    color: #000 !important;
}





/* Steps */
.ht23-step {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.ht23-step.active {
    display: block;
}

.ht23-step h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

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

/* ── Grid ────────────────────────────────────────────────────────────────── */
.ht23-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* ── Product Card ────────────────────────────────────────────────────────── */
.ht23-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
                box-shadow 0.25s cubic-bezier(0.25, 0.8, 0.25, 1),
                border-color 0.25s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.ht23-card:hover {
    border-color: rgba(31, 214, 85, 0.6);
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(31,214,85,0.3);
}

.ht23-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), 0 16px 40px var(--primary-glow);
    transform: translateY(-6px);
}

/* ── Card image area — portrait ratio, bleeds to top edge ────────────────── */
.card-icon {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #ffffff;
    border-radius: 16px 16px 0 0;
    margin-bottom: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-icon img,
.product-grid-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 15%;
    transition: transform 0.35s ease;
    display: block;
}

.ht23-card:hover .card-icon img,
.ht23-card:hover .product-grid-img {
    transform: scale(1.06);
}

/* ── Card body ───────────────────────────────────────────────────────────── */
.ht23-card-body {
    padding: 16px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.ht23-card h4 {
    color: #1a1a2e !important;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 4px;
}

.ht23-card p {
    color: #888 !important;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

/* Hover CTA overlay */
.ht23-card .card-cta {
    margin-top: 10px;
    background: var(--primary);
    color: #000;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.ht23-card:hover .card-cta {
    opacity: 1;
    transform: translateY(0);
}

/* Tier badge */
.tier-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Tier badge colors driven by admin settings via CSS vars in frontend-app.php */
.tier-badge.good   { background: var(--tier-good,   #f59e0b); color: #fff; }
.tier-badge.better { background: var(--tier-better, #1fd655); color: #fff; }
.tier-badge.best   { background: var(--tier-best,   #6366f1); color: #fff; }

/* Category Pill Nav */
.ht23-category-pill-nav {
    margin-bottom: 25px;
    padding: 5px;
    background: #f1f1f1;
    border-radius: 50px;
    display: inline-flex !important;
}

.category-pill {
    padding: 10px 24px;
    border-radius: 50px;
    border: 1px solid #ddd;
    background: #fff;
    color: var(--gray-text);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.category-pill:hover {
    color: var(--primary-dark);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.category-pill.active {
    background: var(--primary);
    color: #000 !important;
    border-color: var(--primary);
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Quality Filter UI */
.ht23-quality-filter {
    background: #f8fafc;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.tier-filter {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tier-filter:hover {
    background: #fff;
    color: #1e293b;
}

.tier-filter.active {
    background: #fff;
    color: #1fd655;
    border-color: #e2e8f0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.tier-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.tier-dot.good   { background: var(--tier-good,   #f59e0b); }
.tier-dot.better { background: var(--tier-better, #1fd655); }
.tier-dot.best   { background: var(--tier-best,   #6366f1); }

/* Color Swatches */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 30px 15px; /* Added significant vertical gap for labels */
    margin-top: 30px;
    justify-content: center;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.swatch {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #eee;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.swatch:hover {
    transform: scale(1.15) translateY(-2px);
    border-color: rgba(255,255,255,0.5);
    z-index: 2;
}

.swatch.selected {
    border-color: var(--primary);
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--primary), 0 0 15px var(--primary-glow);
}

/* Sizing Chart */
.ht23-sizing-chart {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.size-input-group {
    background: var(--dark-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    flex: 1 1 80px;
}

.size-input-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.size-input-group input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--light-text);
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 1.1rem;
    font-family: inherit;
}

.total-qty {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: right;
    color: var(--primary-dark);
}

/* =========================================
   Design Studio — Step 4
   ========================================= */
.ht23-designer-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 680px) {
    .ht23-designer-layout { grid-template-columns: 1fr; }
}

.ht23-logo-panel h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.logo-zone-item {
    background: var(--dark-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

/* Mockup */
.ht23-mockup-panel {
    position: sticky;
    top: 20px;
}

.mockup-view-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: center;
}

.mockup-view-btn {
    flex: 1;
    padding: 10px 0;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--gray-text);
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mockup-view-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--light-text);
}

.mockup-view-btn.active {
    border-color: var(--primary) !important;
    background: var(--primary) !important;
    color: #000 !important;
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Mockup Designer Layout */
.design-studio-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.design-controls {
    width: 300px;
    min-width: 280px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mockup-container {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    position: relative;
    height: 430px;
    max-height: 430px;
    min-height: 430px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

/* ── Sizing Matrix Table ─────────────────────────────────────── */
.ht23-size-matrix-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.ht23-size-group {
    margin-bottom: 24px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.ht23-size-group-title {
    background: #f8fafc;
    margin: 0;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
}

.ht23-size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0;
    padding: 0;
}

.ht23-size-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.ht23-size-item label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.dyn-size-qty {
    width: 60px;
    text-align: center;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
}

.dyn-size-qty:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(31,214,85,0.1);
}

.order-summary-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border: 1px dashed rgba(31, 214, 85, 0.15);
    border-radius: 12px;
    pointer-events: none;
    z-index: 5;
}

#garment-display {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

#garment-display svg {
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
}

.logo-overlay {
    position: absolute;
    cursor: move;
    user-select: none;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    transition: border 0.2s;
}
.logo-overlay.selected {
    outline: 2px dashed var(--primary) !important;
    outline-offset: 4px;
    background: rgba(31, 214, 85, 0.05);
    border: none;
}

/* Isolation Logic */
/* Persistent Quick Fit - Always available as a safety net */
.ht23-quick-fit-container {
    opacity: 0.8 !important;
}
.ht23-quick-fit-container:hover {
    opacity: 1 !important;
}

/* Ensure Mockup Canvas is visible */
#mockup-canvas {
    background: #ffffff !important;
    min-height: 450px;
}
.logo-overlay img {
    width: 100%;
    height: 100%;
    pointer-events: none;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.logo-overlay.text-layer {
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.logo-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('https://www.transparenttextures.com/patterns/fabric-of-the-nation.png');
    opacity: 0.1;
    pointer-events: none;
    mix-blend-mode: multiply;
}
.resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: 2px solid white;
    border-radius: 50%;
    bottom: -7px;
    right: -7px;
    cursor: nwse-resize;
    display: none;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.logo-overlay.selected .resize-handle {
    display: block;
}
.layer-delete-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: #ff4d4d;
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 11;
}
.logo-overlay.selected .layer-delete-btn {
    display: flex;
}
.ht23-layer-controls {
    margin-top: 20px;
    padding: 15px;
    background: var(--dark-surface);
    border: 1px solid #333;
    border-radius: 12px;
    display: none;
}
.ht23-layer-controls.active {
    display: block;
}
.font-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.font-btn {
    padding: 8px;
    background: #252525;
    border: 1px solid #333;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}
.font-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-dark);
}
/* Brands Grid Styling */
.ht23-brands-grid-wrapper {
    margin: 40px 0;
    padding: 30px;
    background: var(--dark-surface);
    border: 1px solid #222;
    border-radius: 20px;
}
.ht23-brands-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 30px 40px;
}
.brand-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
}
.ht23-brand-logo {
    max-height: 80px;
    max-width: 140px;
    object-fit: contain;
    filter: none !important;
    opacity: 1 !important;
    transition: transform 0.3s ease;
}
.ht23-brand-card:hover .ht23-brand-logo {
    transform: scale(1.1);
}
.ht23-brand-name {
    font-weight: 700;
    color: #333;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.brand-name {
    font-weight: 700;
    color: #444;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: color 0.3s;
}
.brand-item:hover .brand-name {
    color: var(--primary-color);
}

/* Forms & Buttons */
.ht23-select {
    width: 100%;
    padding: 12px;
    background: var(--dark-surface);
    border: 1px solid var(--border);
    color: var(--light-text);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    margin-top: 10px;
}

.ht23-form-group {
    margin-bottom: 15px;
}

.ht23-form-group input,
.ht23-form-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--dark-surface);
    border: 1px solid var(--border);
    color: var(--light-text);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
}

.ht23-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 50px;
    border-top: 1px solid var(--border);
    padding: 30px 20px;
    background: rgba(255,255,255,0.02);
    border-radius: 0 0 16px 16px;
}
/* When Back is hidden, push Next to the right */
.ht23-footer #btn-prev[style*="display:none"] + #btn-next,
.ht23-footer #btn-prev:not([style]) + #btn-next {
    margin-left: auto;
}
/* btn-next is hidden by default — JS shows it on steps 2-4 only.
   Prevents flash-of-button during page load on step 1. */
#btn-next { display: none; }
@media (max-width: 768px) {
    .ht23-footer {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 10px;
    }
    .ht23-footer .ht23-btn {
        width: auto;
    }
    .ht23-footer #btn-next {
        flex: 1;
    }
    .ht23-footer #btn-prev {
        flex: 0 0 auto;
    }
    .ht23-footer #btn-prev[style*="display:none"] + #btn-next {
        margin-left: 0;
    }
}

.ht23-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff;
}

.ht23-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, #17b946 100%);
    color: #053b11 !important; /* Dark green text for better contrast on neon light green */
    box-shadow: 0 4px 15px var(--primary-glow);
}

.ht23-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
    filter: brightness(1.1);
}

.ht23-btn.secondary {
    background: #ffffff;
    color: var(--light-text);
    border: 1px solid var(--border);
}

.ht23-btn.secondary:hover:not(:disabled) {
    background: #f7f7f9;
    border-color: #d0d0d0;
    transform: translateY(-2px);
}

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

.ht23-btn.outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    display: inline-block;
}

.ht23-btn.outline:hover {
    background: rgba(31, 214, 85, 0.1);
}

.full-width {
    width: 100%;
}

.ht23-review-box {
    background: var(--dark-surface);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.ht23-review-box p {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

/* =========================================
   Success Screen
   ========================================= */
.ht23-success-screen {
    text-align: center;
    padding: 50px 30px;
    animation: fadeIn 0.5s ease-in-out;
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: #053b11;
    font-size: 2.5rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 0 40px rgba(31, 214, 85, 0.45);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.ht23-success-screen h2 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 8px;
}

.success-sub {
    color: var(--gray-text);
    font-size: 1.05rem;
    margin-bottom: 30px;
}

.success-ref-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--dark-surface);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 18px 40px;
    margin-bottom: 24px;
    box-shadow: 0 0 20px rgba(31, 214, 85, 0.15);
}

.success-ref-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--gray-text);
    margin-bottom: 6px;
}

.success-ref-num {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 2px;
    font-family: monospace;
}

.success-note {
    color: var(--gray-text);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

/* 🏷️ Professional Brand Grid & Image Healing UI */
.ht23-brand-grid {
    padding: 10px 0;
}
.brand-pill {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}
.brand-pill:hover {
    border-color: #1fd655 !important;
    background: rgba(31, 214, 85, 0.02) !important;
    transform: translateY(-4px);
}
.brand-pill img {
    transition: all 0.3s ease;
}
.brand-pill:hover img {
    opacity: 1 !important;
    filter: grayscale(0) !important;
}
.brand-pill.active {
    border-color: #1fd655 !important;
    background: #000 !important;
    box-shadow: 0 4px 15px rgba(31, 214, 85, 0.2);
}
.brand-pill.active span { color: #fff !important; }
.brand-pill.active img { opacity: 1 !important; filter: grayscale(0) invert(1); }

@keyframes ht23Pulse {
    0% { opacity: 0.3; }
    50% { opacity: 0.6; }
    100% { opacity: 0.3; }
}
.product-grid-img.ht23-searching {
    animation: ht23Pulse 1.5s infinite ease-in-out;
}

/* =========================================
   Step 2 — Live Color Picker Layout
   ========================================= */
.ht23-color-picker-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 24px;
    align-items: start;
}

/* LEFT pane: preview image */
.color-preview-pane {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-preview-img-wrap {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(0,0,0,0.06);
    position: relative;
}

.color-preview-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.25s ease;
}

/* Bottom bar: color name + view toggles */
.color-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 4px;
}

.color-preview-view-btns {
    display: flex;
    gap: 6px;
}

.color-view-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--gray-text);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-view-btn:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.color-view-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    box-shadow: 0 2px 10px var(--primary-glow);
}

/* RIGHT pane: swatch grid — fits all colors without scrolling */
.color-swatches-pane {
    /* no overflow: let it grow naturally */
}
#color-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 10px 8px;
    align-items: start;
}


/* ── Responsive adjustments (Must be at the end to override base styles) ──────────────── */

@media (max-width: 1024px) {
    .ht23-grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* Design Studio UI Components */
.ht23-design-tools-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    margin-bottom: 16px;
}
.ht23-box-header { margin-bottom: 15px; }
.ht23-box-title { margin: 0 !important; font-size: 1rem !important; font-weight: 800 !important; color: #1e293b !important; }
.ht23-tool-grid { display: flex; gap: 12px; }
.ht23-tool-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ht23-tool-btn:hover { border-color: var(--primary); background: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.ht23-tool-btn:active { transform: scale(0.96); }
.ht23-tool-icon { font-size: 1.6rem; line-height: 1; }
.ht23-tool-label { font-size: 0.8rem; font-weight: 700; color: #475569; }

/* Layer List Native UI */
.ht23-layer-item {
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    color: #334155;
}
.ht23-layer-item:hover {
    background: #fff;
    border-color: var(--primary);
    transform: translateX(4px);
}
.ht23-layer-item.selected {
    background: #f0fdf4;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(31,214,85,0.1);
    transform: translateX(4px);
}



@media (max-width: 768px) {
    .step-line { width: 20px; }
    .ht23-app-container { 
        padding: 15px; 
        border-radius: 0; 
        margin: 0;
        box-shadow: none;
        border: none;
        min-height: auto;
    }
    .ht23-header h2 { font-size: 1.4rem; margin-bottom: 20px; }
    .ht23-stepper-indicator { margin-bottom: 30px; padding: 0 10px; }
    .step-dot { width: 34px; height: 34px; font-size: 1rem; }
    
    .design-studio-layout {
        flex-direction: column;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
    }
    
    .mockup-section {
        width: 100% !important;
    }

    .mockup-section > div:first-child {
        width: 100% !important;
        display: flex;
    }

    .mockup-view-btn {
        flex: 1 !important;
        white-space: nowrap;
    }

    .design-controls {
        width: 100%;
        max-width: none;
        padding-left: 0 !important;
        border-left: none !important;
        padding-bottom: 10px; /* Removed old 100px padding */
    }
    
    .quality-options {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Inline Mobile Action Bar */
    .ht23-action-bar {
        position: relative !important;
        width: 100% !important;
        background: transparent !important;
        backdrop-filter: none !important;
        padding: 15px 0 0 0 !important;
        align-items: center !important;
        gap: 10px !important;
        box-shadow: none !important;
        z-index: 10 !important;
        margin-top: 0 !important;
        border-top: 1px solid #e2e8f0;
        border-radius: 0 !important;
        display: flex;
    }

    .ht23-action-bar .ht23-btn.primary {
        background: var(--primary) !important;
        color: #000 !important;
        border-radius: 12px !important;
        height: 50px !important;
        font-weight: 800 !important;
        flex: 1 !important;
        box-shadow: 0 4px 12px var(--primary-glow) !important;
        margin: 0 !important;
    }

    /* Fullscreen Design Studio Mobile Experience */
    body.ht23-mobile-design-active {
        overflow: hidden !important;
    }
    #ht23-design-modal {
        display: none !important;
    }
    #ht23-design-modal.active {
        display: flex !important;
        flex-direction: column !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* modern fallback */
        z-index: 999999 !important;
        background: #f8fafc !important;
        padding: 10px 10px calc(85px + env(safe-area-inset-bottom)) 10px !important; /* reduced padding since buttons are side-by-side */
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    #ht23-design-modal.active .ht23-step#step-3 {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
        height: 100% !important;
    }
    #ht23-design-modal.active .ht23-step#step-3 h3 {
        display: none !important;
    }
    #ht23-design-modal.active .ht23-step#step-3 .design-studio-layout {
        flex: 1 !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        height: 100% !important;
    }
    #ht23-design-modal.active .ht23-step#step-3 .mockup-section {
        flex: 1 !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    #ht23-design-modal.active .ht23-step#step-3 #mockup-canvas {
        flex: 1 !important;
        min-height: 0 !important;
        max-height: none !important; /* override inline 500px limit */
        height: 100% !important;
        aspect-ratio: auto !important;
        margin: 0 !important;
    }
    #ht23-design-modal.active .ht23-step#step-3 #garment-display {
        padding: 0 !important;
    }
    #ht23-design-modal.active .ht23-step#step-3 .design-controls {
        flex: 0 0 35% !important;
        max-height: 280px !important; /* reduced from 320 to give more room to the garment */
        min-height: 0 !important;
        overflow-y: auto !important;
        padding-bottom: 20px !important;
    }
    #ht23-design-modal.active .ht23-footer {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 9999999 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        padding: 10px 15px calc(15px + env(safe-area-inset-bottom)) 15px !important;
        margin: 0 !important;
        border-top: 1px solid #e2e8f0 !important;
        display: flex !important;
    }
    #ht23-design-modal.active .ht23-action-bar {
        width: 100% !important;
        background: transparent !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .ht23-floating-back-btn {
        flex: 0 0 auto !important;
        height: 50px !important;
        border-radius: 12px !important;
        background: #f1f5f9 !important;
        border: none !important;
    }

    .design-controls > div {
        border-radius: 16px !important;
        padding: 15px !important;
        margin-bottom: 15px !important;
    }

    .ht23-grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .ht23-grid-3 {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    .ht23-card h4 {
        font-size: 1.1rem !important;
    }
    .ht23-card p {
        font-size: 0.8rem !important;
    }
    .ht23-cat-hero-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .ht23-color-picker-layout {
        grid-template-columns: 1fr;
        gap: 0; /* Remove the massive 30px gap on mobile */
    }
    .color-preview-img-wrap {
        aspect-ratio: 4 / 3;
    }

    /* Horizontal scrolling for color swatches */
    .color-swatches-pane {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-top: 5px; /* Prevent selected swatch scale from clipping at top */
        padding-bottom: 5px; /* Minimal space for scrollbar */
        margin-top: 0px;
        /* UI cue: Right fade effect to indicate scrolling */
        mask-image: linear-gradient(to right, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    }

    #color-swatches {
        display: flex !important;
        flex-wrap: nowrap !important;
        width: max-content;
        gap: 12px !important;
        padding-left: 10px; /* Prevent left shadow clipping */
        padding-right: 40px; /* Padding at end of scroll so last item isn't faded */
    }

    #color-swatches > div {
        flex-shrink: 0;
        width: 44px; /* container width for swatch + text */
    }

    #color-swatches > div span {
        width: 100% !important;
    }

    .swatch {
        width: 36px !important;
        height: 36px !important;
        flex-shrink: 0;
    }

    /* Design Studio Layout Optimizations */
    #mockup-canvas {
        width: 100% !important;
        min-height: auto !important;
        max-height: none !important;
        aspect-ratio: 1 / 1 !important;
        height: auto !important;
        margin: 0 auto !important;
    }

    .ht23-tool-btn {
        flex-direction: row !important;
        padding: 12px !important;
        justify-content: center;
    }
    .ht23-tool-icon {
        font-size: 1.2rem !important;
    }
    .ht23-tool-label {
        font-size: 0.9rem !important;
    }
}
