/* Affiliate Shop - Base Styles */

/* Reset and Base Styles */
.affiliate-shop-grid *,
.affiliate-shop-widget * {
    box-sizing: border-box;
}

/* Typography */
.affiliate-shop-grid,
.affiliate-shop-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
}

/* Loading States */
.affiliate-shop-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.affiliate-shop-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Error States */
.affiliate-shop-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

/* Empty States */
.affiliate-shop-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

/* Accessibility */
.affiliate-shop-btn:focus,
.widget-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.affiliate-shop-item:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Screen Reader Text */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .affiliate-shop-item {
        border: 2px solid;
    }
    
    .affiliate-shop-btn,
    .widget-btn {
        border: 2px solid;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .affiliate-shop-item,
    .affiliate-shop-image img,
    .affiliate-shop-btn,
    .widget-btn {
        transition: none;
    }
    
    .affiliate-shop-loading::before {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .affiliate-shop-item {
        background: #2d2d2d;
        border-color: #444;
        color: #fff;
    }
    
    .affiliate-shop-title {
        color: #fff;
    }
    
    .affiliate-shop-description {
        color: #ccc;
    }
    
    .affiliate-shop-empty {
        background: #2d2d2d;
        color: #ccc;
    }
}

/* Print Styles */
@media print {
    .affiliate-shop-grid {
        display: block;
    }
    
    .affiliate-shop-item {
        break-inside: avoid;
        margin-bottom: 20px;
        border: 1px solid #000;
    }
    
    .affiliate-shop-btn,
    .widget-btn {
        display: none;
    }
    
    .affiliate-shop-image img {
        max-height: 200px;
    }
}

/* RTL Support */
.rtl .widget-product-image {
    margin-right: 0;
    margin-left: 12px;
}

.rtl .my-shop-plugin-wp-price .sale-price {
    margin-right: 0;
    margin-left: 8px;
}

.rtl .widget-product-price .sale-price {
    margin-right: 0;
    margin-left: 5px;
}

/* Custom Properties for Theme Integration */
:root {
    --affiliate-shop-primary-color: #007cba;
    --affiliate-shop-primary-hover: #005a87;
    --affiliate-shop-text-color: #333;
    --affiliate-shop-text-light: #666;
    --affiliate-shop-border-color: #e1e1e1;
    --affiliate-shop-background: #fff;
    --affiliate-shop-sale-color: #e74c3c;
    --affiliate-shop-border-radius: 8px;
    --affiliate-shop-spacing: 20px;
}

/* Use custom properties */
.affiliate-shop-item {
    background: var(--affiliate-shop-background);
    border-color: var(--affiliate-shop-border-color);
    border-radius: var(--affiliate-shop-border-radius);
}

.affiliate-shop-title {
    color: var(--affiliate-shop-text-color);
}

.affiliate-shop-description {
    color: var(--affiliate-shop-text-light);
}

.affiliate-shop-btn,
.widget-btn {
    background: var(--affiliate-shop-primary-color);
}

.affiliate-shop-btn:hover,
.widget-btn:hover {
    background: var(--affiliate-shop-primary-hover);
}

.affiliate-shop-price .sale-price,
.widget-product-price .sale-price {
    color: var(--affiliate-shop-sale-color);
}