/**
 * Styles pour l'affichage des produits et la lightbox
 * 
 * @package PhotoClass_Pro
 * @subpackage Frontend/Products
 */

/* ========================================
   Wrapper photo avec icône panier
   ======================================== */

.pcp-photo-wrapper {
    position: relative;
    display: inline-block;
}

.pcp-photo-cart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
}

.pcp-photo-wrapper:hover .pcp-photo-cart-overlay {
    opacity: 1;
}

.pcp-photo-cart-overlay .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: white;
}

/* ========================================
   Lightbox
   ======================================== */

.pcp-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
}

.pcp-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}

.pcp-lightbox-content {
    position: relative;
    width: 90%;
    height: 90%;
    margin: 5% auto;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.pcp-lightbox-close {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: background 0.3s;
}

.pcp-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.pcp-lightbox-inner {
    display: flex;
	flex-direction: row-reverse;
    height: 100%;
}

/* ========================================
   Panneau produits (gauche)
   ======================================== */

.pcp-products-panel {
    width: 20%;
    background: #f9f9f9;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pcp-products-header {
    padding: 20px 15px; /* Augmenté de 15px à 20px en haut/bas */
    background: #2271b1;
    color: white;
    border-bottom: 1px solid #ddd;
    text-align: center;
    min-height: 80px; /* Hauteur minimum ajoutée */
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcp-products-header h3 {
    margin: 0;
    font-size: 18px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%; /* Prend toute la largeur */
}

.pcp-cart-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: white;
    color: #2271b1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

.pcp-cart-icon:hover {
    background: #f0f0f0;
}

.pcp-cart-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.pcp-cart-wrapper {
    position: relative; /* Important pour le positionnement absolu du badge */
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
}

.pcp-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dc3545;
    color: white;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.pcp-cart-icon.has-items {
    animation: pulse 0.5s;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.pcp-products-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ========================================
   Catégories de produits
   ======================================== */

.pcp-product-category {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.pcp-category-title {
    padding: 12px 15px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pcp-category-title:hover {
    background: #e8e8e8;
}

.pcp-category-title.active {
    background: #2271b1;
    color: white;
}

.pcp-category-icon {
    font-size: 12px;
}

.pcp-category-count {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.7;
}

.pcp-category-products {
    padding: 10px;
}

/* ========================================
   Items produits
   ======================================== */

.pcp-product-item {
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
    transition: box-shadow 0.3s;
}

.pcp-product-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pcp-product-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.pcp-product-price {
    font-size: 18px;
    font-weight: bold;
    color: #2271b1;
    margin-bottom: 8px;
}

.pcp-product-desc,
.pcp-product-composition {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.pcp-add-to-cart {
    width: 100%;
    padding: 8px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.pcp-add-to-cart:hover {
    background: #135e96;
}

/* ========================================
   Panneau photo (droite)
   ======================================== */

.pcp-photo-panel {
    width: 80%;
    display: flex;
    flex-direction: row; /* ✅ HORIZONTAL : boutons à gauche et droite */
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #fff;
	border-radius: 8px 0 0 8px;
    column-gap: 20px;
	row-gap: 0px;
}

.pcp-lightbox-image {
    max-width: calc(100% - 200px); /* Réserve 100px de chaque côté pour les boutons */
    max-height: 65vh; /* Max 65% de la hauteur de l'écran */
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 1; /* Permet à l'image de rétrécir si nécessaire */
}

.pcp-photo-nav {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}
/* Anciens styles .pcp-nav-prev/.pcp-nav-next supprimés - voir nouveaux styles .pcp-nav-btn en fin de fichier */

/* ========================================
   Modal sélecteur de photos
   ======================================== */

.pcp-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
}

.pcp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.pcp-modal-content {
    position: relative;
    width: 80%;
    max-width: 1000px;
    max-height: 90%;
    margin: 5% auto;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.pcp-modal-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pcp-modal-title {
    margin: 0;
    font-size: 18px;
}

.pcp-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.pcp-modal-close:hover {
    color: #000;
}

.pcp-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.pcp-modal-footer {
    padding: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========================================
   Grille de sélection photos
   ======================================== */

.pcp-photo-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.pcp-selector-photo {
    position: relative;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.pcp-selector-photo:hover {
    border-color: #2271b1;
}

.pcp-selector-photo.selected {
    border-color: #2271b1;
}

.pcp-selector-photo img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.pcp-selector-check {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    background: #2271b1;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
}

.pcp-selector-photo.selected .pcp-selector-check {
    display: flex;
}

.pcp-selector-check .dashicons {
    color: white;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.pcp-selector-info {
    margin-top: 20px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 4px;
}

/* ========================================
   Notifications
   ======================================== */

.pcp-notification {
    position: fixed;
    bottom: -100px;
    right: 20px;
    background: #2271b1;
    color: white;
    padding: 15px 25px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100001;
    transition: bottom 0.3s;
}

.pcp-notification.show {
    bottom: 20px;
}

/* ========================================
   Loading / Error
   ======================================== */

.pcp-loading,
.pcp-error {
    padding: 40px;
    text-align: center;
    color: #666;
}

.pcp-error {
    color: #d63638;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .pcp-lightbox-inner {
        flex-direction: column-reverse;
    }
    
    .pcp-products-panel,
    .pcp-photo-panel {
        width: 100%;
    }
    
    .pcp-products-panel {
        max-height: 40%;
    }
    
    .pcp-photo-panel {
        height: 60%;
    }
}
/* ========================================
   Système d'onglets produits
   ======================================== */

.pcp-product-tabs {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pcp-tabs-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 10px;
    background: #f0f0f0;
    border-right: 2px solid #ddd;
}

.pcp-tab {
    padding: 10px 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-weight: 500;
    color: #333;
    transition: all 0.3s;
    border-bottom: none;
}

.pcp-tab:hover {
    background: #e8e8e8;
}

.pcp-tab.active {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

.pcp-tabs-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.pcp-tab-content {
    display: none;
}

.pcp-tab-content.active {
    display: block;
}
.pcp-tab-content {
    display: none; /* Masqué par défaut */
}

.pcp-tab-content.active {
    display: grid; /* Affiché en grid SEULEMENT si actif */
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pcp-tab-content .pcp-product-item {
    padding: 6px; /* Réduit de 8px à 6px */
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
    transition: box-shadow 0.3s;
	text-align: center;
}

.pcp-tab-content .pcp-product-item h4 {
    margin: 0 0 3px 0; /* Réduit de 4px à 3px */
    font-size: 12px; /* Réduit de 13px à 12px */
    color: #333;
    line-height: 1.2;
text-align: center;	/* Ajouté pour réduire l'interligne */
}

.pcp-tab-content .pcp-product-price {
    font-size: 14px; /* Réduit de 15px à 14px */
    font-weight: bold;
    color: #2271b1;
    margin-bottom: 4px; /* Réduit de 6px à 4px */
    line-height: 1.2;
	text-align: center;
}

.pcp-tab-content .pcp-product-desc {
    font-size: 10px; /* Réduit de 11px à 10px */
    color: #666;
    margin-bottom: 6px; /* Réduit de 8px à 6px */
    line-height: 1.2;
	text-align: center;
}

.pcp-tab-content .pcp-add-to-cart {
    width: 100%;
    padding: 5px; /* Réduit de 6px à 5px */
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 10px; /* Réduit de 11px à 10px */
    transition: background 0.3s;
}
.pcp-cart-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dc3545;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    margin-left: 10px;
    vertical-align: middle;
}

.pcp-cart-badge:hover {
    transform: scale(1.15);
    transition: transform 0.2s;
}
/* ========================================
   Boutons de navigation gauche/droite
   ======================================== */

.pcp-nav-btn {
    flex-shrink: 0 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 2px solid #2271b1 !important;
    color: #2271b1 !important;
    font-size: 48px !important;
    line-height: 1 !important;
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    border-radius: 50% !important;
    cursor: pointer;
    transition: all 0.3s;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    font-weight: 300;
    box-sizing: border-box !important;
    aspect-ratio: 1/1 !important;
}

.pcp-nav-btn:hover {
    background: #2271b1;
    color: white;
    transform: scale(1.1);
}

.pcp-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pcp-nav-prev {
    order: -1; /* Force à gauche */
}

.pcp-nav-next {
    order: 1; /* Force à droite */
}

.pcp-lightbox-image {
    order: 0; /* Image au milieu */
}
