/**
 * Myragen Product Gallery - Styles
 * 
 * Estilos para a galeria de produtos que replica o design
 * dos cards gerados pelo Lingoloop na homepage.
 * 
 * @package Myragen_Product_Page
 * @version 1.0.0
 */

/* ============================================
   🔥 FORÇAR FULL WIDTH - SOBRESCREVER CONTAINERS DO TEMA
   ============================================ */

/* Reset de containers do tema que limitam largura */
body.post-type-archive-product,
body.woocommerce-shop,
body.tax-product_cat,
body.tax-product_tag,
body.post-type-archive-product #page,
body.post-type-archive-product #content,
body.post-type-archive-product #primary,
body.post-type-archive-product #main,
body.post-type-archive-product .site-content,
body.post-type-archive-product .content-area,
body.post-type-archive-product .site-main,
body.post-type-archive-product .woocommerce,
body.post-type-archive-product .container,
body.post-type-archive-product .site-container,
body.post-type-archive-product .page-container,
body.post-type-archive-product .entry-content,
body.post-type-archive-product article,
body.post-type-archive-product .elementor-section-wrap,
body.post-type-archive-product .elementor-section,
body.post-type-archive-product .elementor-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Remover sidebars */
body.post-type-archive-product #secondary,
body.post-type-archive-product .sidebar,
body.post-type-archive-product .widget-area {
    display: none !important;
}

