/**
 * Amazon Affiliate Pro - Frontend Styles
 * Mobile-First Responsive Design
 *
 * Breakpoints:
 * - Mobile: < 768px (default/base)
 * - Tablet: >= 768px
 * - Desktop: >= 1024px
 */

/* ==========================================================================
   General Styles - Mobile First
   ========================================================================== */

.aap-product-box,
.aap-comparison-table-wrapper,
.aap-product-list,
.aap-bestseller-list {
    margin: 15px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (min-width: 768px) {
    .aap-product-box,
    .aap-comparison-table-wrapper,
    .aap-product-list,
    .aap-bestseller-list {
        margin: 20px 0;
    }
}

.aap-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
}

/* ==========================================================================
   Buttons - Mobile First (Touch-Friendly)
   ========================================================================== */

.aap-button {
    display: inline-block;
    padding: 14px 20px; /* Minimum 44px touch target */
    background: #FF9900;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-align: center;
    min-height: 44px; /* Touch target */
    width: 100%; /* Full width on mobile */
}

.aap-button:hover,
.aap-button:focus {
    background: #e88b00;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

@media (min-width: 768px) {
    .aap-button {
        width: auto; /* Auto width on tablet+ */
        padding: 12px 24px;
    }
}

.aap-button-small {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 44px;
}

.aap-button-primary {
    background: #FF9900;
}

/* ==========================================================================
   Product Box - Mobile First
   ========================================================================== */

.aap-product-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
    .aap-product-box {
        padding: 20px;
    }
}

.aap-product-inner {
    display: flex;
    flex-direction: column; /* Stack on mobile */
    gap: 15px;
}

@media (min-width: 768px) {
    .aap-product-inner {
        flex-direction: row; /* Side by side on tablet+ */
        gap: 20px;
    }
}

.aap-product-image {
    position: relative;
    width: 100%;
}

@media (min-width: 768px) {
    .aap-product-image {
        flex: 0 0 250px;
        max-width: 250px;
    }
}

.aap-product-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.aap-prime-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #00A8E1;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.aap-product-content {
    flex: 1;
}

.aap-product-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .aap-product-title {
        font-size: 24px;
        margin-bottom: 15px;
    }
}

.aap-product-title a {
    color: #232f3e;
    text-decoration: none;
}

.aap-product-title a:hover,
.aap-product-title a:focus {
    color: #FF9900;
}

.aap-product-badges {
    margin: 10px 0 12px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .aap-product-badges {
        margin-bottom: 15px;
    }
}

.aap-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 768px) {
    .aap-badge {
        font-size: 12px;
    }
}

.aap-badge-discount {
    background: #CC0C39;
    color: #fff;
}

.aap-badge-prime-exclusive {
    background: #00A8E1;
    color: #fff;
}

.aap-product-rating {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .aap-product-rating {
        margin-bottom: 15px;
        gap: 10px;
    }
}

.aap-stars {
    display: inline-flex;
    gap: 2px;
}

.aap-star {
    font-size: 16px;
}

@media (min-width: 768px) {
    .aap-star {
        font-size: 18px;
    }
}

.aap-star-full {
    color: #FFA41C;
}

.aap-star-half {
    color: #FFA41C;
    opacity: 0.5;
}

.aap-star-empty {
    color: #ddd;
}

.aap-reviews-count {
    color: #007185;
    font-size: 13px;
}

@media (min-width: 768px) {
    .aap-reviews-count {
        font-size: 14px;
    }
}

.aap-product-description {
    margin-bottom: 12px;
    color: #555;
    line-height: 1.6;
    font-size: 14px;
}

@media (min-width: 768px) {
    .aap-product-description {
        margin-bottom: 15px;
        font-size: 16px;
    }
}

.aap-features-wrapper {
    position: relative;
    max-height: 150px;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.aap-features-wrapper.is-expanded {
    max-height: 2000px;
}

.aap-features-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.95));
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.aap-features-wrapper.is-expanded::after {
    opacity: 0;
}

.aap-features-list {
    margin: 0 0 12px 0;
    padding-left: 20px;
}

@media (min-width: 768px) {
    .aap-features-list {
        margin-bottom: 15px;
    }
}

