/* Montage Page Styles */
.pg-montage-page {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
}

.pg-montage-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--pg-dark);
    margin-bottom: 12px;
    text-align: center;
}

.pg-montage-subtitle {
    font-size: 16px;
    color: var(--pg-grey);
    text-align: center;
    margin-bottom: 40px;
}

.pg-montage-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-bottom: 40px;
}

/* Isometric Diagram */
.pg-montage-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--pg-bg-light);
    border-radius: 16px;
    padding: 40px 20px;
    border: 1px solid var(--pg-border-light);
}

/* SVG Racket — Container */
#pg-racket-svg-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pg-racket-svg-container svg {
    width: 100%;
    max-width: 460px;
    height: auto;
    filter: drop-shadow(var(--pg-shadow-sm, 0 2px 8px rgba(0,0,0,0.12)));
}

/* SVG Racket — Parts interactifs */
.pg-svg-part {
    transition: fill 0.4s ease, fill-opacity 0.4s ease;
}

/* SVG Racket — Overlay (contours noirs, non-interactif) */
.pg-svg-overlay {
    pointer-events: none;
}

/* SVG Racket — Loading */
.pg-racket-loading {
    color: var(--pg-grey-light);
    font-size: 0.875rem;
    animation: pg-pulse 1.5s ease-in-out infinite;
}

@keyframes pg-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Product Selectors */
.pg-montage-selectors {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.pg-selector-group {
    background: var(--pg-white);
    border: 2px solid var(--pg-border-light);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.pg-selector-group:hover {
    border-color: var(--pg-galaxy);
}

.pg-selector-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--pg-grey);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.pg-selector-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pg-add-product-btn {
    width: 80px;
    height: 80px;
    border: 2px dashed var(--pg-border-dark);
    border-radius: 8px;
    background: var(--pg-bg-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--pg-grey-light);
    transition: all 0.2s;
    flex-shrink: 0;
}

.pg-add-product-btn:hover {
    border-color: var(--pg-galaxy);
    color: var(--pg-galaxy);
    background: var(--pg-galaxy-light-bg);
}

.pg-selected-product {
    display: none;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.pg-selected-product.active {
    display: flex;
}

.pg-selected-product-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
    border: 1px solid var(--pg-border-light);
    background: var(--pg-bg-light);
}

.pg-selected-product-info {
    flex: 1;
}

.pg-selected-product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--pg-dark);
    margin-bottom: 2px;
}

.pg-selected-product-attrs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.pg-selected-attr {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--pg-grey-medium);
    background: var(--pg-light-grey);
    padding: 2px 8px;
    border-radius: 100px;
}

.pg-selected-product-remove {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--pg-error);
    background: var(--pg-stock-out-bg);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pg-selected-product-remove:hover {
    background: #FECACA;
}

/* Form Fields */
.pg-montage-form {
    background: var(--pg-white);
    border: 2px solid var(--pg-border-light);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.pg-form-group {
    margin-bottom: 20px;
}

.pg-form-group:last-child {
    margin-bottom: 0;
}

.pg-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--pg-dark);
    margin-bottom: 8px;
}

.pg-form-input,
.pg-form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--pg-border-dark);
    border-radius: 8px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.pg-form-input:focus,
.pg-form-textarea:focus {
    outline: none;
    border-color: var(--pg-galaxy);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.pg-form-textarea {
    resize: vertical;
    min-height: 100px;
}

.pg-form-help {
    font-size: 12px;
    color: var(--pg-grey-medium);
    margin-top: 6px;
}

/* ───── Montage Options Checkboxes ───── */
.pg-montage-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pg-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--pg-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    user-select: none;
}

.pg-option-item:hover {
    border-color: var(--pg-galaxy);
    background-color: var(--pg-galaxy-light);
}

.pg-option-checkbox {
    display: none;
}

.pg-option-checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--pg-border-medium);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s;
}

.pg-option-checkbox:checked + .pg-option-checkmark {
    background-color: var(--pg-galaxy);
    border-color: var(--pg-galaxy);
}

.pg-option-checkbox:checked + .pg-option-checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.pg-option-checkbox:checked ~ .pg-option-name {
    font-weight: 600;
}

.pg-option-item:has(.pg-option-checkbox:checked) {
    border-color: var(--pg-galaxy);
    background-color: var(--pg-galaxy-light);
}

.pg-option-name {
    flex: 1;
    font-size: 14px;
    color: var(--pg-dark);
}

.pg-option-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--pg-galaxy);
    white-space: nowrap;
}

.pg-option-free {
    color: var(--pg-success);
}

/* Summary options row */
.pg-summary-options .pg-summary-value {
    color: var(--pg-galaxy);
}

/* Summary */
.pg-montage-summary {
    background: var(--pg-bg-light);
    border: 2px solid var(--pg-border-light);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.pg-summary-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--pg-dark);
    margin-bottom: 16px;
}

.pg-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--pg-border-light);
}

.pg-summary-item:last-child {
    border-bottom: none;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px solid var(--pg-border-light);
    font-weight: 700;
}

.pg-summary-label {
    font-size: 14px;
    color: var(--pg-grey-medium);
}

.pg-summary-value {
    font-size: 14px;
    color: var(--pg-dark);
    font-weight: 600;
}

