/* =========================================
   SIDE CART (DRAWER)
   Uses only theme variables from variables.css
   ========================================= */

.nm-cart-overlay {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--bg-dark) 70%, transparent);
    backdrop-filter: blur(2px);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.nm-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nm-cart-drawer {
    position: fixed;
    top: 0;
    right: -480px;
    width: 420px;
    height: 100vh;
    background: var(--bg-dark);
    z-index: 100001;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: right 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    color: var(--text-main);
    font-family: var(--font-main);
    border-left: 1px solid var(--secondary-border-color);
    overflow: hidden;
}

.nm-cart-drawer.open {
    right: 0;
}

.nm-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 22px 10px;
    border-bottom: 1px solid var(--secondary-border-color);
}

.nm-cart-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.nm-cart-title h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--text-main);
}

.nm-cart-count-label {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.nm-cart-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
}

.nm-cart-close svg{
    width: 18px;
    height: 18px;
}

.nm-cart-close:hover{
    background: none;
    color: var(--text-main);
}

.nm-cart-empty-msg {
    padding: 22px 22px;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin: 0;
}

.nm-cart-items {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px;
    padding-bottom: 14px;
}

.nm-cart-item {
    display: flex;
    gap: 14px;
    background: var(--bg-dark-card);
    padding: 14px;
    border-radius: var(--border-radius);
    border: 1px solid var(--secondary-border-color);
    margin-bottom: 14px;
    position: relative;
}

.nm-cart-item.is-free-gift {
    border-color: color-mix(in srgb, var(--accent-green) 48%, var(--secondary-border-color));
    background:
        radial-gradient(240px 120px at 0% 0%, color-mix(in srgb, var(--accent-green) 13%, transparent), transparent 70%),
        var(--bg-dark-card);
}

.nm-item-image {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
}

.nm-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding-right: 34px; /* Reserve space for corner remove button */
}

.nm-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.nm-item-top h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.25;
    max-width: 100%;
    color: var(--text-main);
}

.nm-cart-gift-note {
    width: fit-content;
    margin-top: 6px;
    padding: 3px 7px;
    border: 1px solid color-mix(in srgb, var(--accent-green) 50%, var(--secondary-border-color));
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-green) 82%, transparent);
    color: var(--accent-green);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.2;
}

.nm-item-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--secondary-border-color);
    background: transparent;
    cursor: pointer;
    color: var(--primary-red);
}

.nm-item-remove svg {
    display: block;
    color: white;
}
/* On cible spécifiquement la croix du coin */
.nm-cart-item .nm-item-remove--corner {
    /* On annule les styles par défaut de Storefront */
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    /* On s'assure que le bouton est au dessus de tout */
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
    z-index: 10;
    flex: 0 0 auto;

    /* Style visuel */
    background: rgba(248, 113, 113, 0.2) !important; /* Rouge transparent */
    border: 1px solid var(--primary-red) !important;
    border-radius: 50%;
    cursor: pointer;
}

/* On force la couleur et la taille de l'icône SVG */
.nm-item-remove--corner svg {
    display: none !important;
}

.nm-item-remove--corner .nm-item-remove-symbol {
    display: inline-block;
    color: var(--primary-red);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

/* Effet au survol */
.nm-item-remove--corner:hover {
    background: var(--primary-red) !important;
}

.nm-item-remove--corner:hover svg {
    stroke: white !important;
}

.nm-item-remove--corner:hover .nm-item-remove-symbol {
    color: white;
}

.nm-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.nm-item-price {
    color: var(--text-dim);
    font-weight: 500;
    font-size: 0.8rem;
}

.nm-cart-item.is-free-gift .nm-item-price {
    color: var(--accent-green);
    font-weight: 800;
}

.nm-item-price small {
    color: var(--text-dim);
    font-weight: 400;
}

.nm-item-qty {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    flex: 0 0 auto;
}

.nm-qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    font-size: 1.2rem;
}
.nm-qty-btn:hover{
    background: none;
    color: var(--accent-color);
}

.nm-qty-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.nm-qty-val {
    min-width: 3px;
    text-align: center;
    font-weight: 400;
    color: var(--text-main);
}

.nm-cart-footer {
    position: relative;
    margin-top: auto;
    flex: 0 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 18px 22px 22px;
    border-top: 1px solid var(--secondary-border-color);
    background: var(--bg-dark);
}

.nm-cart-summary {
    margin-bottom: 14px;
}

