/**
 * Empire Five: Custom Order System styles.
 * Ported from hamcospo.com custom-order-system, every rule scoped to .custom-order-wrapper and
 * recolored to Empire navy/red. Source of truth: CRM repo wp-integration/empirefive/.
 *
 * Custom Order System - Styles
 * Modern, responsive styling with smooth animations
 */

/* ==========================================================================
   Variables
   ========================================================================== */
.custom-order-wrapper {
    /* Empire Five Athletics brand colors */
    --primary-color: #BF0A30;      /* Empire Red */
    --primary-light: #D3203F;      /* Lighter Red */
    --primary-dark: #A00828;       /* Darker Red */
    --secondary-color: #002868;    /* Empire Navy */
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;

    --text-primary: #1F2937;       /* Text */
    --text-secondary: #333333;     /* Dark grey text */
    --text-light: #666666;         /* Medium grey text */

    --bg-primary: #ffffff;         /* White background */
    --bg-secondary: #F5F5F5;       /* Light grey background */
    --bg-tertiary: #EEEEEE;        /* Lighter grey */

    --border-color: #E5E5E5;       /* Light grey border */
    --border-radius: 12px;
    --border-radius-sm: 8px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
.custom-order-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #F5F5F5 0%, #FFFFFF 50%, #F8F8F8 100%);
    padding: 40px 20px;
}

.custom-order-wrapper .custom-order-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

/* ==========================================================================
   Progress Indicator
   ========================================================================== */
.custom-order-wrapper .progress-indicator {
    padding: 30px 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.custom-order-wrapper .progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 30px;
}

.custom-order-wrapper .progress-fill {
    height: 100%;
    background: white;
    border-radius: 10px;
    transition: width var(--transition-base);
}

.custom-order-wrapper .progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}

.custom-order-wrapper .progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.custom-order-wrapper .step-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    transition: all var(--transition-base);
    border: 3px solid transparent;
}

.custom-order-wrapper .progress-step.active .step-circle {
    background: white;
    color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.3);
}

.custom-order-wrapper .progress-step.completed .step-circle {
    background: var(--success-color);
    color: white;
}

/* A finished step shows only the tick, not "✓1". */
.custom-order-wrapper .progress-step.completed .step-circle {
    font-size: 0;
}

.custom-order-wrapper .progress-step.completed .step-circle::before {
    content: '✓';
    font-size: 20px;
}

.custom-order-wrapper .step-label {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    opacity: 0.8;
}

.custom-order-wrapper .progress-step.active .step-label {
    opacity: 1;
    font-size: 15px;
}

/* ==========================================================================
   Form Steps
   ========================================================================== */
.custom-order-wrapper .form-step {
    display: none;
    padding: 50px 40px;
    animation: co-fadeIn var(--transition-base);
}

.custom-order-wrapper .form-step.active {
    display: block;
}

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

.custom-order-wrapper .step-header {
    text-align: center;
    margin-bottom: 50px;
}

.custom-order-wrapper .step-header h2 {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 15px;
}

.custom-order-wrapper .step-header p {
    font-size: 18px;
    color: var(--text-secondary);
    margin: 0;
}

/* ==========================================================================
   Step 1: Sports Grid
   ========================================================================== */
.custom-order-wrapper .sports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.custom-order-wrapper .sport-card {
    position: relative;
    background: var(--bg-secondary);
    border: 3px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.custom-order-wrapper .sport-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(0,40,104,0.95) 100%);
    opacity: 1;
    transition: all var(--transition-base);
}

.custom-order-wrapper .sport-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.custom-order-wrapper .sport-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.custom-order-wrapper .sport-card:active {
    transform: translateY(-2px) scale(1);
}

.custom-order-wrapper .sport-card.selected {
    border-color: var(--success-color);
    transform: translateY(-5px) scale(1.05);
}

.custom-order-wrapper .sport-card.selected::after {
    opacity: 0.9;
}

.custom-order-wrapper .sport-icon {
    font-size: 50px;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
    display: none;
}

