/**
 * Amazon Affiliates for Elementor - Frontend Styles
 * Author: workflowdone
 */

/* ==========================================
   Base / Reset
   ========================================== */
.aae-products-wrapper * {
    box-sizing: border-box;
}

/* ==========================================
   Grid Layout
   ========================================== */
.aae-products-wrapper {
    width: 100%;
}

.aae-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ==========================================
   List Layout - Horizontal Card (Image Left, Content Right)
   ========================================== */
.aae-products-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.aae-products-list .aae-product-card {
    width: 100%;
}

.aae-products-list .aae-product-card > .aae-product-link,
.aae-products-list .aae-product-link {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 24px;
    padding: 20px;
}

.aae-products-list .aae-product-card .aae-product-image,
.aae-products-list .aae-product-image {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
    height: 140px !important;
    flex-shrink: 0;
    margin-bottom: 0 !important;
}

.aae-products-list .aae-product-card .aae-product-content,
.aae-products-list .aae-product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
    min-width: 0;
}

.aae-products-list .aae-product-title {
    -webkit-line-clamp: 2;
    margin-bottom: 6px;
}

.aae-products-list .aae-product-description {
    -webkit-line-clamp: 2;
    margin-bottom: 10px;
}

.aae-products-list .aae-product-meta {
    margin-top: 0;
    padding-top: 0;
}

.aae-products-list .aae-product-price-row {
    margin-bottom: 0;
}

.aae-products-list .aae-product-prime-badge {
    display: inline-flex;
    margin-bottom: 0;
    margin-left: 12px;
}

.aae-products-list .aae-product-card .aae-product-button-wrap,
.aae-products-list .aae-product-button-wrap {
    flex-shrink: 0;
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-left: auto;
    padding-left: 20px;
}

.aae-products-list .aae-product-button {
    white-space: nowrap;
}

/* Responsive - Stack on mobile */
@media (max-width: 767px) {
    .aae-products-list .aae-product-card > .aae-product-link,
    .aae-products-list .aae-product-link {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px;
    }
    
    .aae-products-list .aae-product-card .aae-product-image,
    .aae-products-list .aae-product-image {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 180px !important;
    }
    
    .aae-products-list .aae-product-card .aae-product-button-wrap,
    .aae-products-list .aae-product-button-wrap {
        margin-left: 0;
        padding-left: 0;
        margin-top: 12px !important;
    }
    
    .aae-products-list .aae-product-button {
        display: block;
        width: 100%;
        text-align: center;
    }
}

/* ==========================================
   Product Card
   ========================================== */
.aae-product-card {
    background: #ffffff;
    border: 1px solid #e3e6e6;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
}

.aae-product-card:hover {
    border-color: #FF9900;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.aae-product-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    padding: 20px;
}

/* ==========================================
   Product Image
   ========================================== */