.aap-product-features li {
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

@media (min-width: 768px) {
    .aap-product-features li {
        font-size: 15px;
    }
}

.aap-toggle-features {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #007185;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 0;
    cursor: pointer;
    transition: color 0.2s ease;
    margin-top: 5px;
}

.aap-toggle-features:hover {
    color: #FF9900;
}

.aap-toggle-text-less {
    display: none;
}

.aap-toggle-features[aria-expanded="true"] .aap-toggle-text-more {
    display: none;
}

.aap-toggle-features[aria-expanded="true"] .aap-toggle-text-less {
    display: inline;
}

.aap-toggle-icon {
    transition: transform 0.3s ease;
}

.aap-toggle-features[aria-expanded="true"] .aap-toggle-icon {
    transform: rotate(180deg);
}

.aap-product-price {
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: 700;
    color: #B12704;
}

@media (min-width: 768px) {
    .aap-product-price {
        font-size: 28px;
    }
}

.aap-old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 16px;
    margin-right: 8px;
}

@media (min-width: 768px) {
    .aap-old-price {
        font-size: 18px;
        margin-right: 10px;
    }
}

.aap-savings {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #007600;
}

@media (min-width: 768px) {
    .aap-savings {
        font-size: 14px;
    }
}

/* ==========================================================================
   Product Compact (Loop/Sidebar) - Mobile First
   ========================================================================== */

.aap-product-compact {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    transition: box-shadow 0.3s ease;
    max-width: 100%;
}

@media (min-width: 480px) {
    .aap-product-compact {
        max-width: 300px;
        margin-bottom: 20px;
    }
}

.aap-product-compact:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.aap-compact-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Aspect ratio 1:1 */
    background: #f5f5f5;
    overflow: hidden;
}

.aap-compact-image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aap-compact-image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.aap-compact-badge-discount {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #CC0C39;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@media (min-width: 480px) {
    .aap-compact-badge-discount {
        top: 10px;
        right: 10px;
        padding: 5px 10px;
        font-size: 14px;
    }
}

.aap-compact-content {
    padding: 12px;
}

@media (min-width: 480px) {
    .aap-compact-content {
        padding: 15px;
    }
}

.aap-compact-title {
    margin: 0 0 10px 0;
    font-size: 15px;
    line-height: 1.3;
}

@media (min-width: 480px) {
    .aap-compact-title {
        font-size: 16px;
    }
}

.aap-compact-title a {
    color: #232f3e;
    text-decoration: none;
}

.aap-compact-title a:hover,
.aap-compact-title a:focus {
    color: #FF9900;
}

.aap-compact-rating {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.aap-compact-rating .aap-stars {
    font-size: 13px;
}

@media (min-width: 480px) {
    .aap-compact-rating .aap-stars {
        font-size: 14px;
    }
}

.aap-compact-price {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #B12704;
}

@media (min-width: 480px) {
    .aap-compact-price {
        font-size: 20px;
    }
}

.aap-compact-old-price {
    display: block;
    text-decoration: line-through;
    color: #999;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 3px;
}

@media (min-width: 480px) {
    .aap-compact-old-price {
        font-size: 14px;
    }
}

.aap-compact-current-price {
    display: block;
}

.aap-compact-button {
    margin-top: 10px;
}

.aap-button-compact {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 16px;
    font-size: 14px;
    min-height: 44px;
}

/* ==========================================================================
   Comparison Table - Mobile First
   ========================================================================== */

.aap-comparison-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.aap-table {
    width: 100%;
    min-width: 600px; /* Prevent table from becoming too narrow */
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
    .aap-table {
        min-width: auto;
    }
}

.aap-table thead {
    background: #232f3e;
    color: #fff;
}

.aap-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

@media (min-width: 768px) {
    .aap-table th {
        padding: 15px;
        font-size: 15px;
    }
}

.aap-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}

@media (min-width: 768px) {
    .aap-table td {
        padding: 15px;
    }
}

.aap-table tbody tr:last-child td {
    border-bottom: none;
}

.aap-table tbody tr:hover {
    background: #f8f9fa;
}

.aap-table-image {
    width: 80px;
}

@media (min-width: 768px) {
    .aap-table-image {
        width: 100px;
    }
}

.aap-table-image img {
    width: 60px;
    height: auto;
    border-radius: 4px;
}

@media (min-width: 768px) {
    .aap-table-image img {
        width: 80px;
    }
}

.aap-table-title {
    min-width: 150px;
}

@media (min-width: 768px) {
    .aap-table-title {
        min-width: 200px;
    }
}

