/**
 * BrandedUK Desktop - Customize Positions Page CSS
 * Ported from mobile version with desktop adaptations
 */

/* ================================
   Position Cards Grid - Desktop
   ================================ */
.positions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 16px;
}

@media (max-width: 1200px) {
    .positions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.position-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1.4px solid rgba(168, 85, 247, 0.2);
    display: flex;
    flex-direction: column;
    gap: 14px;
    backdrop-filter: blur(20px);
}

.position-card-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.position-card:hover {
    border-color: rgba(168, 85, 247, 0.35);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(124, 58, 237, 0.12),
        0 2px 8px rgba(124, 58, 237, 0.08);
}

.position-card.selected {
    border-color: rgba(168, 85, 247, 0.5);
    background: rgba(255, 255, 255, 0.99);
    box-shadow: 
        0 0 0 3px rgba(168, 85, 247, 0.1),
        0 8px 24px rgba(124, 58, 237, 0.15);
}

.position-card.selected:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* ================================
   Position Checkbox
   ================================ */
.position-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.position-checkbox input[type="checkbox"] {
    display: none;
}

.position-checkbox span {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

/* ================================
   Price Badges (Embroidery & Print)
   ================================ */
.position-prices {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.price-badge {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 10px;
    min-height: 54px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    border: none;
}

/* EMBROIDERY badge - Blue */
.price-emb {
    background: linear-gradient(145deg, #5b8def, #4a76d6);
    color: white;
    border: 1px solid rgba(91, 141, 239, 0.6);
}

.price-emb .price-label,
.price-emb .price-value {
    color: white;
    opacity: 0.95;
}

/* PRINT badge - Yellow */
.price-print {
    background: linear-gradient(145deg, #f5c542, #e6b229);
    color: white;
    border: 1px solid rgba(245, 197, 66, 0.6);
}

.price-print .price-label,
.price-print .price-value {
    color: white;
    opacity: 0.95;
}

.price-badge .price-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-badge .price-value {
    font-size: 12px;
    font-weight: 700;
}

.price-badge:active {
    transform: translateY(-1px) scale(0.98);
}

/* EMBROIDERY Active State */
.price-emb.active {
    background: linear-gradient(145deg, #5b8def, #4a76d6);
    color: white !important;
    border: 1px solid rgba(91, 141, 239, 0.6);
    box-shadow: 
        0 6px 16px rgba(74, 118, 214, 0.3),
        0 2px 6px rgba(74, 118, 214, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.price-emb.active .price-label,
.price-emb.active .price-value {
    color: white !important;
    opacity: 1;
}

/* PRINT Active State */
.price-print.active {
    background: linear-gradient(145deg, #f5c542, #e6b229);
    color: white !important;
    border: 1px solid rgba(245, 197, 66, 0.6);
    box-shadow: 
        0 6px 16px rgba(230, 178, 41, 0.35),
        0 2px 6px rgba(230, 178, 41, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.price-print.active .price-label {
    font-size: 11px;
    color: white !important;
    opacity: 1;
}

.price-print.active .price-value {
    font-size: 13px;
    color: white !important;
    opacity: 1;
}

/* ================================
   POA Badge (Price On Application)
   ================================ */
.price-badge.poa-badge {
    background: linear-gradient(145deg, #f3e8ff, #e9d5ff);
    border: 2px dashed #9333ea !important;
    color: #7c3aed !important;
    cursor: not-allowed;
    position: relative;
}

.price-badge.poa-badge .price-value {
    font-size: 14px;
    font-weight: 800;
    color: #7c3aed !important;
    letter-spacing: 0.5px;
}

.price-badge.poa-badge .price-label {
    color: #9333ea !important;
}

.price-badge.poa-badge:active {
    transform: none;
}

/* ================================
   Add Logo Button (Purple with Cloud)
   ================================ */
.price-badge.add-logo-btn {
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    color: #fff !important;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(76, 29, 149, 0.25);
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    min-width: 56px;
    min-height: 48px;
}

.price-badge.add-logo-btn .add-logo-cloud-icon {
    width: 40px;
    height: 40px;
}

/* Cloud arrow animation */
.price-badge.add-logo-btn .cloud-arrow-anim {
    animation: cloudArrowMove 1.5s ease-in-out infinite;
}

@keyframes cloudArrowMove {
    0% { transform: translateY(100%); }
    40%, 60% { transform: translateY(0); }
    100% { transform: translateY(-100%); }
}

.price-badge.add-logo-btn .add-logo-text {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: white !important;
}

.price-badge.add-logo-btn:active {
    transform: translateY(-2px) scale(1.03);
}

/* ================================
   LOGO ADDED - Green Success State
   ================================ */
.price-badge.add-logo-btn.logo-added {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    border-color: transparent;
    animation: none;
}

.price-badge.add-logo-btn.logo-added .add-logo-text {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: white !important;
}

.price-badge.add-logo-btn.logo-added:active {
    transform: translateY(-1px) scale(1.02);
    background: linear-gradient(135deg, #059669, #047857);
}

/* ================================
   Position Preview & Logo Overlay
   ================================ */
.position-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
}

.position-placeholder {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
}

/* Aprons - 20% larger images */
body.category-aprons .position-placeholder,
body.category-apron .position-placeholder,
.positions-grid.aprons-grid .position-placeholder {
    max-height: 264px; /* 220px + 20% */
    transform: scale(1.2);
    transform-origin: center center;
}

/* Aprons - ensure Center Front scales even if labels change */
body.category-aprons .position-card[data-position="small-centre-front"] .position-placeholder,
body.category-apron .position-card[data-position="small-centre-front"] .position-placeholder {
    max-height: 264px;
    transform: scale(1.2);
    transform-origin: center center;
}

.logo-overlay-box {
    position: absolute;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    transform: translate(-50%, -50%);
}

.logo-overlay-box:not([hidden]) {
    display: flex;
    animation: logoFadeIn 0.3s ease-out;
}

@keyframes logoFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Position-specific coordinates */
.logo-overlay-box.left-chest { top: 22%; left: 62%; width: 32px; height: 32px; }
.logo-overlay-box.right-chest { top: 22%; left: 38%; width: 32px; height: 32px; }
.logo-overlay-box.front-center { top: 25%; left: 50%; width: 40px; height: 40px; }
.logo-overlay-box.large-front { top: 29%; left: 50%; width: 55px; height: 55px; }
.logo-overlay-box.large-back { top: 28%; left: 50%; width: 60px; height: 60px; }
.logo-overlay-box.left-sleeve { top: 22%; left: 58%; width: 40px; height: 40px; }
.logo-overlay-box.right-sleeve { top: 22%; left: 42%; width: 40px; height: 40px; }

.logo-overlay-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ================================
   Inline (Product Detail) overrides
   Match tablet/mobile logo placement
   ================================ */
#step3PositionsSection .position-preview {
    position: relative;
}

#step3PositionsSection .logo-overlay-box {
    user-select: none;
    pointer-events: none;
    z-index: 10;
    transform: translate(-50%, -50%);
}

/* Use tablet/mobile sizing for overlays in the inline grid */
#step3PositionsSection .logo-overlay-box.left-chest {
    top: calc(22% + 25px);
    left: 62%;
    width: 28px;
    height: 28px;
}

#step3PositionsSection .logo-overlay-box.right-chest {
    top: calc(22% + 25px);
    left: 38%;
    width: 28px;
    height: 28px;
}

#step3PositionsSection .logo-overlay-box.front-center {
    top: calc(25% + 25px);
    left: 50%;
    width: 35px;
    height: 35px;
}

#step3PositionsSection .logo-overlay-box.large-front {
    top: calc(29% + 25px);
    left: 50%;
    width: 48px;
    height: 48px;
}

#step3PositionsSection .logo-overlay-box.large-back {
    top: calc(28% + 25px);
    left: 50%;
    width: 55px;
    height: 55px;
}

#step3PositionsSection .logo-overlay-box.left-sleeve {
    top: calc(22% + 25px);
    left: calc(58% - 8px);
    width: 35px;
    height: 35px;
}

#step3PositionsSection .logo-overlay-box.right-sleeve {
    top: calc(22% + 25px);
    left: 42%;
    width: 35px;
    height: 35px;
}

#step3PositionsSection .logo-overlay-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ================================
   Customization Pill
   ================================ */
.customization-pill {
    align-self: center;
    padding: 6px 12px;
    background: rgba(237, 233, 254, 0.8);
    color: #6b21a8;
    font-size: 10px;
    font-weight: 800;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(168, 85, 247, 0.15);
    user-select: none;
}

.customization-pill:not([hidden]) {
    display: inline-block;
}

/* ================================
   Uploaded Logo Container
   ================================ */
.uploaded-logo-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.uploaded-logo-container:not([hidden]) {
    display: flex;
}

.uploaded-logo-box {
    position: relative;
    width: 100%;
    padding: 16px;
    border: 2px dashed rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    order: 1; /* Sempre prima */
}

.logo-added-pill {
    order: 2; /* Sempre dopo */
    padding: 8px 16px;
    background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
    color: #7c3aed;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.uploaded-logo-thumb {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
}

.delete-logo-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: #fee2e2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ef4444;
    padding: 0;
}

.delete-logo-btn:hover {
    background: #fecaca;
    color: #dc2626;
    transform: scale(1.05);
}

/* ================================
   Design Upload Modal
   ================================ */
.design-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.design-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.design-modal {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.design-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.design-modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.design-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.design-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.design-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.design-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed rgba(168, 85, 247, 0.4);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    background: rgba(249, 250, 251, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-dropzone:hover {
    border-color: #a855f7;
    background: rgba(243, 232, 255, 0.3);
}

.upload-dropzone.dragover {
    border-color: #7c3aed;
    background: rgba(243, 232, 255, 0.5);
    transform: scale(1.02);
}

.upload-dropzone svg {
    margin-bottom: 12px;
}

.dropzone-text {
    font-size: 14px;
    color: #6b7280;
}

.dropzone-text .browse-link {
    color: #7c3aed;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.dropzone-formats {
    display: block;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
}

/* Upload Preview */
.upload-preview-container {
    position: relative;
    margin-top: 16px;
    padding: 16px;
    background: rgba(249, 250, 251, 0.8);
    border-radius: 12px;
    text-align: center;
}

.upload-preview-container:not([hidden]) {
    display: block;
}

.upload-preview-img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
}

.upload-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: #fee2e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ef4444;
    transition: all 0.2s ease;
}

.upload-remove-btn:hover {
    background: #fecaca;
    color: #dc2626;
}

/* Remove Background Button */
.toggle-bg-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    color: #7c3aed;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-bg-btn:hover {
    background: rgba(124, 58, 237, 0.2);
}

.toggle-bg-btn.processing {
    opacity: 0.7;
    cursor: wait;
}

.toggle-bg-btn.bg-removed {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #059669;
}

.toggle-bg-btn.bg-removed span {
    white-space: pre-line;
    text-align: center;
    line-height: 1.2;
}

/* Modal Footer */
.design-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.apply-design-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 9999;
    pointer-events: auto !important;
}

.apply-design-btn:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.3);
}

/* ================================
   Toast Notification
   ================================ */
.toast-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ================================
   Key Badge Legend
   ================================ */
.key {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.key-label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
}

.key-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.key-badge.embroidery {
    background: linear-gradient(145deg, #5b8def, #4a76d6);
    color: white;
}

.key-badge.print {
    background: linear-gradient(145deg, #f5c542, #e6b229);
    color: white;
}

/* ================================
   Section Title
   ================================ */
.subsection-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 16px;
}

.position-group {
    margin-top: 24px;
}
