/* Fallback Enhancement for Existing Download Links */

/* Apply to any download links that aren't in cards */
a[href*="download.php"]:not(.media-card a) {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #3182ce 0%, #2563eb 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    min-height: 44px;
    transition: all 0.3s ease;
    margin: 0.5rem;
}

a[href*="download.php"]:not(.media-card a):hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Wrap download links in container if not already */
#result:has(a[href*="download.php"]:not(.media-card a)) {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    margin: 1rem 0;
}

/* Make results section more professional */
#result, .result-area, [id*="result"] {
    max-width: 1000px;
    margin: 2rem auto;
    border-radius: 16px;
    overflow: hidden;
}

#result:not(:empty), .result-area:not(:empty), [id*="result"]:not(:empty) {
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Style existing download tables/grids */
table:has(a[href*="download.php"]) {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.75rem;
    background: transparent;
}

table:has(a[href*="download.php"]) tr {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

table:has(a[href*="download.php"]) tr:hover {
    border-color: #3182ce;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.15);
    transform: translateY(-1px);
}

table:has(a[href*="download.php"]) td {
    padding: 1rem;
    border: none;
}

table:has(a[href*="download.php"]) td:first-child {
    border-radius: 12px 0 0 12px;
    font-weight: 600;
    color: #1a202c;
}

table:has(a[href*="download.php"]) td:last-child {
    border-radius: 0 12px 12px 0;
    text-align: right;
}

/* Responsive fallback */
@media (max-width: 768px) {
    #result:has(a[href*="download.php"]:not(.media-card a)) {
        flex-direction: column;
        align-items: stretch;
    }
    
    a[href*="download.php"]:not(.media-card a) {
        width: 100%;
        justify-content: center;
    }
    
    table:has(a[href*="download.php"]) {
        display: block;
        overflow-x: auto;
    }
    
    table:has(a[href*="download.php"]) tr {
        display: block;
        margin-bottom: 1rem;
    }
    
    table:has(a[href*="download.php"]) td {
        display: block;
        text-align: center !important;
        padding: 0.75rem;
    }
    
    table:has(a[href*="download.php"]) td:first-child,
    table:has(a[href*="download.php"]) td:last-child {
        border-radius: 0;
    }
}