/* Forçar full width no wrapper principal */
body.post-type-archive-product .site-inner,
body.post-type-archive-product .site {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Background do body */
body.post-type-archive-product {
    background: var(--mg-bg, #0f172a) !important;
    background-attachment: fixed !important;
}

/* ==========================================
   CSS VARIABLES - Inherited from Palette
   ========================================== */
:root {
    --mg-primary: #2563eb;
    --mg-primary-hover: #1d4ed8;
    --mg-secondary: #7c3aed;
    --mg-accent: #10b981;
    --mg-bg: #0f172a;
    --mg-bg2: #1e293b;
    --mg-text: #ffffff;
    --mg-text-muted: rgba(255, 255, 255, 0.7);
    --mg-border: rgba(255, 255, 255, 0.1);
    --mg-card-bg: rgba(255, 255, 255, 0.05);
    --mg-card-hover-bg: rgba(255, 255, 255, 0.08);
    --mg-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --mg-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
    --mg-radius: 16px;
    --mg-radius-sm: 8px;
    --mg-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme overrides */
.light-theme {
    --mg-bg: #ffffff;
    --mg-bg2: #f8fafc;
    --mg-text: #1f2937;
    --mg-text-muted: #6b7280;
    --mg-border: rgba(0, 0, 0, 0.1);
    --mg-card-bg: rgba(0, 0, 0, 0.03);
    --mg-card-hover-bg: rgba(0, 0, 0, 0.06);
    --mg-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --mg-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   BASE STYLES
   ========================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

.myragen-gallery-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   CONTAINER
   ========================================== */
.myragen-gallery-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

@media (max-width: 768px) {
    .myragen-gallery-container {
        padding: 24px 16px;
    }
}

/* ==========================================
   HEADER
   ========================================== */
.myragen-gallery-header {
    text-align: center;
    margin-bottom: 48px;
}

.myragen-gallery-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--mg-primary), var(--mg-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 16px 0;
    line-height: 1.2;
}

.myragen-gallery-subtitle {
    color: var(--mg-text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ==========================================
   FILTERS BAR
   ========================================== */
.myragen-gallery-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding: 20px 24px;
    background: var(--mg-card-bg);
    border-radius: var(--mg-radius);
    border: 1px solid var(--mg-border);
    backdrop-filter: blur(10px);
}

.myragen-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.myragen-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--mg-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.myragen-filter-select {
    appearance: none;
    padding: 10px 40px 10px 16px;
    background: var(--mg-card-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius-sm);
    color: var(--mg-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 180px;
    transition: var(--mg-transition);
}

.myragen-filter-select:hover {
    border-color: var(--mg-primary);
}

.myragen-filter-select:focus {
    outline: none;
    border-color: var(--mg-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.myragen-filter-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px 10px 40px;
    background: var(--mg-card-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius-sm);
    color: var(--mg-text);
    font-size: 14px;
    transition: var(--mg-transition);
}

.myragen-filter-search:focus {
    outline: none;
    border-color: var(--mg-primary);
}

.myragen-filter-search::placeholder {
    color: var(--mg-text-muted);
}

@media (max-width: 768px) {
    .myragen-gallery-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .myragen-filter-select,
    .myragen-filter-search {
        width: 100%;
    }
}

/* ==========================================
   GRID
   ========================================== */
.myragen-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.myragen-gallery-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.myragen-gallery-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.myragen-gallery-grid[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr);
}

.myragen-gallery-grid[data-columns="6"] {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1200px) {
    .myragen-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .myragen-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 600px) {
    .myragen-gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   PRODUCT CARD - Original Design
   ========================================== */
.myragen-product-card {
    background: var(--mg-card-bg);
    border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius);
    overflow: hidden;
    transition: var(--mg-transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
}

.myragen-product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--mg-shadow-lg);
    background: var(--mg-card-hover-bg);
    border-color: var(--mg-primary);
}

/* ==========================================
   PRODUCT IMAGE
   ========================================== */
.myragen-product-image {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--mg-bg2), var(--mg-bg));
}

.myragen-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.myragen-product-card:hover .myragen-product-image img {
    transform: scale(1.08);
}

.myragen-product-image a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Product Badge */
.myragen-product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--mg-accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.myragen-product-badge.sale {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.myragen-product-badge.new {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.myragen-product-badge.hot {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Quick View Button */
.myragen-quick-view {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    transition: var(--mg-transition);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.myragen-quick-view svg {
    flex-shrink: 0;
}

.myragen-product-card:hover .myragen-quick-view {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.myragen-quick-view:hover {
    background: var(--mg-primary);
}

/* Wishlist Button */
.myragen-wishlist-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--mg-transition);
    z-index: 2;
    opacity: 0;
    transform: scale(0.8);
}

.myragen-product-card:hover .myragen-wishlist-btn {
    opacity: 1;
    transform: scale(1);
}

.myragen-wishlist-btn:hover {
    background: white;
    transform: scale(1.1);
}

.myragen-wishlist-btn.active {
    color: #ef4444;
}

.myragen-wishlist-btn svg {
    width: 18px;
    height: 18px;
    color: #374151;
    transition: var(--mg-transition);
}

.myragen-wishlist-btn:hover svg,
.myragen-wishlist-btn.active svg {
    color: #ef4444;
}

/* ==========================================
   PRODUCT CONTENT
   ========================================== */
.myragen-product-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Category */
.myragen-product-category {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--mg-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

/* Title */
.myragen-product-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--mg-text);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.myragen-product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.myragen-product-title a:hover {
    color: var(--mg-primary);
}

/* Description */
.myragen-product-description {
    font-size: 13px;
    color: var(--mg-text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* ==========================================
   RATING
   ========================================== */
.myragen-product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.myragen-rating-stars {
    color: #fbbf24;
    font-size: 14px;
    letter-spacing: 2px;
}

.myragen-rating-count {
    font-size: 12px;
    color: var(--mg-text-muted);
}

/* ==========================================
   PRICE
   ========================================== */
.myragen-product-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 16px;
}

.myragen-price-current {
    font-size: 20px;
    font-weight: 800;
    color: var(--mg-primary);
}

.myragen-price-current .woocommerce-Price-amount {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.myragen-price-original {
    font-size: 14px;
    color: var(--mg-text-muted);
    text-decoration: line-through;
}

.myragen-price-discount {
    font-size: 11px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
}

/* ==========================================
   ADD TO CART BUTTON
   ========================================== */
.myragen-add-to-cart {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--mg-primary), var(--mg-primary-hover));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--mg-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: auto;
}

.myragen-add-to-cart:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.myragen-add-to-cart:active:not(:disabled) {
    transform: translateY(0);
}

.myragen-add-to-cart svg {
    flex-shrink: 0;
}

/* Loading State */
.myragen-add-to-cart.loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: wait;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.myragen-add-to-cart.loading svg.spin {
    animation: spin 1s linear infinite;
}

/* Added State */
.myragen-add-to-cart.added {
    background: linear-gradient(135deg, var(--mg-accent), #059669);
}

/* Disabled / Out of Stock */
.myragen-add-to-cart:disabled {
    background: #64748b;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==========================================
   OUT OF STOCK CARD
   ========================================== */
.myragen-product-card.out-of-stock {
    opacity: 0.7;
}

.myragen-product-card.out-of-stock .myragen-product-image::after {
    content: 'Esgotado';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.myragen-gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 24px;
    color: var(--mg-text-muted);
}

.myragen-gallery-empty-icon {
    font-size: 72px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.myragen-gallery-empty h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--mg-text);
    margin: 0 0 12px 0;
}

.myragen-gallery-empty p {
    font-size: 16px;
    margin: 0;
}

/* ==========================================
   PAGINATION
   ========================================== */
.myragen-gallery-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 48px;
}

.myragen-gallery-pagination a,
.myragen-gallery-pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: var(--mg-transition);
    text-decoration: none;
}

.myragen-gallery-pagination a {
    background: var(--mg-card-bg);
    border: 1px solid var(--mg-border);
    color: var(--mg-text);
}

.myragen-gallery-pagination a:hover {
    background: var(--mg-primary);
    color: white;
    border-color: var(--mg-primary);
    transform: translateY(-2px);
}

.myragen-gallery-pagination span.current {
    background: var(--mg-primary);
    color: white;
    border: 1px solid var(--mg-primary);
}

.myragen-gallery-pagination .dots {
    color: var(--mg-text-muted);
    border: none;
    background: transparent;
}

/* ==========================================
   SKELETON LOADING
   ========================================== */
.myragen-product-card.skeleton {
    pointer-events: none;
}

.myragen-product-card.skeleton .myragen-product-image,
.myragen-product-card.skeleton .myragen-product-category,
.myragen-product-card.skeleton .myragen-product-title,
.myragen-product-card.skeleton .myragen-product-price,
.myragen-product-card.skeleton .myragen-add-to-cart {
    background: linear-gradient(90deg, var(--mg-card-bg) 25%, var(--mg-card-hover-bg) 50%, var(--mg-card-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */
@media (max-width: 768px) {
    .myragen-gallery-header {
        margin-bottom: 32px;
    }
    
    .myragen-gallery-title {
        font-size: 1.75rem;
    }
    
    .myragen-gallery-subtitle {
        font-size: 1rem;
    }
    
    .myragen-product-content {
        padding: 16px;
    }
    
    .myragen-product-title {
        font-size: 15px;
    }
    
    .myragen-price-current {
        font-size: 18px;
    }
    
    .myragen-add-to-cart {
        padding: 12px 20px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .myragen-gallery-container {
        padding: 16px 12px;
    }
    
    .myragen-gallery-grid {
        gap: 12px;
    }
    
    .myragen-product-badge {
        font-size: 10px;
        padding: 4px 10px;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    .myragen-gallery-filters,
    .myragen-quick-view,
    .myragen-wishlist-btn,
    .myragen-add-to-cart {
        display: none !important;
    }
    
    .myragen-product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
