/* ==========================================================
   WC Commander Sur Demande — style.css v3.0.0
   Woodmart compatible
   ========================================================== */

/* --- Bouton déclencheur ----------------------------------- */
.wc-csd-wrapper {
    display: inline-block;
    margin-top: 12px;
    margin-bottom: 4px;
    margin-left: 10px; /* côté du message rupture de stock */
    vertical-align: middle;
}

/* Si le wrapper est seul sur une ligne (après le bloc stock) */
p.stock.out-of-stock + .wc-csd-wrapper,
.stock.out-of-stock + .wc-csd-wrapper {
    display: block;
    margin-left: 0;
    margin-top: 12px;
}

.wc-csd-open-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 10px 22px !important;
    background-color: #1a1a1a !important;
    color: #fff !important;
    border: 2px solid #1a1a1a !important;
    border-radius: 4px !important;
    transition: background 0.2s, color 0.2s;
    text-decoration: none !important;
    line-height: 1.4 !important;
    white-space: nowrap;
}

.wc-csd-open-btn:hover {
    background-color: transparent !important;
    color: #1a1a1a !important;
}

/* --- Overlay --------------------------------------------- */
.wc-csd-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
    z-index: 999999;
    padding: 16px;
}

.wc-csd-overlay.wc-csd-open {
    display: flex !important;
    align-items: center;
    justify-content: center;
    animation: wc-csd-fadein 0.2s ease;
}

@keyframes wc-csd-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

body.wc-csd-body-lock { overflow: hidden !important; }

/* --- Modal ----------------------------------------------- */
.wc-csd-modal {
    background: #fff;
    border-radius: 8px;
    padding: 32px 28px 28px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: wc-csd-slideup 0.25s ease;
}

@keyframes wc-csd-slideup {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.wc-csd-modal h3 {
    margin: 0 0 4px !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
}

.wc-csd-product-name {
    font-size: 13px !important;
    color: #888 !important;
    margin: 0 0 20px !important;
}

/* --- Fermer ---------------------------------------------- */
.wc-csd-close {
    position: absolute;
    top: 12px; right: 14px;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
    padding: 4px 6px;
    transition: color 0.15s;
}
.wc-csd-close:hover { color: #1a1a1a; }

/* --- Notice ---------------------------------------------- */
.wc-csd-notice {
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 16px;
}
.wc-csd-notice--success { background:#e9f7ef; color:#1D9E75; border-left:3px solid #1D9E75; }
.wc-csd-notice--error   { background:#fdecea; color:#e24b4a; border-left:3px solid #e24b4a; }

/* --- Champs ---------------------------------------------- */
.wc-csd-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
.wc-csd-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.wc-csd-field--full { grid-column: 1 / -1; }

.wc-csd-field label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #444 !important;
    margin: 0 !important;
}
.wc-csd-field label .required { color: #e24b4a; margin-left: 2px; }

.wc-csd-field input,
.wc-csd-field textarea {
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    padding: 9px 12px !important;
    font-size: 14px !important;
    color: #1a1a1a !important;
    background: #fafafa !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color 0.15s !important;
    box-shadow: none !important;
}
.wc-csd-field input:focus,
.wc-csd-field textarea:focus {
    border-color: #1a1a1a !important;
    outline: none !important;
    background: #fff !important;
}

/* --- Submit --------------------------------------------- */
.wc-csd-submit {
    width: 100%;
    padding: 13px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    background: #1a1a1a !important;
    color: #fff !important;
    border: 2px solid #1a1a1a !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.wc-csd-submit:hover:not(:disabled) {
    background: transparent !important;
    color: #1a1a1a !important;
}
.wc-csd-submit:disabled { opacity: 0.65; cursor: not-allowed; }

/* --- Responsive ----------------------------------------- */
@media (max-width: 480px) {
    .wc-csd-fields    { grid-template-columns: 1fr; }
    .wc-csd-modal     { padding: 24px 16px 20px; }
    .wc-csd-wrapper   { margin-left: 0; margin-top: 10px; display: block; }
}