.custom-order-wrapper .sport-card h3 {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    position: relative;
    z-index: 2;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    padding: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

.custom-order-wrapper .sport-check {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    z-index: 2;
    animation: co-checkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.custom-order-wrapper .sport-card.selected .sport-check {
    display: flex;
}

@keyframes co-checkPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Step 2: Products Grid
   ========================================================================== */
.custom-order-wrapper .products-container {
    min-height: 300px;
    margin-bottom: 30px;
}

.custom-order-wrapper .products-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.custom-order-wrapper .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: co-spin 0.8s linear infinite;
}

.custom-order-wrapper .spinner-small {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: co-spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

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

.custom-order-wrapper .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.custom-order-wrapper .product-card {
    position: relative;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.custom-order-wrapper .product-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.custom-order-wrapper .product-card.selected {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: white;
}

.custom-order-wrapper .product-card.selected .product-content {
    background: var(--primary-light);
}

.custom-order-wrapper .product-icon {
    font-size: 40px;
    margin-bottom: 10px;
    padding: 25px 15px 10px;
}

.custom-order-wrapper .product-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-order-wrapper .product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition-base);
}

.custom-order-wrapper .product-card:hover .product-image img {
    transform: scale(1.05);
}

.custom-order-wrapper .product-content {
    padding: 20px 15px;
    background: var(--bg-secondary);
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: background var(--transition-fast);
}

.custom-order-wrapper .product-card h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.4;
    color: var(--text-primary);
}

.custom-order-wrapper .product-card.selected h4 {
    color: white;
}

.custom-order-wrapper .product-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.custom-order-wrapper .product-card.selected .product-description {
    color: rgba(255,255,255,0.9);
}

.custom-order-wrapper .product-features {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    text-align: left;
}

.custom-order-wrapper .product-features li {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 0;
    position: relative;
    padding-left: 18px;
}

.custom-order-wrapper .product-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: 700;
}

.custom-order-wrapper .product-card.selected .product-features li {
    color: rgba(255,255,255,0.85);
}

.custom-order-wrapper .product-card.selected .product-features li::before {
    color: white;
}

.custom-order-wrapper .product-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    animation: co-checkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.custom-order-wrapper .product-card.selected .product-check {
    display: flex;
}

.custom-order-wrapper .selected-products-summary {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    padding: 20px;
    margin-bottom: 30px;
}

.custom-order-wrapper .selected-products-summary h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0 0 15px;
}

.custom-order-wrapper .selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.custom-order-wrapper .selected-tag {
    background: var(--primary-light);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* ==========================================================================
   Step 3: Order Details Form
   ========================================================================== */
.custom-order-wrapper .order-details-form {
    max-width: 100%;
}

.custom-order-wrapper .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.custom-order-wrapper .form-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    padding: 30px;
}

.custom-order-wrapper .form-section.full-width {
    grid-column: 1 / -1;
}

.custom-order-wrapper .form-section h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.custom-order-wrapper .form-group {
    margin-bottom: 20px;
}

.custom-order-wrapper .form-group:last-child {
    margin-bottom: 0;
}

.custom-order-wrapper .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.custom-order-wrapper .form-group input[type="text"],
.custom-order-wrapper .form-group input[type="email"],
.custom-order-wrapper .form-group input[type="tel"],
.custom-order-wrapper .form-group input[type="date"],
.custom-order-wrapper .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.custom-order-wrapper .form-group input:focus,
.custom-order-wrapper .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.custom-order-wrapper .form-group input.error,
.custom-order-wrapper .form-group textarea.error {
    border-color: var(--danger-color);
}

.custom-order-wrapper .error-message {
    display: block;
    color: var(--danger-color);
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.custom-order-wrapper .color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.custom-order-wrapper .color-input-group input[type="color"] {
    width: 80px;
    height: 50px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
}

.custom-order-wrapper .color-text {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* Color Palette */
.custom-order-wrapper .color-palette {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 15px;
    padding-top: 40px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    overflow: visible;
    position: relative;
    pointer-events: auto;
}

.custom-order-wrapper .palette-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 8px;
    white-space: nowrap;
}

.custom-order-wrapper .color-swatch-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.custom-order-wrapper .color-swatch {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    position: relative;
    display: block;
    z-index: 1;
    pointer-events: auto;
}

.custom-order-wrapper .color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    border-color: var(--primary-color);
    z-index: 10;
}

.custom-order-wrapper .color-swatch:active {
    transform: scale(1.05);
}

.custom-order-wrapper .color-swatch.selected {
    border-color: var(--primary-color);
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(191, 10, 48, 0.3);
    transform: scale(1.1);
}

.custom-order-wrapper .color-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0,0,0,0.8), 0 0 5px rgba(0,0,0,0.5);
    pointer-events: none;
}

.custom-order-wrapper .pms-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}

/* Custom Color Codes */
.custom-order-wrapper .field-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-style: italic;
}

.custom-order-wrapper .custom-color-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.custom-order-wrapper .custom-color-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.custom-order-wrapper .custom-color-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(191, 10, 48, 0.1);
}

.custom-order-wrapper .btn-remove-color {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--danger-color);
    background: white;
    color: var(--danger-color);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.custom-order-wrapper .btn-remove-color:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

