/* Packs et Procédures Plugin Styles */

.packs-procedures-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Filters Section */
.packs-filters {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.filter-group select,
.filter-group input {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

.filter-button {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    height: fit-content;
}

.filter-button:hover {
    background: #005a87;
}

.filter-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Loading State */
.packs-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Packs Header Info */
.packs-header-info {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
    grid-column: 1 / -1;
    width: 100%;
}

.packs-title {
    font-size: 28px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 10px 0;
}

.packs-count {
    font-size: 18px;
    color: #6c757d;
    margin: 0;
    font-weight: 500;
}

/* Selected Pack Info */
.selected-pack-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    border-radius: 8px;
    border: 2px solid #28a745;
    display: none;
}

.selected-pack-title {
    font-size: 16px;
    font-weight: 600;
    color: #155724;
    margin: 0 0 5px 0;
}

.selected-pack-name {
    font-size: 18px;
    font-weight: 700;
    color: #28a745;
    margin: 0 0 5px 0;
}

.selected-pack-price {
    font-size: 16px;
    font-weight: 600;
    color: #155724;
    margin: 0;
}

/* Results Grid */
.packs-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

/* Single pack - full width */
.packs-results:has(.package-card:only-child) {
    grid-template-columns: 1fr;
}

/* 2 packs - 2 columns */
.packs-results:has(.package-card:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

/* 3 packs - 3 columns */
.packs-results:has(.package-card:nth-child(3):last-child) {
    grid-template-columns: repeat(3, 1fr);
}

/* 4+ packs - 2 columns */
.packs-results:has(.package-card:nth-child(4)) {
    grid-template-columns: repeat(2, 1fr);
}

/* Package Card */
.package-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.package-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.package-card.popular {
    border-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
}

.package-card.popular::before {
    content: "Recommandé";
    position: absolute;
    top: -10px;
    right: 20px;
    background: #03204B;
    color: white;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.package-header {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 8px 8px 0 0;
    margin: -20px -20px 15px -20px;
}

.package-header.recommended {
    background-color: #CF0921;
    color: white;
    border-bottom: 2px solid #CF0921;
}

.package-header.standard {
    background-color: #03204B;
    color: white;
    border-bottom: 2px solid #03204B;
}

.package-name {
    font-size: 18px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 5px 0;
}

.package-header .package-name {
    color: white;
    text-align: center;
}

/* Procedure type badge */
.package-procedure-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    margin: 0;
}

.package-procedure-badge.extra-judiciaire {
    background-color: #CF0921;
}

.package-procedure-badge.judiciaire {
    background-color: #03204B;
}

.package-description {
    color: #000000;
    font-size: 17px;
    line-height: 1.5;
    margin: 0 0 15px 0;
}

.package-features {
    margin: 15px 0;
}

.package-features h4 {
    font-size: 15px;
    font-weight: 600;
    color: #000000;
    margin: 0 0 8px 0;
    text-align: center;
}

.package-features ul {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

.package-features li {
    font-size: 17px;
    color: #000000;
    padding: 2px 0;
    position: relative;
    padding-left: 15px;
    list-style: none !important;
}

.package-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

.package-pricing {
    margin: 10px 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.package-price {
    font-size: 24px;
    font-weight: 700;
    color: #03204B;
    margin: 0;
}

.package-original-price {
    font-size: 16px;
    color: #6c757d;
    text-decoration: line-through;
    margin: 0 0 5px 0;
}

.package-range {
    font-size: 15px;
    color: #000000;
    margin: 5px 0 0 0;
}

.package-actions {
    margin-top: auto;
    padding-top: 20px;
}

.add-to-cart-btn {
    width: 100%;
    background: #03204B;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.add-to-cart-btn:hover {
    background: #03204B;
    color: white;
    text-decoration: none;
}

.add-to-cart-btn:disabled {
    background: #03204B;
    cursor: not-allowed;
}

.add-to-cart-btn.loading {
    background: #03204B;
    cursor: not-allowed;
}

.add-to-cart-btn.loading::after {
    content: " ...";
    animation: dots 1.5s infinite;
}

.add-to-cart-btn.selected {
    background: #cf0921;
    color: white;
}

.add-to-cart-btn.selected:hover {
    background: #cf0921;
}

@keyframes dots {
    0%, 20% { content: " ..."; }
    40% { content: " ...."; }
    60% { content: " ....."; }
    80%, 100% { content: " ......"; }
}

/* No Results */
.no-results {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    grid-column: 1 / -1;
}

.no-results h3 {
    margin: 0 0 10px 0;
    color: #495057;
}

/* Responsive Design */
@media (max-width: 768px) {
    .packs-procedures-container {
        padding: 15px;
    }
    
    .packs-filters {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .procedure-type-cards {
        flex-direction: column;
    }
    
    .procedure-card {
        min-width: auto;
    }
    
    .money-claim-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .money-claim-container > label {
        min-width: auto;
        margin-bottom: 10px;
    }
    
    .money-claim-cards {
        flex-direction: column;
    }
    
    .money-claim-card {
        min-width: auto;
    }
    
    .amount-fields {
        flex-direction: column;
        align-items: stretch;
    }
    
    .amount-fields label {
        min-width: auto;
        margin-bottom: 10px;
    }
    
    .amount-fields select,
    .amount-fields input {
        width: 100%;
        min-width: auto;
    }
    
    .packs-results {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    /* Override :has() selectors on mobile */
    .packs-results:has(.package-card:only-child),
    .packs-results:has(.package-card:nth-child(2):last-child),
    .packs-results:has(.package-card:nth-child(3):last-child),
    .packs-results:has(.package-card:nth-child(4)) {
        grid-template-columns: 1fr !important;
    }
    
    .package-card {
        padding: 15px;
    }
    
    .package-name {
        font-size: 16px;
    }
    
    .package-price {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .packs-procedures-container {
        padding: 10px;
    }
    
    .packs-filters {
        padding: 15px;
    }
    
    .filter-group select,
    .filter-group input {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .filter-button {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .packs-results {
        grid-template-columns: 1fr !important;
    }
    
    /* Override :has() selectors on small mobile */
    .packs-results:has(.package-card:only-child),
    .packs-results:has(.package-card:nth-child(2):last-child),
    .packs-results:has(.package-card:nth-child(3):last-child),
    .packs-results:has(.package-card:nth-child(4)) {
        grid-template-columns: 1fr !important;
    }
    
    .package-card {
        padding: 12px;
    }
    
    .package-name {
        font-size: 15px;
    }
    
    .package-price {
        font-size: 18px;
    }
}

/* WooCommerce Integration */
.woocommerce .add-to-cart-btn {
    background: #0073aa;
}

.woocommerce .add-to-cart-btn:hover {
    background: #005a87;
}

/* Animation for loading */
.packs-results.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success message */
.pack-added-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 14px;
}

/* Error message */
.pack-error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 10px 15px;
    margin: 10px 0;
    font-size: 14px;
}

/* Hide the refresh button */
#filter-packs {
    display: none !important;
}

/* Money claim question section */
.packs-filters .money-claim-question {
    grid-column: 1 / -1;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #007cba;
}

.money-claim-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.money-claim-container > label {
    font-size: 16px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0;
}

.money-claim-cards {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.money-claim-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.money-claim-card input[type="radio"] {
    display: none;
}

.money-claim-card label {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.money-claim-card .checkmark {
    color: #28a745;
    font-weight: bold;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.money-claim-card input[type="radio"]:checked + label {
    color: #03204B;
}

.money-claim-card input[type="radio"]:checked + label .checkmark {
    opacity: 1;
}

.money-claim-card:has(input[type="radio"]:checked) {
    border-color: #fff!imporatnat;
    background: #fff!important;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.2);
}

/* Separate procedure type section */
.packs-filters .procedure-type-group {
    grid-column: 1 / -1;
    margin-bottom: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.procedure-type-cards {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.procedure-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.procedure-card:hover {
    border-color: #007cba;
    background: #f0f8ff;
}

.procedure-card input[type="radio"] {
    display: none;
}

.procedure-card label {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.procedure-card .checkmark {
    color: #28a745;
    font-weight: bold;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* Extra-judiciaire styling */
.procedure-card:has(input[value="extra-judiciaire"]) input[type="radio"]:checked + label {
    color: white;
}

.procedure-card:has(input[value="extra-judiciaire"]) input[type="radio"]:checked + label .checkmark {
    opacity: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #CF0921;
    color: white;
    font-size: 12px;
    font-weight: bold;
    /* Hide the original text content and use our custom check */
    font-size: 0;
}

.procedure-card:has(input[value="extra-judiciaire"]) input[type="radio"]:checked + label .checkmark::before {
    content: "✓";
    font-size: 12px;
}

.procedure-card:has(input[value="extra-judiciaire"]):has(input[type="radio"]:checked) {
    border-color: #CF0921;
    background: linear-gradient(135deg, #CF0921 0%, #a0071a 100%);
    box-shadow: 0 2px 8px rgba(207, 9, 33, 0.3);
}

/* Judiciaire styling */
.procedure-card:has(input[value="judiciaire"]) input[type="radio"]:checked + label {
    color: white;
}

.procedure-card:has(input[value="judiciaire"]) input[type="radio"]:checked + label .checkmark {
    opacity: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #03204B;
    color: white;
    font-size: 12px;
    font-weight: bold;
    /* Hide the original text content and use our custom check */
    font-size: 0;
}

.procedure-card:has(input[value="judiciaire"]) input[type="radio"]:checked + label .checkmark::before {
    content: "✓";
    font-size: 12px;
}

.procedure-card:has(input[value="judiciaire"]):has(input[type="radio"]:checked) {
    border-color: #03204B;
    background: linear-gradient(135deg, #03204B 0%, #021635 100%);
    box-shadow: 0 2px 8px rgba(3, 32, 75, 0.3);
}

/* Amount fields - hidden by default */
.amount-fields {
    transition: all 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.amount-fields label {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0;
}

.amount-fields select,
.amount-fields input {
    font-size: 14px;
    padding: 10px 12px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    background: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    width: 200px;
}

.amount-fields select:focus,
.amount-fields input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.25);
}
/* Error message */
 .pack-error-message {
     background: #f8d7da;
     color: #721c24;
     border: 1px solid #f5c6cb;
     border-radius: 4px;
     padding: 10px 15px;
     margin: 10px 0;
     font-size: 14px;
 }

/* Procedure validation message */
.procedure-validation-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 10px 15px;
    margin: 10px 0 0 0;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
 /* Hide the refresh button */
 #filter-packs {
     display: none !important;
 }