/**
 * Billetterie B2B - Professional Styles
 * Per-product tier pricing with category grouping
 */

.billetterie-container {
    max-width: 100%;
    width: 100%;
    margin: 20px 0;
    padding: 0;
    font-family: inherit;
}

/* Override theme 50% width rule ONLY for billetterie row using :has() */
@media screen and (min-width: 75em) {
    /* Use :has() to target row containing billetterie */
    main.page-main .pccform>fieldset>.row:has(.billetterie-container),
    main.page-main form.pccform>fieldset>.row:has(.billetterie-container) {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* Full width for columns containing billetterie */
.row:has(.billetterie-container) > [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Hide empty label column next to billetterie */
.row:has(.billetterie-container) > .col-md-2:empty {
    display: none !important;
}

/* Fallback: ensure billetterie table takes full width of its container */
.billetterie-category,
.billetterie-table,
.billetterie-summary {
    width: 100%;
}

.billetterie-title {
    margin-bottom: 25px;
    font-size: 1.6em;
    color: #333;
    text-align: center;
}

/* Category Sections */
.billetterie-category {
    margin-bottom: 30px;
}

.billetterie-category-title {
    background: linear-gradient(135deg, #00a9e0 0%, #0090c0 100%);
    color: white;
    padding: 12px 20px;
    margin: 0 0 0 0;
    font-size: 1.15em;
    font-weight: 600;
    border-radius: 5px 5px 0 0;
    letter-spacing: 0.5px;
}

/* Table Styles */
.billetterie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-radius: 0 0 5px 5px;
    overflow: hidden;
}

.billetterie-table th,
.billetterie-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.billetterie-table thead th {
    background-color: #f8f9fa;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e0e0e0;
}

/* Column widths */
.billetterie-table .col-product {
    width: 35%;
}

.billetterie-table .col-pricing {
    width: 30%;
}

.billetterie-table .col-qty {
    width: 15%;
    text-align: center;
}

.billetterie-table .col-total {
    width: 20%;
    text-align: right;
}

.billetterie-table thead th.col-qty,
.billetterie-table thead th.col-total {
    text-align: center;
}

/* Product rows */
.billetterie-table tbody tr {
    transition: all 0.2s ease;
}

.billetterie-table tbody td {
    vertical-align: top;
}

.billetterie-table tbody tr:hover {
    background-color: #f8f9fa;
}

.billetterie-table tbody tr.has-qty {
    background-color: #e8f5e9;
}

.billetterie-table tbody tr.has-qty:hover {
    background-color: #dcedc8;
}

/* Product name and badge */
.product-name {
    font-weight: 500;
    color: #333;
    display: block;
}

.product-description {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
    line-height: 1.4;
}

.min-qty-badge,
.max-qty-badge {
    display: inline-block;
    color: white;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    font-weight: 600;
}

.min-qty-badge {
    background-color: #ff9800;
}

.max-qty-badge {
    background-color: #e91e63;
    margin-left: 4px;
}

/* Old price (crossed out) */
.old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 0.85em;
    display: block;
    margin-bottom: 3px;
}

/* Single price (no tiers) */
.single-price {
    font-size: 1.1em;
    font-weight: 600;
    color: #00a9e0;
}

/* Tier pricing display */
.tier-pricing {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tier-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: #f5f5f5;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.tier-row.active {
    background: #e0f4fc;
    border-color: #00a9e0;
}

.tier-range {
    color: #666;
    font-weight: 500;
}

.tier-price {
    color: #00a9e0;
    font-weight: 700;
}

.tier-row.active .tier-price {
    color: #0090c0;
}

/* Next tier hint */
.next-tier-hint {
    margin-top: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 4px;
    font-size: 0.9em;
    color: #e65100;
    font-weight: 500;
    border-left: 3px solid #ff9800;
}

.next-tier-hint .hint-icon {
    margin-right: 5px;
}

/* Quantity input wrapper */
.qty-wrapper {
    display: inline-flex;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.qty-wrapper:focus-within {
    border-color: #00a9e0;
    box-shadow: 0 0 0 3px rgba(0, 169, 224, 0.15);
}

.qty-wrapper:hover {
    border-color: #bbb;
}

/* Quantity buttons */
.qty-btn {
    width: 36px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.qty-btn:hover {
    background: #e0e0e0;
    color: #00a9e0;
}

.qty-btn:active {
    background: #d0d0d0;
}

.qty-minus {
    border-right: 1px solid #ddd;
}

.qty-plus {
    border-left: 1px solid #ddd;
}

/* Quantity input */
.billetterie-table .qty-input {
    width: 50px;
    padding: 8px 4px;
    text-align: center;
    border: none;
    font-size: 15px;
    font-weight: 600;
    -moz-appearance: textfield;
}

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

.billetterie-table .qty-input:focus {
    outline: none;
}

/* Line total */
.billetterie-table .line-total {
    font-weight: 700;
    font-size: 1.05em;
    color: #333;
}

/* Category subtotal row */
.billetterie-table tfoot .category-subtotal-row {
    background: #f0f4f7;
    border-top: 2px solid #e0e0e0;
}

.billetterie-table tfoot .category-subtotal-row td {
    padding: 12px 15px;
    font-weight: 600;
    color: #444;
    border-bottom: 1px solid #e0e0e0;
}

.billetterie-table tfoot td.subtotal-label {
    text-align: left;
    width: 35%;
}

.billetterie-table tfoot .subtotal-label .subtotal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.billetterie-table tfoot .subtotal-label .subtotal-text {
    font-weight: 600;
}

.billetterie-table tfoot .subtotal-label .subtotal-category-name {
    display: block;
    margin-top: 4px;
    font-weight: 600;
}

.billetterie-table tfoot .subtotal-label .category-min-badge,
.billetterie-table tfoot .subtotal-label .category-max-badge {
    display: inline-block;
    vertical-align: middle;
}

.billetterie-table tfoot td.subtotal-alert {
    text-align: left;
    width: 30%;
    vertical-align: middle;
}

.billetterie-table tfoot td.subtotal-qty {
    text-align: center;
    font-size: 1.1em;
    width: 15%;
    vertical-align: middle;
}

.billetterie-table tfoot td.subtotal-amount {
    text-align: right;
    font-size: 1.1em;
    color: #00a9e0;
    width: 20%;
    vertical-align: middle;
}

.category-min-badge,
.category-max-badge {
    display: inline-block;
    color: white;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.category-min-badge {
    background-color: #ff9800;
}

.category-max-badge {
    background-color: #e91e63;
}

/* Category alert - same style as next-tier-hint */
.category-min-alert {
    display: inline-block;
    padding: 6px 10px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 4px;
    font-size: 0.9em;
    color: #e65100;
    font-weight: 500;
    border-left: 3px solid #ff9800;
}

.category-min-alert .alert-icon {
    margin-right: 5px;
}

.category-min-alert .alert-message {
    /* inline with icon */
}

/* Summary section */
.billetterie-summary {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
}

.billetterie-summary .grand-total-row {
    background: linear-gradient(135deg, #00a9e0 0%, #0090c0 100%);
    color: white;
    padding: 18px 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 12px rgba(0, 169, 224, 0.3);
}

.billetterie-summary .grand-total-label {
    font-weight: 600;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.billetterie-summary .grand-total-value {
    font-weight: 700;
    font-size: 1.5em;
}

/* Responsive */
@media (max-width: 768px) {
    .billetterie-table {
        font-size: 13px;
    }

    .billetterie-table th,
    .billetterie-table td {
        padding: 10px 8px;
    }

    .qty-btn {
        width: 32px;
        height: 36px;
        font-size: 16px;
    }

    .billetterie-table .qty-input {
        width: 40px;
        padding: 6px 2px;
        font-size: 14px;
    }

    .tier-pricing {
        flex-direction: column;
        gap: 4px;
    }

    .tier-row {
        font-size: 0.8em;
        padding: 3px 8px;
    }

    .billetterie-category-title {
        font-size: 1em;
        padding: 10px 15px;
    }

    .billetterie-summary .grand-total-row {
        padding: 15px 20px;
        width: 100%;
        justify-content: space-between;
    }

    .col-product {
        width: 40% !important;
    }

    .col-pricing {
        width: 25% !important;
    }
}

/* Mobile pricing - hidden by default */
.mobile-pricing {
    display: none;
}

@media (max-width: 480px) {
    .billetterie-table .col-pricing {
        display: none;
    }

    .billetterie-table thead th.col-pricing {
        display: none;
    }

    .col-product {
        width: 50% !important;
    }

    .col-qty {
        width: 25% !important;
    }

    .col-total {
        width: 25% !important;
    }

    /* Show mobile pricing under product name */
    .mobile-pricing {
        display: block;
        margin-top: 8px;
    }

    .mobile-pricing .mobile-price {
        display: block;
        font-weight: 700;
        font-size: 1em;
        color: #00a9e0;
        padding: 6px 10px;
        background: linear-gradient(135deg, #e8f4fc 0%, #d4ecf7 100%);
        border-radius: 4px;
        border-left: 3px solid #00a9e0;
    }

    /* Mobile tier rows */
    .mobile-tier-pricing {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .mobile-tier-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 10px;
        background: #f5f5f5;
        border-radius: 4px;
        font-size: 0.85em;
        border: 1px solid #e0e0e0;
    }

    .mobile-tier-row.active {
        background: linear-gradient(135deg, #e0f4fc 0%, #d4ecf7 100%);
        border-color: #00a9e0;
        border-left: 3px solid #00a9e0;
    }

    .mobile-tier-row .tier-range {
        color: #666;
        font-weight: 500;
    }

    .mobile-tier-row .tier-price {
        color: #00a9e0;
        font-weight: 700;
    }

    .mobile-tier-row.active .tier-price {
        color: #0090c0;
    }

    .mobile-next-tier-hint {
        margin-top: 6px;
        padding: 5px 8px;
        background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
        border-radius: 4px;
        font-size: 0.8em;
        color: #e65100;
        font-weight: 500;
        border-left: 3px solid #ff9800;
    }

    .mobile-next-tier-hint .hint-icon {
        margin-right: 4px;
    }

    /* Category subtotal on mobile */
    .billetterie-table tfoot .subtotal-label {
        font-size: 0.85em;
    }

    .billetterie-table tfoot .subtotal-label .subtotal-category-name {
        font-size: 0.85em;
    }

    .category-min-badge,
    .category-max-badge {
        font-size: 0.65em;
        padding: 2px 6px;
    }

    .category-min-alert {
        padding: 8px 10px;
        font-size: 0.9em;
        flex-wrap: wrap;
    }
}

/* Override 50% width rule ONLY for billetterie forms */
@media screen and (min-width: 75em) {
    main.page-main .pccform-bon-commande-billetterie>fieldset>.row,
    main.page-main .pccform-bon-commande-billetterie>fieldset>.form-group,
    main.page-main .pccform-b2b-billetterie>fieldset>.row,
    main.page-main .pccform-b2b-billetterie>fieldset>.form-group {
        width: 100% !important;
    }
}

/* Force select/input fields to full width for notheme ContactForms (all stores) */
.pccf.notheme .form-control {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
}

.pccf.notheme select.form-control {
    width: 100% !important;
}