.custom-order-wrapper .btn-add-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 10px;
}

.custom-order-wrapper .btn-add-field:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* File Upload */
.custom-order-wrapper .file-upload-area {
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-tertiary);
}

.custom-order-wrapper .file-upload-area:hover {
    border-color: var(--primary-light);
    background: white;
}

.custom-order-wrapper .file-upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(191, 10, 48, 0.05);
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(191, 10, 48, 0.08);
}

.custom-order-wrapper .upload-browse {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.custom-order-wrapper .upload-icon {
    font-size: 50px;
    margin-bottom: 15px;
}

.custom-order-wrapper .upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.custom-order-wrapper .upload-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== Selected attachments ===== */
.custom-order-wrapper .attachment-list {
    margin-top: 18px;
}

.custom-order-wrapper .attachment-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.custom-order-wrapper .attachment-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.custom-order-wrapper .attachment-clear {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.custom-order-wrapper .attachment-clear:hover {
    color: var(--primary-color);
    background: rgba(191, 10, 48, 0.06);
}

.custom-order-wrapper .attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.custom-order-wrapper .attachment-item {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    animation: co-attachIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--i, 0) * 40ms);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .custom-order-wrapper .attachment-item:hover {
        border-color: #d0d0d0;
        box-shadow: var(--shadow-md);
    }
}

/* The content layer slides over the swipe backdrop (touch swipe-to-remove) */
.custom-order-wrapper .attachment-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #fff;
    touch-action: pan-y;   /* vertical scroll passes through; we own horizontal */
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.custom-order-wrapper .attachment-item.is-swiping .attachment-content {
    transition: none;
}

/* Red "Remove" backdrop revealed as the card is dragged left */
.custom-order-wrapper .attachment-swipe-hint {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;
    background: linear-gradient(90deg, var(--primary-light), var(--primary-color));
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    opacity: var(--swipe, 0);
}

.custom-order-wrapper .attachment-swipe-hint span {
    transform: scale(calc(0.82 + (var(--swipe, 0) * 0.18)));
}

/* A thin red wash rides in from the left as each file uploads */
.custom-order-wrapper .attachment-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(191, 10, 48, 0.05);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s linear;
    pointer-events: none;
}

.custom-order-wrapper .attachment-item.is-uploading .attachment-content::before {
    transform: scaleX(1);
}

.custom-order-wrapper .attachment-item.is-done {
    border-color: rgba(16, 185, 129, 0.45);
}

