/*
 * DownloadNext v6.1.5 — RestoreContentSafeLayout
 *
 * v6.1.4 war zu aggressiv: Cards wurden in einen horizontalen Release-Modus
 * gezwungen, wodurch Inhalte/Buttons je nach Cover/Theme unsichtbar oder
 * unbrauchbar wurden. Diese Datei ersetzt den alten CardGridFilterPolish und
 * stellt den stabilen, vertikalen Card-Modus wieder her.
 *
 * Ziel: lieber sicher, sichtbar und nutzbar als überglättet.
 */

:root{
    --dn-safe-bg: var(--dsc-surface, rgba(18,13,8,.98));
    --dn-safe-bg-2: var(--dsc-surface-2, rgba(32,22,13,.96));
    --dn-safe-border: var(--dsc-border, rgba(255,153,0,.28));
    --dn-safe-border-strong: var(--dsc-border-strong, rgba(255,184,76,.58));
    --dn-safe-text: var(--dsc-text, #f3dfbd);
    --dn-safe-muted: var(--dsc-muted, #bfa47a);
    --dn-safe-accent: var(--dsc-accent, #ff9900);
    --dn-safe-radius: var(--dsc-radius, 16px);
    --dn-safe-radius-sm: var(--dsc-radius-sm, 12px);
}

/* Container sicher in der mittleren Inhaltsspalte halten. */
.downloadnext-hero,
.downloadnext-stats-grid,
.downloadnext-filter-panel,
.downloadnext-grid,
.downloadnext-empty,
.downloadnext-success,
.downloadnext-error{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
}

/* Filter nur sanft glätten. Keine Layout-Experimente mehr. */
.downloadnext-filter-panel{
    padding:16px !important;
    overflow:hidden !important;
}

.downloadnext-filters{
    display:grid !important;
    grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap:10px !important;
    align-items:center !important;
    width:100% !important;
}

.downloadnext-filters input,
.downloadnext-filters select{
    width:100% !important;
    min-width:0 !important;
    height:42px !important;
    border-radius:var(--dn-safe-radius-sm) !important;
    border:1px solid rgba(255,153,0,.24) !important;
    background:rgba(8,7,6,.96) !important;
    color:var(--dn-safe-text) !important;
    padding:0 14px !important;
    box-sizing:border-box !important;
}

.downloadnext-filters input[name="q"]{
    min-width:min(100%, 260px) !important;
}

.downloadnext-filters button,
.downloadnext-filter-reset{
    width:100% !important;
    min-width:0 !important;
    min-height:42px !important;
}

.downloadnext-filter-reset{
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    text-align:center !important;
    text-decoration:none !important;
}

/* WICHTIG: Zurück zum stabilen Card-Modus. Keine horizontale Zwangs-Grid-Card mehr. */
.downloadnext-grid{
    display:grid !important;
    grid-template-columns:repeat(auto-fill, minmax(280px, 350px)) !important;
    justify-content:start !important;
    align-items:start !important;
    gap:18px !important;
    overflow:visible !important;
}

.downloadnext-grid .downloadnext-card{
    display:flex !important;
    flex-direction:column !important;
    width:100% !important;
    max-width:350px !important;
    min-width:0 !important;
    height:auto !important;
    min-height:0 !important;
    overflow:hidden !important;
    align-self:start !important;
    border-radius:var(--dn-safe-radius) !important;
    border:1px solid var(--dn-safe-border) !important;
    background:linear-gradient(135deg, rgba(30,20,12,.96), rgba(7,7,7,.98)) !important;
    box-shadow:0 18px 40px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.035) !important;
    transform:none !important;
}

.downloadnext-grid .downloadnext-card:hover{
    border-color:var(--dn-safe-border-strong) !important;
    transform:translateY(-1px) !important;
}

.downloadnext-grid .downloadnext-card > .downloadnext-cover{
    position:relative !important;
    display:block !important;
    width:100% !important;
    max-width:350px !important;
    min-width:0 !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    aspect-ratio:auto !important;
    flex:0 0 auto !important;
    overflow:hidden !important;
    border-radius:var(--dn-safe-radius) var(--dn-safe-radius) 0 0 !important;
    border-right:0 !important;
    border-bottom:1px solid rgba(255,153,0,.20) !important;
    background:radial-gradient(circle at center, rgba(255,153,0,.16), rgba(0,0,0,.42)) !important;
    line-height:0 !important;
}

.downloadnext-grid .downloadnext-card > .downloadnext-cover img{
    display:block !important;
    position:static !important;
    inset:auto !important;
    width:100% !important;
    max-width:350px !important;
    min-width:0 !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    object-fit:contain !important;
    object-position:center center !important;
    aspect-ratio:auto !important;
    opacity:1 !important;
    visibility:visible !important;
}

.downloadnext-grid .downloadnext-card > .downloadnext-cover span{
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    width:100% !important;
    min-height:220px !important;
    line-height:1 !important;
    color:#ffb347 !important;
}

/* Inhalt und echte Aktionen wieder sichtbar halten. */
.downloadnext-card-body{
    display:flex !important;
    flex-direction:column !important;
    justify-content:flex-start !important;
    gap:10px !important;
    width:100% !important;
    min-width:0 !important;
    height:auto !important;
    min-height:0 !important;
    padding:16px !important;
    overflow:visible !important;
    opacity:1 !important;
    visibility:visible !important;
    box-sizing:border-box !important;
}

.downloadnext-card-body > *,
.downloadnext-card h3,
.downloadnext-card p,
.downloadnext-card-topline,
.downloadnext-meta,
.downloadnext-tags,
.downloadnext-card-actions{
    display:initial;
    max-width:100% !important;
    min-width:0 !important;
    opacity:1 !important;
    visibility:visible !important;
}

.downloadnext-card-topline,
.downloadnext-meta,
.downloadnext-tags,
.downloadnext-card-actions{
    display:flex !important;
    flex-wrap:wrap !important;
    gap:8px !important;
    align-items:center !important;
}

.downloadnext-card h3{
    margin:0 !important;
    color:#ffc06b !important;
    font-size:1.15rem !important;
}

.downloadnext-card p{
    margin:0 !important;
    color:#d8c7ac !important;
    line-height:1.55 !important;
}

.downloadnext-card-actions{
    margin-top:10px !important;
    gap:10px !important;
}

.downloadnext-card-actions form,
.downloadnext-inline-form{
    display:inline-flex !important;
    margin:0 !important;
    padding:0 !important;
}

.downloadnext-button,
.downloadnext-button-ghost,
.downloadnext-mini-button,
.downloadnext-mini-button-primary,
.downloadnext-filter-reset,
.downloadnext-readmore,
.downloadnext-filters button,
.downloadnext-card-actions a,
.downloadnext-card-actions button,
.downloadnext-release-actions a,
.downloadnext-release-actions button,
.downloadnext-hero-actions a,
.downloadnext-hero-actions button,
.downloadnext-header-actions a,
.downloadnext-header-actions button,
.downloadnext-owner-tools a,
.downloadnext-owner-tools button{
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:8px !important;
    width:auto !important;
    max-width:100% !important;
    min-height:38px !important;
    padding:9px 14px !important;
    border-radius:var(--dn-safe-radius-sm) !important;
    border:1px solid rgba(255,179,71,.36) !important;
    background:linear-gradient(180deg, rgba(44,29,15,.98), rgba(12,10,8,.99)) !important;
    color:#ffe6bd !important;
    font-weight:800 !important;
    line-height:1.15 !important;
    text-decoration:none !important;
    box-shadow:0 10px 22px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.04) !important;
    cursor:pointer !important;
    white-space:normal !important;
    text-align:center !important;
    opacity:1 !important;
    visibility:visible !important;
}

.downloadnext-button-primary,
.downloadnext-mini-button-primary,
.downloadnext-card-actions .downloadnext-button:first-child,
.downloadnext-release-actions .downloadnext-button:first-child,
.downloadnext-hero-actions .downloadnext-button:first-child{
    border-color:rgba(255,184,77,.62) !important;
    background:linear-gradient(180deg, rgba(255,165,35,.96), rgba(178,89,0,.96)) !important;
    color:#1a0d02 !important;
}

.downloadnext-meta span,
.downloadnext-badge,
.downloadnext-community-chip,
.downloadnext-tags a{
    max-width:100% !important;
    border:1px solid rgba(255,153,0,.26) !important;
    background:rgba(18,13,8,.86) !important;
    color:#f4d5a0 !important;
    border-radius:999px !important;
    padding:6px 10px !important;
    text-decoration:none !important;
}

@media (max-width:760px){
    .downloadnext-grid{
        grid-template-columns:1fr !important;
    }
    .downloadnext-grid .downloadnext-card,
    .downloadnext-grid .downloadnext-card > .downloadnext-cover,
    .downloadnext-grid .downloadnext-card > .downloadnext-cover img,
    .downloadnext-grid .downloadnext-card > .downloadnext-cover span{
        width:100% !important;
        max-width:100% !important;
    }
    .downloadnext-card-actions > *,
    .downloadnext-card-actions a,
    .downloadnext-card-actions button,
    .downloadnext-inline-form{
        width:100% !important;
    }
}
