/* ==================================================================
   Commandes Types — front (cartes + accordéon)
   ================================================================== */

.ct-cards-wrapper {
    font-family: 'Quicksand', sans-serif;
    max-width: 1200px;
    margin: 20px auto;
}

/* ---------- Barre top / bottom (Tout ajouter au panier) ---------- */
.ct-topbar,
.ct-bottombar {
    display: flex;
    justify-content: flex-end;
    margin: 15px 0;
}

.ct-btn-add-all {
    background: #829B82;
    color: #fff;
    border: none;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.ct-btn-add-all:hover:not(:disabled) {
    background: #6d8568;
}

.ct-btn-add-all:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---------- Grille de cartes ---------- */
.ct-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.ct-card {
    background: #fff;
    border: 1px solid #e1e4e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.ct-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.ct-card.is-open {
    grid-column: 1 / -1;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* ---------- Header de carte ---------- */
.ct-card-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.ct-card-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
    padding-right: 90px;
}

.ct-card-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: #777;
}

.ct-card-code {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
}

.ct-card-toggle {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #555;
    transition: background 0.15s ease;
    z-index: 10;
    display: inline-block;
    user-select: none;
    -webkit-user-select: none;
}

.ct-card-toggle:hover {
    background: #f5f5f5;
}

.ct-card-toggle-label-close,
.ct-card.is-open .ct-card-toggle-label-open {
    display: none;
}

.ct-card.is-open .ct-card-toggle-label-close {
    display: inline;
}

.ct-card-chevron {
    display: inline-block;
    transition: transform 0.2s ease;
    margin-left: 4px;
}

.ct-card.is-open .ct-card-chevron {
    transform: rotate(180deg);
}

/* ---------- Résumé (carte fermée) ---------- */
.ct-card-summary {
    padding: 0 20px;
    transition: padding 0.2s ease;
}

.ct-card-summary:not(:empty) {
    padding: 12px 20px;
    border-bottom: 1px dashed #eee;
    background: #fafbf8;
}

.ct-card-summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    color: #333;
}

.ct-card-summary-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ct-card-summary-qty {
    font-weight: 600;
    color: #829B82;
}

.ct-card-summary-actions {
    display: flex;
    gap: 6px;
}

.ct-card-summary-btn {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    color: #666;
}

.ct-card-summary-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.ct-card-summary-btn.is-remove {
    color: #c0392b;
    border-color: #e8b8b1;
}

/* ---------- Corps (accordéon ouvert) ---------- */
.ct-card-body {
    padding: 20px;
    background: #fdfdfd;
}

.ct-card-body-loader {
    text-align: center;
    padding: 30px;
    color: #888;
    font-style: italic;
}

.ct-card.is-loaded .ct-card-body-loader {
    display: none;
}

/* ---------- Catégories + produits (corps ouvert) ---------- */
.ct-order-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ct-category-title {
    margin: 0 0 10px;
    padding: 8px 12px;
    background: #829B82;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border-radius: 4px;
}

.ct-category-items {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ct-product {
    display: grid;
    grid-template-columns: 100px 1fr auto 280px;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.ct-product.is-inactive {
    opacity: 0.5;
    pointer-events: none;
}

.ct-product-thumb img {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
}

.ct-product-infos {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.ct-product-sku {
    margin: 0;
    font-size: 11px;
    color: #888;
}

.ct-product-title {
    font-weight: 700;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.ct-product-title:hover {
    color: #829B82;
}

.ct-product-desc,
.ct-product-uom {
    margin: 0;
    font-size: 12px;
    color: #666;
}

.ct-product-docs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ct-doc-link {
    display: inline-block;
    padding: 3px 8px;
    background: #f3f3f3;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    text-decoration: none;
    text-align: center;
}

.ct-doc-link:hover {
    background: #829B82;
    color: #fff;
}

.ct-product-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.ct-variation-select {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
}

.ct-product-price {
    font-weight: 700;
    color: #333;
    font-size: 14px;
    text-align: center;
}

.ct-product-qty {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    height: 36px;
}

.ct-qty-minus,
.ct-qty-plus {
    background: #f3f3f3;
    border: none;
    width: 36px;
    height: 100%;
    font-size: 18px;
    cursor: pointer;
    color: #555;
}

.ct-qty-minus:hover,
.ct-qty-plus:hover {
    background: #e5e5e5;
}

.ct-qty-input {
    border: none;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    text-align: center;
    width: 60px;
    height: 100%;
    font-size: 14px;
    -moz-appearance: textfield;
}

.ct-qty-input::-webkit-inner-spin-button,
.ct-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ct-product-total {
    font-weight: 600;
    text-align: center;
    color: #829B82;
    font-size: 13px;
}

.ct-product-add-btn {
    background: #829B82;
    color: #fff;
    border: none;
    padding: 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.ct-product-add-btn:hover:not(:disabled) {
    background: #6d8568;
}

.ct-product-add-btn.is-disabled,
.ct-product-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ct-empty {
    text-align: center;
    color: #888;
    padding: 30px;
    font-style: italic;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .ct-product {
        grid-template-columns: 80px 1fr;
        grid-template-areas:
            "thumb infos"
            "docs  docs"
            "ctrl  ctrl";
    }
    .ct-product-thumb   { grid-area: thumb; }
    .ct-product-infos   { grid-area: infos; }
    .ct-product-docs    { grid-area: docs; flex-direction: row; }
    .ct-product-controls{ grid-area: ctrl; }
}

@media (max-width: 600px) {
    .ct-cards-grid {
        grid-template-columns: 1fr;
    }
    .ct-btn-add-all {
        width: 100%;
    }
}
