/* ─── Amrod Product Order Widget ─────────────────────────────────────────── */
:root {
    --amrod-accent: #00b4d8;
    --amrod-accent-dark: #0096b7;
    --amrod-text: #1a1a2e;
    --amrod-muted: #6b7280;
    --amrod-border: #e5e7eb;
    --amrod-bg: #ffffff;
    --amrod-bg-alt: #f8f9fa;
    --amrod-success: #10b981;
    --amrod-warning: #f59e0b;
    --amrod-danger: #ef4444;
    --amrod-radius: 12px;
    --amrod-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
}

.amrod-order-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--amrod-text);
    max-width: 1200px;
    margin: 0 auto;
}

/* ─── Loading ────────────────────────────────────────────────────────────── */
.amrod-order-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--amrod-muted);
    font-size: 15px;
    gap: 12px;
}
.amrod-spinner {
    width: 22px; height: 22px;
    border: 3px solid var(--amrod-border);
    border-top-color: var(--amrod-accent);
    border-radius: 50%;
    animation: amrod-spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes amrod-spin { to { transform: rotate(360deg); } }

/* ─── Step accordion ─────────────────────────────────────────────────────── */
.amrod-step {
    background: var(--amrod-bg);
    border: 1px solid var(--amrod-border);
    border-radius: var(--amrod-radius);
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--amrod-shadow);
    transition: box-shadow 0.2s;
}
.amrod-step.is-active { box-shadow: 0 4px 20px rgba(0,180,216,.12); }

.amrod-step-header {
    display: flex;
    align-items: center;
    padding: 18px 24px;
    cursor: pointer;
    user-select: none;
    gap: 14px;
}
.amrod-step-header:hover { background: rgba(0,180,216,.03); }

/* Future locked steps — not yet reachable */
.amrod-step:not(.is-active):not(.is-done) .amrod-step-header {
    cursor: default;
    pointer-events: none;
}
/* Completed steps — clickable to go back and edit */
.amrod-step.is-done .amrod-step-header {
    cursor: pointer;
}
.amrod-step.is-done .amrod-step-header:hover {
    background: rgba(0,180,216,.05);
}
.amrod-step.is-done .amrod-step-title {
    color: var(--amrod-text);
}

.amrod-step-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--amrod-border);
    color: var(--amrod-muted);
    font-weight: 700;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.amrod-step.is-active .amrod-step-num,
.amrod-step.is-done .amrod-step-num {
    background: var(--amrod-accent);
    color: #fff;
}
.amrod-step.is-done .amrod-step-num::after { content: '✓'; }
.amrod-step.is-done .amrod-step-num span { display: none; }

.amrod-step-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: var(--amrod-text);
}
.amrod-step:not(.is-active) .amrod-step-title { color: var(--amrod-muted); }

.amrod-step-chevron {
    color: var(--amrod-muted);
    transition: transform 0.2s;
}
.amrod-step.is-active .amrod-step-chevron { transform: rotate(180deg); }

.amrod-step-body {
    display: none;
    padding: 0 24px 24px;
    border-top: 1px solid var(--amrod-border);
}
.amrod-step.is-active .amrod-step-body { display: block; }

/* ─── Step 1: Colour swatches ────────────────────────────────────────────── */
.amrod-colour-groups {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    padding-top: 20px;
}
.amrod-colour-group { flex: 1; min-width: 220px; }
.amrod-colour-group-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--amrod-accent);
    margin-bottom: 4px;
}
.amrod-colour-group-code {
    font-size: 13px;
    color: var(--amrod-muted);
    margin-bottom: 12px;
}
.amrod-colour-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.amrod-colour-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 6px;
}
.amrod-swatch-img {
    width: 60px; height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--amrod-border);
    background: var(--amrod-bg-alt);
    transition: border-color 0.15s, transform 0.15s;
}
.amrod-swatch-img img { width: 100%; height: 100%; object-fit: cover; }
.amrod-colour-swatch:hover .amrod-swatch-img { border-color: var(--amrod-accent); transform: translateY(-2px); }
.amrod-colour-swatch.selected .amrod-swatch-img {
    border-color: var(--amrod-accent);
    box-shadow: 0 0 0 2px var(--amrod-accent);
}
.amrod-swatch-stock {
    font-size: 11px;
    color: var(--amrod-muted);
    font-weight: 500;
}