.nm-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--secondary-border-color);
    border-radius: 10px;
    background: var(--bg-dark);
}

.nm-cart-total-label {
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.9rem;
}

.nm-cart-total-amount {
    font-weight: 800;
}

.nm-form-group {
    margin-bottom: 14px;
}

.nm-email-coupon-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
}

.nm-email-coupon-row.is-coupon-on {
    grid-template-columns: 1fr 1fr;
}

.nm-email-coupon-row .nm-form-group {
    margin-bottom: 0;
    min-width: 0;
}

.nm-form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.nm-form-group label span {
    color: var(--text-dim);
    font-weight: 400;
    font-size: 0.8rem;
}

.nm-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--secondary-border-color);
    color: var(--text-main);
    padding: 12px 12px;
    border-radius: 10px;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
}

.nm-input::placeholder {
    color: var(--text-dim);
}

.nm-input.nm-has-error {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-red) 25%, transparent);
}

.nm-field-error {
    margin-top: 8px;
    font-size: 0.65rem;
    color: var(--primary-red);
}

/* Coupon button removed: apply on Enter */

.nm-toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 14px;
    color: var(--text-dim);
}

.nm-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    flex: 0 0 auto;
}

.nm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.nm-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--secondary-border-color);
    transition: 0.25s;
    border-radius: 999px;
}

.nm-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-main);
    transition: 0.25s;
    border-radius: 999px;
}

.nm-switch input:checked + .nm-slider {
    background-color: var(--primary-color);
}

.nm-switch input:checked + .nm-slider:before {
    transform: translateX(20px);
}

.nm-toggle-label {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.nm-terms-box {
    background: var(--bg-dark);
    border: 1px solid var(--secondary-border-color);
    padding: 14px;
    border-radius: var(--border-radius);
    margin-bottom: 14px;
}

.nm-checkbox-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.8rem;
    gap: 10px;
}

.nm-terms-title span {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 400;
}

.nm-checkbox-container input {
    display: none;
}

.nm-checkmark {
    width: 18px;
    height: 18px;
    border: 1px solid var(--bg-dark-light);
    border-radius: 6px;
    display: inline-block;
    position: relative;
    flex: 0 0 auto;
}

.nm-checkbox-container input:checked ~ .nm-checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.nm-checkbox-container input:checked ~ .nm-checkmark::after {
    content: "\2713";
    position: absolute;
    color: var(--text-main);
    font-size: 12px;
    left: 3px;
    top: 0;
}

.nm-checkbox-container.nm-has-error .nm-checkmark {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-red) 25%, transparent);
}

.nm-terms-text {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin: 10px 0 0;
    line-height: 1.4;
}

.nm-terms-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.nm-mt-15 {
    margin-top: 12px;
}

.nm-cart-actions {
    display: flex;
    gap: 12px;
    margin: 12px 0 14px;
}

.nm-btn-outline {
    flex: 1;
    background: var(--bg-dark-card);
    border: 1px solid var(--bg-dark-light);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s ease-in-out;
}

.nm-btn-outline:hover{
    background-color: var(--bg-dark-light);
    color: var(--text-main);
    border: 1px solid var(--bg-dark-light);
}

.nm-btn-checkout {
    flex: 1;
    background: var(--primary-color);
    border: none;
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s ease-in-out;
    box-shadow: none;
}

.nm-btn-checkout:hover{
    background-color: var(--accent-color);
    color: var(--text-main);
    border: none;
    box-shadow: none;
}

.nm-pay-with-divider {
    text-align: center;
    border-bottom: 1px solid var(--secondary-border-color);
    line-height: 0.1em;
    margin: 10px 0 14px;
}

.nm-pay-with-divider span {
    background: var(--bg-dark);
    padding: 0 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.nm-alt-payments {
    display: flex;
    gap: 12px;
}

.nm-btn-alt {
    flex: 1;
    background: var(--bg-discord);
    border: 1px solid var(--secondary-border-color);
    color: var(--text-main);
    padding: 10px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s ease-in-out;
}

.nm-btn-alt:hover{
    background-color: var(--bg-discord-hover);
    color: var(--text-main);
    border: 1px solid var(--bg-discord-hover);
}

@media (max-width: 500px) {
    .nm-cart-drawer { width: 100%; right: -100%; border-left: none; }
    .nm-cart-actions { flex-direction: column; }
    .nm-alt-payments { flex-direction: column; }
    .nm-email-coupon-row.is-coupon-on { grid-template-columns: 1fr; }
}
