/* Music Archive Grid Widget Styles */

.music-archive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

.archive-item {
    position: relative;
    background: #1a1a1a;
    border-radius: 0 !important; /* Eckig - Force! */
    overflow: hidden !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.archive-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.archive-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 0 !important; /* Eckig! */
}

.archive-item-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    padding-bottom: 0;
    overflow: hidden !important;
    background: #000;
    border-radius: 0 !important; /* Eckig! */
}

.archive-item-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: cover !important;
    object-position: center center !important;
    transition: transform 0.3s ease;
    border-radius: 0 !important; /* Eckig - Force! */
    margin: 0 !important;
    padding: 0 !important;
}

.archive-item:hover .archive-item-image img {
    transform: scale(1.05);
}

/* Auch Content-Bereich eckig */
.archive-item-content {
    padding: 20px;
    background: #1a1a1a;
    border-radius: 0 !important; /* Eckig! */
}

.archive-item-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.archive-item-content {
    padding: 20px;
    background: #1a1a1a;
}

.archive-item-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: bold;
    color: #ff3333;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.3;
}

.archive-item-genre {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #999;
    text-transform: capitalize;
}

.archive-item-additional-term {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.archive-item-date {
    margin: 0 0 10px 0;
    font-size: 11px;
    color: #888;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.archive-item-description {
    margin: 0;
    font-size: 13px;
    color: #ccc;
    line-height: 1.5;
}

/* NEW Badge */
.new-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff3333;
    color: #fff;
    padding: 8px 20px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
    z-index: 10;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 15% 100%);
    box-shadow: 0 2px 10px rgba(255, 51, 51, 0.5);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .music-archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .music-archive-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .archive-item-content {
        padding: 15px;
    }
    
    .archive-item-title {
        font-size: 16px;
    }
    
    .archive-item-genre,
    .archive-item-description {
        font-size: 12px;
    }
    
    .new-badge {
        padding: 6px 15px;
        font-size: 11px;
    }
}

/* Dark Mode Enhancements */
.archive-item {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Hover States */
.archive-item-link:hover .archive-item-title {
    color: #ff5555;
}

/* Loading State */
.music-archive-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Animation for grid items */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.archive-item {
    animation: fadeInUp 0.5s ease forwards;
}

.archive-item:nth-child(1) { animation-delay: 0.1s; }
.archive-item:nth-child(2) { animation-delay: 0.2s; }
.archive-item:nth-child(3) { animation-delay: 0.3s; }
.archive-item:nth-child(4) { animation-delay: 0.4s; }
.archive-item:nth-child(5) { animation-delay: 0.5s; }
.archive-item:nth-child(6) { animation-delay: 0.6s; }

/* Hover Overlay Styles */
.archive-item {
    position: relative;
}

.archive-item-link {
    position: relative;
    display: block;
}

/* Grid muss Overflow erlauben für Overlays */
.music-archive-grid {
    overflow: visible !important;
}

/* Auch Parent-Container müssen Overflow erlauben */
.music-archive-grid * {
    overflow: visible;
}

/* Stelle sicher dass Elementor Container nicht abschneidet */
.elementor-widget-container:has(.music-archive-grid) {
    overflow: visible !important;
}

.elementor-column:has(.music-archive-grid) {
    overflow: visible !important;
}

.elementor-section:has(.music-archive-grid) {
    overflow: visible !important;
}

/* Base Overlay Styles */
.archive-item-overlay {
    position: absolute;
    background: rgba(255, 255, 255, 0.98);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    padding: 15px;
    z-index: 100; /* Reduziert von 1000 für mobile */
    border-radius: 0; /* Eckig! */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    pointer-events: none;
}

.archive-item:hover .archive-item-overlay,
.archive-item-link:hover .archive-item-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Info Badge in Ecke (wie Kode88 "i") */
.overlay-corner-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 40px 40px 0;
    border-color: transparent #333 transparent transparent;
    z-index: 10;
}

/* Dreieck Badge - Text via ::after */
.overlay-corner-badge:not(.badge-square)::after {
    content: attr(data-badge-text);
    position: absolute;
    top: 8px;
    right: -32px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    font-style: italic;
    font-family: Georgia, serif;
}