/* ─── Step 2: Quantity tables ────────────────────────────────────────────── */
.amrod-qty-groups {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding-top: 20px;
}
.amrod-qty-group { flex: 1; min-width: 300px; }
.amrod-qty-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.amrod-qty-group-img {
    width: 48px; height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--amrod-border);
}
.amrod-qty-group-name {
    font-weight: 600;
    font-size: 15px;
}

.amrod-qty-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.amrod-qty-table th {
    background: var(--amrod-accent);
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}
.amrod-qty-table th.right { text-align: right; }
.amrod-qty-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--amrod-border);
    vertical-align: middle;
}
.amrod-qty-table tr:last-child td { border-bottom: none; }
.amrod-qty-table tr:hover td { background: rgba(0,180,216,.03); }

.amrod-qty-input {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid var(--amrod-border);
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    transition: border-color 0.15s;
}
.amrod-qty-input:focus {
    outline: none;
    border-color: var(--amrod-accent);
    box-shadow: 0 0 0 2px rgba(0,180,216,.15);
}

.amrod-stock-count { font-weight: 700; color: var(--amrod-text); }
.amrod-incoming-eta { color: var(--amrod-danger); font-size: 12px; }
.amrod-price-cell { color: var(--amrod-text); font-weight: 500; }

/* ─── Step 3: Branding ───────────────────────────────────────────────────── */
.amrod-branding-header {
    display: flex;
    gap: 20px;
    padding-top: 20px;
    align-items: flex-start;
}
.amrod-branding-guide-preview {
    flex-shrink: 0;
    width: 200px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--amrod-border);
    background: #1a1a2e;
}
.amrod-branding-guide-preview img { width: 100%; display: block; }
.amrod-branding-guide-btn {
    display: block;
    background: var(--amrod-accent);
    color: #fff !important;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.15s;
}
.amrod-branding-guide-btn:hover { background: var(--amrod-accent-dark); }

.amrod-branding-positions-panel { flex: 1; }

.amrod-branding-hint {
    font-size: 13px;
    color: var(--amrod-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.amrod-branding-hint .amrod-icon { color: var(--amrod-accent); font-size: 16px; }

.amrod-inclusive-note {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #166534;
    margin-bottom: 16px;
}

.amrod-position-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.amrod-pos-btn {
    padding: 8px 14px;
    border: 2px solid var(--amrod-accent);
    border-radius: 6px;
    background: transparent;
    color: var(--amrod-accent);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.amrod-pos-btn:hover,
.amrod-pos-btn.active {
    background: var(--amrod-accent);
    color: #fff;
}
.amrod-pos-btn.required-pos { position: relative; }
.amrod-pos-btn.required-pos::after {
    content: '★';
    font-size: 9px;
    position: absolute;
    top: -4px; right: -4px;
    background: var(--amrod-danger);
    color: #fff;
    border-radius: 50%;
    width: 14px; height: 14px;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}

.amrod-position-config {
    background: var(--amrod-bg-alt);
    border: 1px solid var(--amrod-border);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 16px;
}
.amrod-position-config-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--amrod-accent);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--amrod-border);
}