.aap-product-link {
    color: #232f3e;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.aap-product-link:hover,
.aap-product-link:focus {
    color: #FF9900;
}

.aap-table-rating {
    min-width: 100px;
}

@media (min-width: 768px) {
    .aap-table-rating {
        min-width: 120px;
    }
}

.aap-table-price {
    min-width: 80px;
    font-weight: 700;
    color: #B12704;
    font-size: 14px;
}

@media (min-width: 768px) {
    .aap-table-price {
        min-width: 100px;
        font-size: 16px;
    }
}

.aap-table-action {
    min-width: 120px;
    text-align: center;
}

@media (min-width: 768px) {
    .aap-table-action {
        min-width: 150px;
    }
}

/* ==========================================================================
   Product List - Mobile First
   ========================================================================== */

.aap-product-list {
    display: grid;
    gap: 15px;
    grid-template-columns: 1fr; /* Single column on mobile */
}

@media (min-width: 576px) {
    .aap-product-list {
        gap: 20px;
    }

    .aap-columns-2,
    .aap-columns-3,
    .aap-columns-4 {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on small tablets */
    }
}

@media (min-width: 992px) {
    .aap-columns-3 {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on desktop */
    }

    .aap-columns-4 {
        grid-template-columns: repeat(4, 1fr); /* 4 columns on desktop */
    }
}

@media (min-width: 768px) {
    .aap-layout-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

.aap-layout-list {
    grid-template-columns: 1fr; /* Always single column */
}

.aap-product-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .aap-product-item {
        padding: 15px;
    }
}

.aap-product-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

@media (min-width: 768px) {
    .aap-product-item:hover {
        transform: translateY(-5px);
    }
}

.aap-item-image {
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .aap-item-image {
        margin-bottom: 15px;
    }
}

.aap-item-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.aap-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.aap-item-title {
    margin: 0 0 10px 0;
    font-size: 15px;
    flex: 1;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .aap-item-title {
        font-size: 16px;
    }
}

.aap-item-title a {
    color: #232f3e;
    text-decoration: none;
}

.aap-item-title a:hover,
.aap-item-title a:focus {
    color: #FF9900;
}

.aap-item-price {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #B12704;
}

@media (min-width: 768px) {
    .aap-item-price {
        margin-bottom: 15px;
        font-size: 20px;
    }
}

.aap-item-button {
    text-align: center;
}

/* ==========================================================================
   Bestseller List - Mobile First
   ========================================================================== */

.aap-bestseller-list {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.aap-bestseller-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.3s ease;
}

@media (min-width: 768px) {
    .aap-bestseller-item {
        gap: 15px;
        padding: 15px;
    }
}

.aap-bestseller-item:last-child {
    border-bottom: none;
}

.aap-bestseller-item:hover {
    background: #f8f9fa;
}

.aap-bestseller-number {
    flex: 0 0 40px;
    text-align: center;
}

@media (min-width: 768px) {
    .aap-bestseller-number {
        flex: 0 0 50px;
    }
}

.aap-number {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    background: #FF9900;
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
}

@media (min-width: 768px) {
    .aap-number {
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 18px;
    }
}

.aap-bestseller-image {
    flex: 0 0 80px;
}

@media (min-width: 768px) {
    .aap-bestseller-image {
        flex: 0 0 100px;
    }
}

.aap-bestseller-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.aap-bestseller-content {
    flex: 1;
    display: flex;
    flex-direction: column; /* Stack on mobile */
    align-items: flex-start;
    gap: 10px;
}

@media (min-width: 768px) {
    .aap-bestseller-content {
        flex-direction: row; /* Horizontal on tablet+ */
        align-items: center;
        gap: 20px;
    }
}

.aap-bestseller-title {
    margin: 0;
    font-size: 14px;
    flex: 1;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .aap-bestseller-title {
        font-size: 16px;
    }
}

.aap-bestseller-title a {
    color: #232f3e;
    text-decoration: none;
}

.aap-bestseller-title a:hover,
.aap-bestseller-title a:focus {
    color: #FF9900;
}

.aap-bestseller-price {
    font-size: 16px;
    font-weight: 700;
    color: #B12704;
}

@media (min-width: 768px) {
    .aap-bestseller-price {
        font-size: 18px;
        min-width: 100px;
    }
}

.aap-bestseller-button {
    width: 100%;
}

@media (min-width: 768px) {
    .aap-bestseller-button {
        width: auto;
        min-width: 150px;
    }
}
