/* ==============================================
   UNIFIED CARD SYSTEM
   Einheitliches Karten-Design für alle Bereiche
   ============================================== */

@import 'cards-meta.css';

/* --- LAYOUT A: Mit Bild-Header --- */
/* Für: Marktplatz, Tipps/Orte (mit Bild), Termine */

.unified-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition:
        transform var(--transition-smooth),
        box-shadow var(--transition-smooth);
}

.unified-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Bild-Header Bereich - Standard: 160px, Marketplace: 4:3 Format */
.unified-card-header {
    position: relative;
    height: 160px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Marketplace Header: Größeres Bild (4:3 Feeling) */
.place-card-container[data-type="marketplace"] .unified-card-header {
    height: 250px;
    /* War 200px */
}

@media (max-width: 640px) {
    .place-card-container[data-type="marketplace"] .unified-card-header {
        height: 180px;
        /* Reduzierte Höhe auf Mobile für mehr Text-Platz */
    }
}

/* Optional: Whitespace im Body reduzieren */
.place-card-container[data-type="marketplace"] .unified-card-body {
    padding: 0.75rem 1rem;
}

.unified-card-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.unified-card:hover .unified-card-header img {
    transform: scale(1.03);
}

/* Kategorie-Badge oben links im Header */
.unified-card-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
}



/* Herz-Button oben rechts im Header */
.unified-card-heart {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
}

/* Mobile: Kategorie-Badge begrenzen, damit Herz nicht überlappt */
@media (max-width: 767px) {
    .unified-card-badge {
        max-width: calc(100% - 60px);
        /* Platz für Herz lassen */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Bei Event-Cards: Badge im Header begrenzen */
    .unified-card-header .unified-card-badge {
        max-width: calc(100% - 80px);
        /* Platz für Datums-Badge + Herz */
    }

    /* Herz immer sichtbar halten */
    .unified-card-heart {
        z-index: 5;
        background: var(--glass-90);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .unified-card-heart .like-btn-icon {
        padding: 0;
    }
}

/* Body: Titel + Teaser */
.unified-card-body {
    padding: 1rem 1rem 0 1rem;
    /* Removed bottom padding here */
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Fix flex overflow */
}

.unified-card-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    /* Slightly larger */
    font-weight: 700;
    text-transform: uppercase;
    /* Re-added here to keep card titles uppercase */
    line-height: 1.3;
    letter-spacing: -0.01em;
    /* Tighter, more modern */
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-right: 2rem;
    /* Prevent overlap with Heart icon */
}

@media (max-width: 375px) {
    .unified-card-title {
        padding-right: 1.5rem;
        font-size: 1rem;
    }
}

.unified-card-teaser {
    margin: 0;
    font-size: 0.9rem;
    /* Readability */
    line-height: 1.5;
    color: var(--text-muted);
    white-space: pre-wrap;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    /* Allow slightly more text? 2 is safe */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-shrink: 0;
    /* Prevent flex growth */
    min-height: 0;
}

/* Footer: "Mehr →" Link */
.unified-card-footer {
    padding: 1rem;
    /* Ensure 16px padding on all sides */
    margin-top: auto;
    /* Push to bottom */
    border-top: 1px solid var(--border-color-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-30);
    /* Subtle separation */
}

.unified-card-more {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color var(--transition-fast);
}

.unified-card-more i {
    transition: transform var(--transition-fast);
}

.unified-card:hover .unified-card-more {
    color: var(--primary-color);
}

.unified-card:hover .unified-card-more i {
    transform: translateX(4px);
    /* The "Vercel" slide */
}

/* Force Left Alignment for all descriptions for readability */
.place-card-container.expanded .description,
.place-card-container.expanded p,
.detail-modal .description,
.detail-modal p {
    text-align: left !important;
}

/* GLOBALE REGEL: Alle Text-Inhalte IMMER linksbündig, auch wenn Elternelement zentriert ist */
/* Dies verhindert das Problem, dass die erste Zeile zentriert ist, während die zweite linksbündig ist */
.detail-description,
.description-box,
.comment-content,
.comment-body,
.stream-card [style*="white-space: pre-wrap"],
.discussion-card-wrapper [style*="white-space: pre-wrap"],
.discussion-card-wrapper>div>div:not(.comment-item):not(.comment-list):not(.comment-section),
.stream-card>div>div[style*="font-size"]:not(.comment-item):not(.comment-list):not(.comment-section),
.unified-card-teaser {
    text-align: left !important;
}

/* Überschreibe unified-card-centered für Text-Inhalte */
.unified-card-centered .unified-card-title,
.unified-card-centered .unified-card-teaser {
    text-align: left !important;
}

/* Spezifische Regel für Content-Container in Diskussionen */
.discussion-card-wrapper>div[style*="padding"] {
    text-align: left !important;
}

/* Badge Layout Fix for Heart Collision */
.card-badges {
    max-width: 85%;
    /* Leave room for Heart */
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* --- LAYOUT B: Mit Icon-Circle (zentriert) --- */
/* Für: Projekte, Expert*innen, Wegweiser, Tipps (ohne Bild) */

.unified-card-centered {
    text-align: center;
}

.unified-card-centered .unified-card-body {
    align-items: center;
}

.unified-card-centered .unified-card-badge {
    position: static;
    margin-bottom: 1rem;
}

.unified-card-centered .unified-card-heart {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

/* Icon Circle */
.unified-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: var(--bg-surface-2);
    color: var(--text-muted);
    transition: transform var(--transition-smooth);
}

.unified-card:hover .unified-card-icon {
    transform: scale(1.05);
}

/* Icon Circle Farbvarianten */
.unified-card-icon-green {
    background: var(--overlay-green-10);
    color: var(--accent-tipps-solid);
}

.unified-card-icon-purple {
    background: var(--overlay-purple-10);
    color: var(--accent-purple-solid);
}

.unified-card-icon-blue {
    background: var(--overlay-indigo-10);
    color: var(--status-info-text);
}



/* ==============================================
   CLEAN CARD ALIASES (Backward Compatibility)
   ============================================== */
.clean-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
    position: relative;
}

.clean-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.clean-card-header {
    position: relative;
    height: 160px;
    overflow: hidden;
    flex-shrink: 0;
}

.clean-card-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.clean-card:hover .clean-card-header img {
    transform: scale(1.03);
}

.clean-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.clean-card-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    /* Re-added here */
    color: var(--text-main);
}

