/**
 * Fichier: assets/css/frontend-sessions.css
 * Styles pour l'affichage des sessions côté frontend
 */

/* Container principal des sessions produit */
.ftm-product-sessions {
    margin: 30px 0;
    padding: 25px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.ftm-product-sessions h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1d2327;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

/* Liste des sessions frontend */
.ftm-sessions-list-frontend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Carte de session */
.ftm-session-card {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.ftm-session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.ftm-session-card.ftm-session-available {
    border-color: #28a745;
}

.ftm-session-card.ftm-session-available:hover {
    border-color: #1e7e34;
    background: #f8fff9;
}

.ftm-session-card.ftm-session-selected {
    border-color: #007bff;
    background: #e7f3ff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.ftm-session-card.ftm-session-full {
    border-color: #dc3545;
    background: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.7;
}

.ftm-session-card.ftm-session-full:hover {
    transform: none;
    box-shadow: none;
}

/* Header de carte */
.ftm-session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.ftm-session-date {
    font-size: 18px;
    font-weight: 700;
    color: #1d2327;
}

.ftm-session-time {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

/* Corps de carte */
.ftm-session-body {
    margin-bottom: 15px;
}

.ftm-session-places {
    margin-bottom: 10px;
}

.ftm-session-location {
    font-size: 14px;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ftm-session-notes {
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
    line-height: 1.4;
}

/* Footer de carte */
.ftm-session-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.ftm-select-session-btn {
    width: 100%;
    padding: 12px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ftm-select-session-btn:hover {
    background: #1e7e34;
    transform: translateY(-1px);
}

.ftm-select-session-btn:active {
    transform: translateY(0);
}

/* Badges de statut */
.ftm-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ftm-badge-available {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ftm-badge-full {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ftm-badge-past {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* Modifications du bouton d'ajout au panier */
.single_add_to_cart_button:disabled {
    background: #6c757d !important;
    border-color: #6c757d !important;
    opacity: 0.6;
    cursor: not-allowed;
}

.single_add_to_cart_button.ftm-session-selected {
    background: #007bff !important;
    border-color: #0056b3 !important;
}

/* Indicateur de sélection */
.ftm-session-card.ftm-session-selected:after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Animations */
@keyframes sessionCardAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ftm-session-card {
    animation: sessionCardAppear 0.4s ease;
}

.ftm-session-card:nth-child(2) {
    animation-delay: 0.1s;
}

.ftm-session-card:nth-child(3) {
    animation-delay: 0.2s;
}

.ftm-session-card:nth-child(4) {
    animation-delay: 0.3s;
}

.ftm-session-card:nth-child(5) {
    animation-delay: 0.4s;
}

/* Pulse pour attirer l'attention */
@keyframes sessionPulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.ftm-session-card.ftm-session-available {
    animation: sessionPulse 2s infinite;
}

.ftm-session-card.ftm-session-selected {
    animation: none;
}

/* Message d'information */
.ftm-session-info-message {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

.ftm-session-info-message strong {
    color: #0c5460;
}

/* États de chargement */
.ftm-product-sessions.loading {
    position: relative;
    pointer-events: none;
}

.ftm-product-sessions.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .ftm-product-sessions {
        margin: 20px 0;
        padding: 20px 15px;
    }
    
    .ftm-sessions-list-frontend {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ftm-session-card {
        padding: 15px;
    }
    
    .ftm-session-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .ftm-session-date {
        font-size: 16px;
    }
    
    .ftm-session-time {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ftm-product-sessions h3 {
        font-size: 18px;
    }
    
    .ftm-session-card {
        padding: 12px;
    }
    
    .ftm-select-session-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* Intégration avec les thèmes populaires */

/* Storefront */
.storefront .ftm-product-sessions {
    margin: 2em 0;
}

/* Astra */
.ast-container .ftm-product-sessions {
    max-width: 100%;
}

/* OceanWP */
.oceanwp-row .ftm-product-sessions {
    width: 100%;
}

/* Twenty Twenty-Three et thèmes blocks */
.wp-block-group .ftm-product-sessions {
    margin: var(--wp--preset--spacing--50) 0;
}

/* Accessibilité */
.ftm-session-card:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.ftm-select-session-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Support du mode sombre */
@media (prefers-color-scheme: dark) {
    .ftm-product-sessions {
        background: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .ftm-product-sessions h3 {
        color: #f0f0f1;
    }
    
    .ftm-session-card {
        background: #1d2327;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .ftm-session-card.ftm-session-available:hover {
        background: #2c3338;
    }
    
    .ftm-session-card.ftm-session-selected {
        background: #2c3338;
        border-color: #007bff;
    }
    
    .ftm-session-header {
        border-color: #3c434a;
    }
    
    .ftm-session-footer {
        border-color: #3c434a;
    }
    
    .ftm-session-date {
        color: #f0f0f1;
    }
    
    .ftm-session-time,
    .ftm-session-location,
    .ftm-session-notes {
        color: #a7aaad;
    }
}

/* Print styles */
@media print {
    .ftm-product-sessions {
        background: white !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .ftm-session-card {
        background: white !important;
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
    
    .ftm-select-session-btn,
    .ftm-session-card.ftm-session-selected:after {
        display: none !important;
    }
}