.aae-product-image {
    position: relative;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.aae-product-image img {
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.aae-product-card:hover .aae-product-image img {
    transform: scale(1.05);
}

/* Discount Badge */
.aae-product-discount {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #CC0C39;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    z-index: 1;
}

.aae-product-discount-inline {
    background: #CC0C39;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

/* ==========================================
   Product Content
   ========================================== */
.aae-product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.aae-product-brand {
    font-size: 11px;
    color: #565959;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 500;
}

.aae-product-title {
    font-size: 15px;
    font-weight: 600;
    color: #0F1111;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.aae-product-card:hover .aae-product-title {
    color: #C45500;
}

.aae-product-description {
    font-size: 13px;
    color: #565959;
    margin: 0 0 12px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================
   Product Meta (Price, Prime)
   ========================================== */
.aae-product-meta {
    margin-top: auto;
    padding-top: 8px;
}

.aae-product-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.aae-product-price {
    font-size: 20px;
    font-weight: 700;
    color: #B12704;
}

.aae-product-original-price {
    font-size: 14px;
    color: #565959;
    text-decoration: line-through;
}

.aae-product-prime-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.aae-product-prime-badge span {
    font-size: 12px;
    font-weight: 600;
    color: #007185;
}

/* ==========================================
   Buy Button
   ========================================== */
.aae-product-button-wrap {
    margin-top: 12px;
}

.aae-product-button {
    display: inline-block;
    background: #FFD814;
    color: #0F1111;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    padding: 12px 28px;
    border-radius: 25px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.aae-product-button:hover {
    background: #F7CA00;
    transform: scale(1.02);
}

/* ==========================================
   Editor Placeholder
   ========================================== */
.aae-widget-placeholder {
    background: rgba(255, 153, 0, 0.1);
    border: 2px dashed #FF9900;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    color: #FF9900;
}

.aae-widget-placeholder.aae-widget-error {
    background: rgba(204, 12, 57, 0.1);
    border-color: #CC0C39;
    color: #CC0C39;
}

.aae-editor-notice {
    text-align: center;
    padding: 12px;
    margin-top: 16px;
    background: rgba(255, 153, 0, 0.1);
    border-radius: 8px;
    color: #FF9900;
    font-size: 13px;
}

.aae-editor-notice .dashicons {
    vertical-align: middle;
    margin-right: 6px;
}

/* Placeholder shimmer */
.aae-placeholder-shimmer {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: aae-shimmer 1.5s infinite;
}

.aae-placeholder-text {
    display: inline-block;
    height: 1em;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: aae-shimmer 1.5s infinite;
    border-radius: 4px;
    min-width: 60px;
}

.aae-placeholder-title {
    width: 85%;
    height: 1.2em;
}

.aae-placeholder-desc {
    width: 100%;
    height: 2.4em;
}

.aae-placeholder-price {
    width: 70px;
}

@keyframes aae-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================
   Hover Preview Popup
   ========================================== */
.aae-hover-preview-container {
    position: absolute;
    z-index: 999999;
}

.aae-hover-preview {
    width: 340px;
    max-width: 90vw;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.aae-hover-preview.aae-preview-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.aae-hover-preview-inner {
    display: flex;
    flex-direction: column;
}

.aae-hover-image {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    overflow: hidden;
}

.aae-hover-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.aae-hover-content {
    padding: 20px;
}

.aae-hover-brand {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 500;
}

.aae-hover-title {
    font-size: 15px;
    font-weight: 600;
    color: #0F1111;
    margin: 0 0 10px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aae-hover-description {
    font-size: 13px;
    color: #565959;
    margin: 0 0 12px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aae-hover-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.aae-hover-price {
    font-size: 20px;
    font-weight: 700;
    color: #B12704;
}

.aae-hover-original-price {
    font-size: 14px;
    color: #565959;
    text-decoration: line-through;
}

.aae-hover-discount {
    font-size: 12px;
    font-weight: 700;
    color: #CC0C39;
}

.aae-hover-prime {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.aae-hover-prime span {
    font-size: 12px;
    font-weight: 600;
    color: #00A8E1;
}

.aae-hover-cta {
    text-align: center;
    padding-top: 8px;
}

.aae-hover-view-btn {
    display: inline-block;
    background: #FFD814;
    color: #0F1111;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 25px;
    transition: background 0.2s ease;
    text-decoration: none;
    cursor: pointer;
}

.aae-hover-view-btn:hover {
    background: #F7CA00;
    color: #0F1111;
    text-decoration: none;
}

/* Loading state */
.aae-hover-preview.aae-loading .aae-hover-preview-inner {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aae-hover-preview.aae-loading .aae-hover-preview-inner::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 3px solid #e3e6e6;
    border-top-color: #FF9900;
    border-radius: 50%;
    animation: aae-spin 0.8s linear infinite;
}

@keyframes aae-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   Responsive Styles
   ========================================== */
@media (max-width: 1024px) {
    .aae-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .aae-products-grid {
        grid-template-columns: 1fr;
    }
    
    .aae-hover-preview {
        width: 300px;
    }
}