.clean-card-teaser {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.clean-card-footer {
    padding: 1rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-30);
}

.clean-card-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
}

.clean-card-heart {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--glass-90);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--border-color);
    /* Added Border */
    font-size: 1.2rem;
    color: var(--text-placeholder);
    box-shadow: 0 2px 5px var(--overlay-10);
    transition: all 0.2s;
}

.clean-card-heart:hover {
    transform: scale(1.1);
    color: var(--danger-color);
}

.clean-card-heart.liked {
    color: var(--danger-color);
}

/* Specific Fix for Brutal Floating Button Interaction */
.clean-card-heart.like-btn-floating.liked {
    color: var(--danger-color);
    border-color: var(--danger-color);
    background-color: var(--status-error-bg-light);
    /* Red-50 */
}

.clean-card-heart.like-btn-floating.liked i {
    color: var(--danger-color);
}

.clean-card-heart.liked i {
    animation: heartPulse 0.3s ease;
}

.clean-card-heart i {
    pointer-events: none;
}

/* Floating Edit/Delete Buttons (Styled like Heart) */
/* FIX: Solid Contrast to prevent light-on-light issues */
.card-action-btn-floating {
    position: absolute;
    top: 0.75rem;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    /* Solid White */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--color-ink);
    /* Black */
    border: 1px solid var(--border-color);
    /* Add border for pop */
    box-shadow: 0 2px 4px var(--overlay-15);
    /* Stronger shadow */
    transition: all 0.2s;
}

.card-action-btn-floating:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px var(--overlay-20);
}

.card-action-btn-floating.edit {
    right: 3.25rem;
    color: var(--text-main);
}

.card-action-btn-floating.delete {
    right: 6.25rem;
    color: var(--danger-color);
}




/* Grid Layout */
.clean-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
}

/* Modifier: Centered (for Experts, Projects etc without image header) */
.clean-card.centered {
    text-align: center;
}

.clean-card.centered .clean-card-body {
    align-items: center;
}

.clean-card.centered .clean-card-badge {
    position: static;
    margin-bottom: 1rem;
    display: inline-block;
}

.clean-card.centered .clean-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Color comes from shared .badge-* classes; icons keep local variants */
.clean-icon-purple {
    background: var(--overlay-purple-10);
    color: var(--accent-purple-solid);
}

.clean-icon-green {
    background: var(--overlay-green-10);
    color: var(--accent-tipps-solid);
}

.clean-icon-blue {
    background: var(--overlay-indigo-10);
    color: var(--status-info-text);
}



/* Expert Subtitle */
.card-expert-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.card-expert-subtitle strong {
    color: var(--text-main);
    font-weight: 600;
}

/* Footer Alignment Helper */
.ms-auto {
    margin-left: auto;
}

/* Like Count Badge (New) */
.like-count-badge {
    margin-left: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}