/* Quadrat Badge */
.overlay-corner-badge.badge-square {
    width: 35px;
    height: 35px;
    border: none;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.overlay-corner-badge.badge-square::after {
    display: none;
}

.overlay-corner-badge.badge-square .badge-text {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    font-style: italic;
    font-family: Georgia, serif;
}

/* Position: Oberhalb (Standard - wie Kode88) */
.overlay-position-above .archive-item-overlay {
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 10px;
    transform: translateY(10px);
}

.overlay-position-above .archive-item:hover .archive-item-overlay {
    transform: translateY(0);
}

/* Zusätzliche Sicherheit für oberhalb */
.overlay-position-above .archive-item {
    overflow: visible !important;
}

.overlay-position-above {
    padding-top: 0 !important;
}

/* Position: Über der Karte (vollflächig) */
.overlay-position-over .archive-item-overlay {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.95);
}

.overlay-position-over .archive-item:hover .archive-item-overlay {
    transform: scale(1);
}

/* Position: Unterhalb */
.overlay-position-below .archive-item-overlay {
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 10px;
    transform: translateY(-10px);
}

.overlay-position-below .archive-item:hover .archive-item-overlay {
    transform: translateY(0);
}

.overlay-content {
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
    text-align: left;
}

.overlay-field {
    margin-bottom: 15px;
}

.overlay-field:last-child {
    margin-bottom: 0;
}

.overlay-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 5px;
    font-weight: 600;
}

.overlay-value {
    font-size: 13px;
    line-height: 1.6;
    color: #333;
}

/* Scrollbar für Overlay Content */
.overlay-content::-webkit-scrollbar {
    width: 4px;
}

.overlay-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.overlay-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.overlay-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Tablet & Mobile */
@media (max-width: 1024px) {
    .music-archive-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Reduziere Overlay-Größe auf Tablet */
    .archive-item-overlay {
        font-size: 13px;
        padding: 12px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .music-archive-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Wichtig: Z-Index niedriger als Footer! */
    .archive-item {
        z-index: 1;
    }
    
    .archive-item-overlay {
        z-index: 2; /* Niedriger als Standard */
        font-size: 12px;
        padding: 10px;
        max-height: 200px;
    }
    
    /* Verhindere Overlay-Überlagerung */
    .overlay-position-above .archive-item-overlay {
        position: relative;
        bottom: auto;
        margin-bottom: 0;
        margin-top: 10px;
    }
    
    /* Bei "over" Position: kleineres Overlay */
    .overlay-position-over .archive-item-overlay {
        padding: 8px;
        font-size: 11px;
    }
    
    /* Content Area auf Mobile */
    .archive-item-content {
        padding: 15px;
    }
    
    /* Kleinere Schriftgrößen */
    .archive-item-title {
        font-size: 16px;
    }
    
    .archive-item-genre,
    .archive-item-additional-term,
    .archive-item-date {
        font-size: 11px;
    }
    
    .archive-item-description {
        font-size: 12px;
    }
    
    /* NEW Badge kleiner */
    .new-badge {
        font-size: 9px;
        padding: 3px 8px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .music-archive-grid {
        gap: 15px;
    }
    
    /* Noch kleinere Overlays */
    .archive-item-overlay {
        max-height: 150px;
        font-size: 11px;
        padding: 8px;
    }
    
    .archive-item-content {
        padding: 12px;
    }
    
    /* Datum kompakter */
    .archive-item-date {
        font-size: 10px;
    }
}

/* Fix für Footer-Überlagerung */
@media (max-width: 768px) {
    /* Stelle sicher dass Grid nicht über Footer geht */
    .music-archive-grid {
        position: relative;
        z-index: 1 !important;
    }
    
    /* Overlay darf nicht über Footer */
    .music-archive-grid .archive-item-overlay {
        position: absolute;
        z-index: 10 !important; /* Nicht 1000! */
    }
    
    /* Bei Hover: kein translateY das aus Container rausgeht */
    .overlay-position-above .archive-item:hover .archive-item-overlay {
        transform: none;
    }
}

/* ============================================================
   Mehr laden – Button
   ============================================================ */

.mag-load-more-wrapper {
    display: flex;
    justify-content: center;   /* Elementor-überschreibbar via selector */
    width: 100%;
    margin-top: 30px;
}

.mag-load-more-btn {
    display: inline-block;
    padding: 14px 40px;
    background-color: #ff3333;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: none;
    line-height: 1;
    transition: all 0.3s ease;
    outline: none;
}

.mag-load-more-btn:hover {
    background-color: #cc0000;
    color: #ffffff;
}

.mag-load-more-btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.mag-load-more-btn.mag-loading {
    opacity: 0.7;
    cursor: wait;
}

.mag-load-more-btn.mag-loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: mag-spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes mag-spin {
    to { transform: rotate(360deg); }
}