.custom-order-wrapper .attachment-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-order-wrapper .attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.custom-order-wrapper .attachment-thumb.is-doc {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.custom-order-wrapper .attachment-thumb.is-doc::after {
    content: attr(data-ext);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Green check badge when a file finishes */
.custom-order-wrapper .attachment-thumb::before {
    content: '✓';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--success-color);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.custom-order-wrapper .attachment-item.is-done .attachment-thumb::before {
    transform: scale(1);
}

.custom-order-wrapper .attachment-info {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    z-index: 1;
}

.custom-order-wrapper .attachment-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-order-wrapper .attachment-size {
    font-size: 12px;
    color: var(--text-light);
    margin: 0;
}

.custom-order-wrapper .attachment-progress {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 7px;
    opacity: 0;
    max-height: 0;
    transition: opacity var(--transition-fast);
}

.custom-order-wrapper .attachment-item.is-uploading .attachment-progress,
.custom-order-wrapper .attachment-item.is-done .attachment-progress {
    opacity: 1;
    max-height: 4px;
}

.custom-order-wrapper .attachment-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width 0.2s linear;
}

.custom-order-wrapper .attachment-item.is-done .attachment-progress-fill {
    background: var(--success-color);
}

.custom-order-wrapper .attachment-remove {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-light);
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

@media (hover: hover) {
    .custom-order-wrapper .attachment-remove:hover {
        background: var(--danger-color);
        color: #fff;
        transform: rotate(90deg);
    }
}

.custom-order-wrapper .attachment-remove:active {
    background: var(--danger-color);
    color: #fff;
    transform: scale(0.9);
}

.custom-order-wrapper .attachment-item.is-uploading .attachment-remove,
.custom-order-wrapper .attachment-item.is-done .attachment-remove {
    visibility: hidden;
}

/* ===== Touch & mobile tuning — bigger targets, no tap delay/highlight ===== */
.custom-order-wrapper .file-upload-area,
.custom-order-wrapper .attachment-remove,
.custom-order-wrapper .attachment-clear,
.custom-order-wrapper .upload-browse {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.custom-order-wrapper .file-upload-area:active {
    transform: scale(0.99);
    border-color: var(--primary-color);
}

/* Coarse pointers (phones/tablets): enlarge tap targets to ~44px+ */
@media (pointer: coarse) {
    .custom-order-wrapper .file-upload-area {
        padding: 46px 22px;
    }
    .custom-order-wrapper .attachment-remove {
        width: 42px;
        height: 42px;
        font-size: 24px;
        background: var(--bg-tertiary);
    }
    .custom-order-wrapper .attachment-clear {
        padding: 10px 14px;
        font-size: 14px;
    }
    .custom-order-wrapper .attachment-content {
        padding: 12px;
        gap: 14px;
    }
}

@media (max-width: 560px) {
    .custom-order-wrapper .attachment-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .custom-order-wrapper .attachment-thumb {
        width: 58px;
        height: 58px;
    }
    .custom-order-wrapper .attachment-name {
        font-size: 14px;
    }
    .custom-order-wrapper .attachment-size {
        font-size: 12.5px;
    }
    .custom-order-wrapper .upload-progress {
        padding: 16px;
    }
    .custom-order-wrapper .upload-progress-percent {
        font-size: 26px;
    }
    .custom-order-wrapper .upload-progress-title {
        font-size: 13px;
    }
}

@keyframes co-attachIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Overall upload progress ===== */
.custom-order-wrapper .upload-progress {
    margin-top: 20px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    animation: co-attachIn 0.3s ease both;
}

.custom-order-wrapper .upload-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.custom-order-wrapper .upload-progress-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.custom-order-wrapper .upload-progress-percent {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.custom-order-wrapper .upload-progress-track {
    position: relative;
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
}

.custom-order-wrapper .upload-progress-fill {
    position: relative;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary-color), var(--primary-light));
    background-size: 200% 100%;
    transition: width 0.2s ease;
    animation: co-progressHue 2s linear infinite;
}

/* Moving diagonal sheen — reads like a stadium light sweep */
.custom-order-wrapper .upload-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 25%,
        rgba(255, 255, 255, 0.55) 50%,
        transparent 75%
    );
    background-size: 200% 100%;
    animation: co-progressSheen 1.1s linear infinite;
}

.custom-order-wrapper .upload-progress.is-complete .upload-progress-fill {
    background: var(--success-color);
    animation: none;
}

.custom-order-wrapper .upload-progress.is-complete .upload-progress-percent {
    color: var(--success-color);
}

.custom-order-wrapper .upload-progress.is-complete .upload-progress-fill::after {
    animation: none;
    opacity: 0;
}

/* Indeterminate shimmer while the server processes after bytes land */
.custom-order-wrapper .upload-progress.is-processing .upload-progress-track {
    background-image: linear-gradient(90deg, var(--bg-tertiary) 0%, #e2e2e2 50%, var(--bg-tertiary) 100%);
    background-size: 200% 100%;
    animation: co-progressSheen 1.2s linear infinite;
}

.custom-order-wrapper .upload-progress-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
}

.custom-order-wrapper .upload-progress-stats span:empty {
    display: none;
}

.custom-order-wrapper .upload-progress-stats span + span:not(:empty)::before {
    content: '·';
    margin-right: 14px;
    color: var(--border-color);
}

@keyframes co-progressSheen {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@keyframes co-progressHue {
    from { background-position: 0% 0; }
    to   { background-position: 200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .custom-order-wrapper .attachment-item,
.custom-order-wrapper .upload-progress { animation: none; }
    .custom-order-wrapper .upload-progress-fill,
.custom-order-wrapper .upload-progress-fill::after,
.custom-order-wrapper .upload-progress.is-processing .upload-progress-track { animation: none; }
    .custom-order-wrapper .attachment-content::before,
.custom-order-wrapper .attachment-content,
.custom-order-wrapper .attachment-progress-fill,
.custom-order-wrapper .upload-progress-fill { transition: none; }
}

/* Form Summary */
.custom-order-wrapper .form-summary {
    background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
    border: 2px solid var(--primary-light);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
}

.custom-order-wrapper .form-summary h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 20px;
}

.custom-order-wrapper .summary-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-order-wrapper .summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-order-wrapper .summary-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.custom-order-wrapper .summary-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
}

/* ==========================================================================
   Step Actions (Buttons)
   ========================================================================== */
.custom-order-wrapper .step-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.custom-order-wrapper .btn-custom-order {
    flex: 1;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    text-align: center;
}