.amrod-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.amrod-field { display: flex; flex-direction: column; gap: 5px; }
.amrod-field label { font-size: 12px; font-weight: 600; color: var(--amrod-muted); text-transform: uppercase; letter-spacing: .05em; }
.amrod-field select,
.amrod-field input[type="number"],
.amrod-field textarea {
    padding: 8px 10px;
    border: 1px solid var(--amrod-border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.amrod-field select:focus,
.amrod-field input:focus,
.amrod-field textarea:focus {
    outline: none;
    border-color: var(--amrod-accent);
    box-shadow: 0 0 0 2px rgba(0,180,216,.15);
}
.amrod-field textarea { resize: vertical; min-height: 70px; }
.amrod-field-full { grid-column: 1 / -1; }

.amrod-artwork-upload-area {
    border: 2px dashed var(--amrod-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #fff;
}
.amrod-artwork-upload-area:hover { border-color: var(--amrod-accent); background: rgba(0,180,216,.03); }
.amrod-artwork-upload-area.has-file { border-color: var(--amrod-success); background: #f0fdf4; }
.amrod-artwork-upload-area .upload-icon { font-size: 24px; margin-bottom: 6px; }
.amrod-artwork-upload-area p { margin: 0; font-size: 13px; color: var(--amrod-muted); }
.amrod-artwork-upload-area input[type="file"] { display: none; }
.amrod-artwork-filename { font-size: 12px; color: var(--amrod-success); margin-top: 4px; }

.amrod-template-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.amrod-template-link {
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--amrod-border);
    border-radius: 5px;
    color: var(--amrod-muted);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
    display: flex; align-items: center; gap: 5px;
}
.amrod-template-link:hover { border-color: var(--amrod-accent); color: var(--amrod-accent); }

/* ─── Step 4: Order summary ──────────────────────────────────────────────── */
.amrod-summary {
    padding-top: 20px;
}
.amrod-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 16px;
}
.amrod-summary-table th {
    background: #f1f5f9;
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--amrod-muted);
    border-bottom: 2px solid var(--amrod-border);
}
.amrod-summary-table th.right,
.amrod-summary-table td.right { text-align: right; }
.amrod-summary-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--amrod-border);
    vertical-align: middle;
}
.amrod-summary-table .product-section-header td {
    background: #e0f7fa;
    font-weight: 700;
    color: var(--amrod-text);
    padding-left: 14px;
}
.amrod-summary-table .product-img-cell {
    width: 50px;
    padding-right: 0;
}
.amrod-summary-table .product-img-cell img {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--amrod-border);
}
.amrod-summary-branding-row td { background: #f8fffe; font-size: 12px; }
.amrod-summary-branding-row td:first-child { padding-left: 28px; color: var(--amrod-muted); }
.amrod-upload-btn {
    background: #e91e8c;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.amrod-upload-btn:hover { background: #c01778; }

.amrod-summary-subtotal {
    display: flex;
    justify-content: flex-end;
    font-size: 15px;
    font-weight: 700;
    margin: 8px 0 4px;
    padding: 10px 14px;
    background: var(--amrod-bg-alt);
    border-radius: 8px;
}
.amrod-summary-subtotal span { color: var(--amrod-accent); margin-left: 12px; }

.amrod-lead-time {
    background: #e0f7fa;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--amrod-text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.amrod-lead-time-days {
    background: var(--amrod-accent);
    color: #fff;
    font-weight: 700;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 14px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.amrod-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    text-decoration: none;
    gap: 8px;
}
.amrod-btn:active { transform: translateY(1px); }
.amrod-btn-primary {
    background: var(--amrod-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,180,216,.3);
}
.amrod-btn-primary:hover { background: var(--amrod-accent-dark); box-shadow: 0 6px 16px rgba(0,180,216,.4); }
.amrod-btn-secondary {
    background: transparent;
    color: var(--amrod-text);
    border: 2px solid var(--amrod-border);
}
.amrod-btn-secondary:hover { border-color: var(--amrod-accent); color: var(--amrod-accent); }
.amrod-btn-outline-danger {
    background: transparent;
    color: var(--amrod-muted);
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    text-decoration: underline;
}
.amrod-btn-outline-danger:hover { color: var(--amrod-danger); }

.amrod-step-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.amrod-required-note {
    font-size: 12px;
    color: var(--amrod-muted);
    margin-bottom: 12px;
}
.amrod-required-note strong { color: var(--amrod-danger); }

.amrod-no-branding-link {
    font-size: 13px;
    color: var(--amrod-accent);
    cursor: pointer;
    text-decoration: underline;
    margin-left: auto;
}
.amrod-no-branding-link:hover { color: var(--amrod-accent-dark); }

.amrod-swatch-name {
    font-size: 10px;
    color: var(--amrod-text);
    text-align: center;
    max-width: 64px;
    word-break: break-word;
    line-height: 1.2;
}
.amrod-colour-swatch.selected .amrod-swatch-name { font-weight: 700; color: var(--amrod-accent-dark); }

/* Fallback when no image — show a named colour tile */
.amrod-swatch-colour-box {
    width: 60px; height: 60px;
    border-radius: 8px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #4a5568;
    letter-spacing: 0.04em;
    border: 1px solid var(--amrod-border);
}

/* has-selection teal fill on position buttons */
.amrod-pos-btn.has-selection {
    background: var(--amrod-accent-dark);
    border-color: var(--amrod-accent-dark);
    color: #fff;
}
.amrod-pos-btn.has-selection::after {
    content: ' ✓';
}

/* ─── Multi-group colour tabs (Mens / Ladies etc) ────────────────────────── */
.amrod-colour-tabs-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--amrod-border);
    padding-bottom: 0;
}
.amrod-colour-tab {
    padding: 8px 20px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--amrod-muted);
    cursor: pointer;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.amrod-colour-tab.active {
    color: var(--amrod-accent);
    border-bottom-color: var(--amrod-accent);
}
.amrod-colour-tab:hover { color: var(--amrod-accent); }