/* Add to Cart Button */
.pg-add-montage-btn {
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 700;
    color: var(--pg-white);
    background: var(--pg-galaxy);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.pg-add-montage-btn:hover:not(:disabled) {
    background: var(--pg-galaxy-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--pg-galaxy-shadow);
}

.pg-add-montage-btn:disabled {
    background: var(--pg-border-dark);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Modal */
.pg-montage-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pg-montage-modal.active {
    display: flex;
}

.pg-modal-content {
    background: var(--pg-white);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pg-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--pg-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pg-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--pg-dark);
}

.pg-modal-close {
    font-size: 28px;
    color: var(--pg-grey-medium);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.pg-modal-close:hover {
    background: var(--pg-light-grey);
    color: var(--pg-dark);
}

.pg-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.pg-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.pg-product-card {
    border: 2px solid var(--pg-border-light);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.pg-product-card:hover {
    border-color: var(--pg-galaxy);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.pg-product-card-img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
    background: var(--pg-light-grey);
}

.pg-product-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--pg-dark);
    margin-bottom: 6px;
    line-height: 1.4;
}

.pg-product-card-attrs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.pg-product-card-attr {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--pg-grey-medium);
    background: var(--pg-light-grey);
    padding: 2px 8px;
    border-radius: 100px;
}

.pg-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.pg-product-card-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--pg-galaxy);
}

.pg-modal-notice {
    font-size: 13px;
    color: var(--pg-grey-medium);
    text-align: center;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--pg-border-light);
    margin-bottom: 20px;
}

.pg-card-used {
    opacity: 0.4;
    pointer-events: none;
    position: relative;
    cursor: default;
}

.pg-card-used::after {
    content: 'Déjà sélectionné';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: var(--pg-white);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
}

.pg-card-used:hover {
    border-color: var(--pg-border-light);
    box-shadow: none;
}

/* Montaged products hidden by default in modal, shown during edit */
.pg-card-montaged {
    display: none !important;
}

.pg-empty-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--pg-grey-medium);
    font-size: 14px;
}

.pg-montage-shop-link {
    color: var(--pg-galaxy);
    text-decoration: underline;
    font-weight: 600;
}

/* Body scroll lock when modal open */
body.pg-modal-open { overflow: hidden; }

/* Step indicators */
.pg-selector-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--pg-border-dark);
    color: var(--pg-white);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    margin-right: 8px;
    flex-shrink: 0;
    transition: background 0.3s;
}

.pg-selector-group.pg-filled .pg-selector-step {
    background: var(--pg-success);
}

.pg-selector-group.pg-filled {
    border-color: var(--pg-success);
}

/* Clickable selected product for "change" */
.pg-selected-product-info {
    cursor: pointer;
    transition: opacity 0.2s;
}

.pg-selected-product-info:hover {
    opacity: 0.7;
}

/* Summary total row */
.pg-summary-total .pg-summary-label,
.pg-summary-total .pg-summary-value {
    font-size: 16px;
    color: var(--pg-dark);
}

/* Toast notifications */
.pg-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: 10px;
    color: var(--pg-white);
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    max-width: 400px;
}

.pg-toast.pg-toast-visible {
    transform: translateY(0);
    opacity: 1;
}

.pg-toast-error { background: var(--pg-error); }
.pg-toast-success { background: var(--pg-success); }
.pg-toast-info { background: var(--pg-info); }

/* Existing montages section (horizontal strip) */
.pg-existing-montages {
    margin-bottom: 32px;
}

.pg-existing-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--pg-grey-medium);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pg-existing-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.pg-existing-grid::-webkit-scrollbar {
    height: 4px;
}

.pg-existing-grid::-webkit-scrollbar-thumb {
    background: var(--pg-border-dark);
    border-radius: 4px;
}

.pg-existing-card {
    position: relative;
    background: var(--pg-white);
    border: 2px solid var(--pg-border-light);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    min-width: 280px;
    flex-shrink: 0;
}

.pg-existing-card:hover {
    border-color: var(--pg-galaxy);
}

.pg-existing-card-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(79, 70, 229, 0.85);
    color: var(--pg-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 10px;
    z-index: 1;
}

.pg-existing-card:hover .pg-existing-card-overlay {
    opacity: 1;
}

.pg-existing-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--pg-dark);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-existing-card-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pg-existing-card-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pg-existing-card-img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: contain;
    background: var(--pg-light-grey);
    border: 1px solid var(--pg-border-light);
    flex-shrink: 0;
}

.pg-existing-card-role {
    font-size: 11px;
    font-weight: 600;
    color: var(--pg-grey-medium);
    text-transform: uppercase;
}

.pg-existing-card-product {
    font-size: 12px;
    color: var(--pg-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.pg-existing-card-price {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--pg-border-light);
    font-size: 14px;
    font-weight: 700;
    color: var(--pg-galaxy);
    text-align: right;
}

/* Cancel edit button */
.pg-existing-card.pg-editing {
    border-color: var(--pg-info);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
    opacity: 0.7;
}
.pg-existing-card.pg-editing .pg-existing-card-overlay {
    opacity: 1;
    background: rgba(59, 130, 246, 0.85);
}
.pg-existing-card.pg-editing .pg-existing-card-overlay::after {
    content: 'En cours de modification...';
    display: block;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 400;
}

.pg-cancel-edit-btn {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: none;
    border: 1px solid var(--pg-border-dark);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--pg-grey-medium);
    cursor: pointer;
    transition: all 0.2s;
    display: none;
}

.pg-cancel-edit-btn:hover {
    border-color: var(--pg-error);
    color: var(--pg-error);
}

.pg-card-cancel-btn {
    display: none;
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    background: none;
    border: 1px solid var(--pg-error);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--pg-error);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
}
.pg-card-cancel-btn:hover {
    background: var(--pg-error);
    color: var(--pg-white);
}
.pg-existing-card.pg-editing .pg-card-cancel-btn {
    display: block;
}

@media (max-width: 768px) {
    .pg-montage-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .pg-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .pg-existing-card {
        min-width: 240px;
    }
}