.custom-order-wrapper .btn-next,
.custom-order-wrapper .btn-submit {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.custom-order-wrapper .btn-next:hover,
.custom-order-wrapper .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.custom-order-wrapper .btn-next:active,
.custom-order-wrapper .btn-submit:active {
    transform: translateY(0);
}

.custom-order-wrapper .btn-next:disabled,
.custom-order-wrapper .btn-submit:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.custom-order-wrapper .btn-back {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.custom-order-wrapper .btn-back:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.custom-order-wrapper .btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.custom-order-wrapper .btn-secondary:hover {
    background: var(--bg-secondary);
}

.custom-order-wrapper .btn-loading {
    display: none;
    align-items: center;
}

/* ==========================================================================
   Success Screen
   ========================================================================== */
.custom-order-wrapper .success-container {
    text-align: center;
    padding: 60px 40px;
    max-width: 700px;
    margin: 0 auto;
}

.custom-order-wrapper .success-icon {
    width: 100px;
    height: 100px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    font-weight: 700;
    margin: 0 auto 30px;
    animation: co-successPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes co-successPop {
    0% { transform: scale(0) rotate(-180deg); }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.custom-order-wrapper .success-container h2 {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 15px;
}

.custom-order-wrapper .success-message {
    font-size: 18px;
    color: var(--text-secondary);
    margin: 0 0 30px;
}

.custom-order-wrapper .order-number-box {
    background: linear-gradient(135deg, #eff6ff, #e0f2fe);
    border: 3px solid var(--primary-light);
    border-radius: var(--border-radius);
    padding: 30px;
    margin: 30px 0;
}

.custom-order-wrapper .order-number-box p {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px;
}

.custom-order-wrapper .order-number-box h2 {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: 2px;
}

.custom-order-wrapper .success-note {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 30px 0;
}

.custom-order-wrapper .success-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .custom-order-wrapper {
        padding: 20px 10px;
    }

    .custom-order-wrapper .form-step {
        padding: 30px 20px;
    }

    .custom-order-wrapper .step-header h2 {
        font-size: 28px;
    }

    .custom-order-wrapper .step-header p {
        font-size: 16px;
    }

    .custom-order-wrapper .sports-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .custom-order-wrapper .sport-card {
        padding: 15px;
        min-height: 220px;
    }

    .custom-order-wrapper .sport-icon {
        font-size: 40px;
    }

    .custom-order-wrapper .sport-card h3 {
        font-size: 18px;
        padding: 12px;
    }

    .custom-order-wrapper .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .custom-order-wrapper .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .custom-order-wrapper .form-section {
        padding: 20px;
    }

    .custom-order-wrapper .step-actions {
        flex-direction: column;
    }

    .custom-order-wrapper .btn-custom-order {
        width: 100%;
    }

    .custom-order-wrapper .step-actions .btn-back {
        order: 2;
    }

    .custom-order-wrapper .success-actions {
        flex-direction: column;
    }

    .custom-order-wrapper .progress-steps {
        flex-direction: row;
    }

    .custom-order-wrapper .step-circle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .custom-order-wrapper .step-label {
        font-size: 12px;
    }

    .custom-order-wrapper .progress-step.active .step-label {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .custom-order-wrapper .sports-grid {
        grid-template-columns: 1fr 1fr;
    }

    .custom-order-wrapper .products-grid {
        grid-template-columns: 1fr 1fr;
    }

    .custom-order-wrapper .file-upload-area {
        padding: 30px 20px;
    }

    .custom-order-wrapper .upload-icon {
        font-size: 40px;
    }

    .custom-order-wrapper .success-container {
        padding: 40px 20px;
    }

    .custom-order-wrapper .success-icon {
        width: 80px;
        height: 80px;
        font-size: 50px;
    }

    .custom-order-wrapper .success-container h2 {
        font-size: 28px;
    }

    .custom-order-wrapper .order-number-box h2 {
        font-size: 24px;
    }
}

/* ==========================================================================
   Touch Device Enhancements
   ========================================================================== */
@media (hover: none) {
    .custom-order-wrapper .sport-card:hover,
.custom-order-wrapper .product-card:hover {
        transform: none;
    }

    .custom-order-wrapper .sport-card:active,
.custom-order-wrapper .product-card:active {
        transform: scale(0.97);
    }

    .custom-order-wrapper .btn-custom-order:hover {
        transform: none;
    }

    .custom-order-wrapper .btn-custom-order:active {
        transform: scale(0.98);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .custom-order-wrapper .progress-indicator,
.custom-order-wrapper .step-actions,
.custom-order-wrapper .btn-custom-order {
        display: none;
    }

    .custom-order-wrapper {
        background: white;
    }

    .custom-order-wrapper .form-step {
        display: block !important;
        page-break-inside: avoid;
    }
}
