/**
 * Styles pour le checkout multi-enrollment
 * 
 * @package WPTotem_LD_Multi_Enrollment
 */

/* ==========================================================================
   MASQUER LE TITRE DE LA PAGE DE CHECKOUT
   Cible la page avec le shortcode wptldme_checkout
   ========================================================================== */

/* Masquer le titre de la page sur la page de checkout (Twenty Twenty-Five et thèmes courants) */
.wptldme-checkout-page .entry-title,
.wptldme-checkout-page .page-title,
.wptldme-checkout-page .wp-block-post-title,
.wptldme-checkout-page article > header,
.wptldme-checkout-page .entry-header,
body.page-template-default.wptldme-checkout-page h1.wp-block-post-title {
    display: none !important;
}

/* ==========================================================================
   BOUTONS DE CHOIX : Individuel / Groupe
   ========================================================================== */

.wptldme-enrollment-choice {
    margin: 20px 0;
}

.wptldme-choice-buttons {
    display: flex;
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.wptldme-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    border: none;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wptldme-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.wptldme-btn-icon {
    display: flex;
    align-items: center;
}

.wptldme-btn-icon svg {
    width: 22px;
    height: 22px;
}

.wptldme-btn-text {
    white-space: nowrap;
}

/* ==========================================================================
   RESPONSIVE - Boutons empilés sur mobile
   ========================================================================== */

@media (max-width: 768px) {
    .wptldme-choice-buttons {
        display: block !important;
    }
    
    .wptldme-choice-buttons tr {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .wptldme-choice-buttons td {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
    }
    
    .wptldme-btn {
        width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
    
    .wptldme-btn-individual,
    .wptldme-btn-group {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
}

/* Bouton Individuel - Vert */
.wptldme-btn-individual {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.wptldme-btn-individual:hover {
    background: linear-gradient(135deg, #219a52 0%, #27ae60 100%);
}

/* Bouton Groupe - Violet */
.wptldme-btn-group {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.wptldme-btn-group:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
}

/* Responsive - empiler sur petit écran */
@media (max-width: 500px) {
    .wptldme-choice-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .wptldme-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}

/* Animation de transition vers le formulaire */
.wptldme-enrollment-form {
    animation: wptldme-fade-in 0.4s ease;
}

@keyframes wptldme-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bouton retour vers le choix */
.wptldme-back-to-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px 15px;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wptldme-back-to-choice:hover {
    background: #e8e8e8;
    color: #333;
}

.wptldme-back-to-choice svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   BOUTONS SUR LA PAGE COURS LEARNDASH
   ========================================================================== */

/* Bouton personnalisé sur la page du cours LearnDash */
.wptldme-custom-button-wrapper {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.wptldme-multi-enrollment-button {
    display: inline-block;
    padding: 12px 30px;
    background-color: #0073aa;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    border: none;
    cursor: pointer;
}

.wptldme-multi-enrollment-button:hover {
    background-color: #005177;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.wptldme-button-original {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.wptldme-after-content-button {
    margin: 30px 0;
    text-align: center;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 8px;
}

.wptldme-after-content-button .wptldme-multi-enrollment-button {
    display: inline-block;
}

/* Checkout Page */
.wptldme-checkout-wrapper {
    display: block;
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Layout 2 colonnes si infos cours présentes */
.wptldme-checkout-wrapper:has(.wptldme-course-info) {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    max-width: 1200px;
}

@media (max-width: 768px) {
    .wptldme-checkout-wrapper:has(.wptldme-course-info) {
        grid-template-columns: 1fr;
    }
}

/* Course Info */
.wptldme-course-info {
    background: #f9f9f9;
    padding: 2rem;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.wptldme-course-info h2 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.wptldme-course-thumbnail {
    margin: 1rem 0;
    border-radius: 4px;
    overflow: hidden;
}

.wptldme-course-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.wptldme-course-excerpt {
    margin: 1rem 0;
    line-height: 1.6;
    color: #666;
}

.wptldme-pricing-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #ddd;
}

.wptldme-price-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.wptldme-unit-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: #27ae60;
    margin: 0;
}

/* Enrollment Form */
.wptldme-enrollment-form {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.wptldme-enrollment-form h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.3rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

/* Include Purchaser */
.wptldme-include-purchaser {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #e8f4f8;
    border-radius: 4px;
}

.wptldme-include-purchaser label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.wptldme-include-purchaser input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Participants Container */
#wptldme-participants-container {
    margin: 1.5rem 0;
}

.wptldme-participant {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.wptldme-participant:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.wptldme-participant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #ddd;
}

.wptldme-participant-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.wptldme-participant-header .participant-number {
    color: #3498db;
}

.wptldme-remove-participant {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: background 0.2s ease;
}

.wptldme-remove-participant:hover {
    background: #c0392b;
}

.wptldme-remove-participant .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Participant Fields */
.wptldme-participant-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .wptldme-participant-fields {
        grid-template-columns: 1fr 1fr;
    }
    
    .wptldme-participant-fields .wptldme-field:first-child {
        grid-column: 1 / -1;
    }
}

.wptldme-field {
    display: flex;
    flex-direction: column;
}

.wptldme-field label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.wptldme-field .required {
    color: #e74c3c;
}

.wptldme-field input {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.wptldme-field input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.wptldme-field input.error {
    border-color: #e74c3c;
}

.wptldme-field-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: none;
}

.wptldme-field input.error + .wptldme-field-error {
    display: block;
}

/* Add Participant Button */
#wptldme-add-participant {
    width: 100%;
    padding: 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

#wptldme-add-participant:hover {
    background: #2980b9;
}

#wptldme-add-participant:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Summary */
.wptldme-summary {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.wptldme-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    font-size: 1rem;
}

.wptldme-summary-total {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 2px solid #ddd;
    font-size: 1.2rem;
    font-weight: bold;
    color: #27ae60;
}

/* Actions */
.wptldme-actions {
    margin-top: 1.5rem;
}

#wptldme-proceed-checkout {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

#wptldme-proceed-checkout:hover:not(:disabled) {
    background: #229954;
}

#wptldme-proceed-checkout:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Errors */
.wptldme-errors {
    margin-top: 1rem;
    padding: 1rem;
    background: #fee;
    border: 1px solid #e74c3c;
    border-radius: 4px;
}

.wptldme-error {
    color: #c0392b;
    margin: 0.5rem 0;
}

.wptldme-error:first-child {
    margin-top: 0;
}

.wptldme-error:last-child {
    margin-bottom: 0;
}

/* Loading State */
.wptldme-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.wptldme-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: wptldme-spin 1s linear infinite;
}

@keyframes wptldme-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .wptldme-enrollment-form {
        padding: 1rem;
    }
    
    .wptldme-course-info {
        position: static;
        margin-bottom: 1rem;
    }
    
    .wptldme-participant {
        padding: 1rem;
    }
}