.amrod-colour-group-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .amrod-colour-groups,
    .amrod-qty-groups { flex-direction: column; }
    .amrod-branding-header { flex-direction: column; }
    .amrod-branding-guide-preview { width: 100%; }
    .amrod-field-row { grid-template-columns: 1fr; }
    .amrod-qty-table th:nth-child(4),
    .amrod-qty-table td:nth-child(4),
    .amrod-qty-table th:nth-child(5),
    .amrod-qty-table td:nth-child(5) { display: none; }
}

/* ─── Out of stock states ─────────────────────────────────────────────────── */

/* Whole-product out-of-stock notice */
.amrod-out-of-stock-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 24px;
    background: #fff8f8;
    border: 1px solid #f5c6c6;
    border-left: 4px solid #e02020;
    border-radius: 6px;
    margin: 16px 0;
}
.amrod-out-of-stock-notice .amrod-oos-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    color: #e02020;
}
.amrod-out-of-stock-notice strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
    color: #c0392b;
}
.amrod-out-of-stock-notice p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Out-of-stock colour swatch */
.amrod-colour-swatch.amrod-swatch-oos {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none; /* belt + braces — JS also blocks click */
    position: relative;
}
.amrod-colour-swatch.amrod-swatch-oos .amrod-swatch-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 4px,
        rgba(0,0,0,0.15) 4px,
        rgba(0,0,0,0.15) 5px
    );
    border-radius: 4px;
    pointer-events: none;
}
.amrod-colour-swatch.amrod-swatch-oos .amrod-swatch-img {
    position: relative;
}

/* Out-of-stock label inside swatch stock count */
.amrod-oos-label {
    color: #e02020;
    font-size: 11px;
    font-weight: 600;
}

/* Out-of-stock quantity row */
.amrod-qty-row-oos {
    background: #f9f9f9;
    opacity: 0.65;
}
.amrod-qty-row-oos td {
    color: #999;
}
.amrod-qty-row-oos .amrod-qty-input:disabled {
    background: #f0f0f0;
    cursor: not-allowed;
    color: #bbb;
}

/* ─── Inclusive branding row ─────────────────────────────────────────────── */
.amrod-branding-inclusive {
    background: #f0fff4;
}
.amrod-branding-inclusive td {
    color: #276749;
}

/* ─── Colours dropdown ───────────────────────────────────────────────────── */
.amrod-colours-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--amrod-border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}
.amrod-colours-select:disabled {
    background: #f5f5f5;
    cursor: default;
    color: var(--amrod-muted);
}

/* ─── Additional inclusive position row ─────────────────────────────────── */
.amrod-branding-additional {
    background: #fffdf0;
}
.amrod-branding-additional td {
    color: #7b6000;
}

/* ─── TBC branding notice ────────────────────────────────────────────────── */
.amrod-tbc-notice {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: #fff8e1;
    border: 1px solid #f0c040;
    border-radius: 8px;
    padding: 18px 20px;
    margin: 16px 0;
}
.amrod-tbc-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}
.amrod-tbc-notice strong {
    display: block;
    font-size: 15px;
    margin-bottom: 6px;
    color: #7b4f00;
}
.amrod-tbc-notice p {
    margin: 0 0 6px;
    color: #5a3e00;
    font-size: 13px;
    line-height: 1.6;
}
.amrod-tbc-notice p:last-child {
    margin-bottom: 0;
}
