/* Responsive Design - Updated for Top Apps */
@media (max-width: 768px) {
    .aap-trending-apps-ngrid {
        grid-template-columns: 1fr;
    }
    
    .aap-similar-app-item {
        padding: 10px;
        gap: 10px;
    }
    
    .aap-similar-app-item img {
        width: 50px;
        height: 50px;
    }
    
    .aap-app-name {
        font-size: 13px;
    }
    
    .aap-widget__titleTR {
        padding: 8px 15px;
    }
    
    .aap-widget__titleTR .aap-widget__title-text {
        font-size: 14px;
    }
    
    /* Top apps mobile handled by specific mobile query above */
}

@media (max-width: 480px) {
    .aap-trending-apps-container {
        padding: 10px;
    }
    
    .aap-similar-app-item {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .aap-similar-app-item img {
        width: 60px;
        height: 60px;
    }
    
    .aap-app-details {
        text-align: center;
    }
    
    .aap-app-name {
        white-space: normal;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    .aap-trending-apps-container {
        padding: 10px;
    }
    
    .aap-similar-app-item {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .aap-similar-app-item img {
        width: 60px;
        height: 60px;
    }
    
    .aap-app-details {
        text-align: center;
    }
    
    .aap-app-name {
        white-space: normal;
        word-break: break-word;
    }
}

/* Dark Mode Support - Updated */
@media (prefers-color-scheme: dark) {
    .aap-trending-apps-container {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .aap-similar-app-item,
    .aap-app-card {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .aap-similar-app-item:hover {
        background: #333;
    }
    
    .aap-app-name,
    .aap-app-card a {
        /*color: #fff;*/
    }
    
    .aap-app-size {
        color: #ccc;
    }
    
    .aap-trending-posts-widget {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .aap-trending-post-item {
        border-color: #333;
    }
    
    .aap-trending-post-item a {
        color: #fff;
    }
    
    .aap-view-count {
        background: #333;
        color: #ccc;
    }
    
    /* Top Apps Dark Mode */
    .aap-top-apps h3 {
        border-bottom-color: #666;
        /*color: #fff;*/
    }
}

/* Animation Enhancements - Updated */
.aap-similar-app-item {
    position: relative;
    overflow: hidden;
}

.aap-similar-app-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.aap-similar-app-item:hover::before {
    left: 100%;
}

/* Loading States */
.aap-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #666;
}

.aap-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--theme-palette-color-1, #007cba);
    border-radius: 50%;
    animation: aap-spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Badge Variations - Updated for your style */
.aap-badge.gold {
    background: linear-gradient(45deg, #ffd700, #ffed4e) !important;
    color: #333 !important;
}

.aap-badge.silver {
    background: linear-gradient(45deg, #c0c0c0, #e5e5e5) !important;
    color: #333 !important;
}

.aap-badge.bronze {
    background: linear-gradient(45deg, #cd7f32, #daa520) !important;
    color: #fff !important;
}

/* Trending Indicator */
.aap-trending-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff4444;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    animation: aap-pulse 2s infinite;
}

@keyframes aap-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Accessibility Improvements - Updated */
.aap-similar-app-item:focus,
.aap-app-card a:focus {
    outline: 2px solid var(--theme-palette-color-1, #0073aa);
    outline-offset: 2px;
}

.aap-badge {
    font-variant-numeric: tabular-nums;
}

/* Print Styles - Updated */
@media print {
    .aap-widget__titleTR {
        background: #000 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .aap-top-apps h3 {
        color: #000 !important;
        border-bottom-color: #000 !important;
    }
    
    .aap-similar-app-item:hover::before {
        display: none;
    }
    
    .aap-similar-app-item,
    .aap-app-card {
        break-inside: avoid;
    }
    
    .aap-app-card .aap-logo {
        transform: none !important;
    }
}

/*
 * Weekly Views CSS
 * File: css/weekly-views.css
 * Place this in your child theme's css folder
 */

/* Trending Title Bar */
.aap-widget__titleTR {
    margin-bottom: 0;
    padding: 10px 20px;
    background: var(--theme-palette-color-1, #007cba);
    border-bottom: none;
    color: #fff;
    margin: -5px !important;
    border: var(--theme-border, 1px solid #ddd);
    box-shadow: var(--theme-box-shadow, 0 2px 4px rgba(0,0,0,0.1));
    border-top-left-radius: var(--theme-border-radius, 8px);
    border-top-right-radius: var(--theme-border-radius, 8px);
    display: -webkit-box;
    display: -moz-box;
    display: box;
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -moz-box-align: center;
    box-align: center;
    -webkit-align-items: center;
    -moz-align-items: center;
    -ms-align-items: center;
    -o-align-items: center;
    align-items: center;
    -ms-flex-align: center;
    -webkit-box-pack: justify;
    -moz-box-pack: justify;
    box-pack: justify;
    -webkit-justify-content: space-between;
    -moz-justify-content: space-between;
    -ms-justify-content: space-between;
    -o-justify-content: space-between;
    justify-content: space-between;
    -ms-flex-pack: justify;
}

.aap-widget__titleTR .aap-widget__title-text {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
}

.aap-widget__titleTR .aap-first-word {
    font-weight: 300;
}

.aap-widget__titleTR svg {
    flex-shrink: 0;
}

/* Trending Apps Container */
.aap-trending-apps-container {
    background: #fff;
    border: var(--theme-border, 1px solid #ddd);
    border-top: none;
    border-bottom-left-radius: var(--theme-border-radius, 8px);
    border-bottom-right-radius: var(--theme-border-radius, 8px);
    /*padding: 15px;*/
    /*box-shadow: var(--theme-box-shadow, 0 2px 4px rgba(0,0,0,0.1));*/
}

.aap-trending-apps-ngrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.aap-similar-app-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.aap-similar-app-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    text-decoration: none;
    color: inherit;
}

.aap-similar-app-item img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #ddd;
}

.aap-app-details {
    flex: 1;
    min-width: 0;
}

.aap-app-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 4px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aap-app-size {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.aap-app-rating {
    font-size: 12px;
    color: #ff9500;
    font-weight: 500;
}

/* Top Apps Styles - Your Exact Design */
.aap-top-apps {
    text-align: center;
    font-family: sans-serif;
    margin: 30px 0;
}

.aap-top-apps h3 {
    margin-bottom: 20px;
    border-bottom: 2px solid #444;
}

/* Flex layout for all */
.aap-top-apps-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

/* App Card */
.aap-app-card {
    width: 180px;
    padding: 10px;
    background: transparent;
    text-align: center;
    position: relative;
}

/* Number Badge */
.aap-app-card .aap-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 13px;
    font-weight: bold;
}

/* Logo */
.aap-app-card .aap-logo {
    width: 100%;
    height: 80px;
    object-fit: cover;
    margin: 10px auto;
    transition: transform 0.3s ease;
    border-width: 0;
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
    border-radius: 8px;
}

/* Hover animation only on desktop */
@media (min-width: 601px) {
    .aap-app-card:hover .aap-logo {
        transform: scale(1.1);
    }
}

/* App Name Link */
.aap-app-card a {
    display: block;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    /*color: inherit;*/
}

.aap-app-card a:hover {
    text-decoration: none;
    /*color: inherit;*/
}

/* MOBILE: Hide image, stack layout */
@media (max-width: 600px) {
    .aap-top-apps-list {
        flex-direction: column;
        margin-left: 10px;
        align-items: start;
    }
    
    .aap-app-card {
        width: 100%;
        max-width: 280px;
        padding: 0px;
    }
    
    .aap-app-card .aap-logo {
        display: none;
    }
    
    .aap-app-card a {
        font-size: 16px;
        font-weight: bold;
        padding: 0px 0;
        display: flex;
        margin-left: 20px;
    }
    
    .aap-app-card .aap-badge {
        top: 0px;
    }
}

/* Widget Styles */
.aap-trending-posts-widget {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.aap-trending-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.aap-trending-post-item a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    flex: 1;
    margin-right: 10px;
}

.aap-trending-post-item a:hover {
    color: var(--theme-palette-color-1, #007cba);
    text-decoration: none;
}

.aap-view-count {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 12px;
    white-space: nowrap;
}

/*