/* Community Post Detail Modal — modern, übersichtlich */
#post-detail-modal.modal {
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10045;
}

#service-profile-modal.modal.modal-stack-front {
    z-index: 10060 !important;
}

#post-detail-modal .post-modal-content.cpm-shell {
    width: min(920px, 100%);
    max-width: 100%;
    max-height: min(92vh, 860px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255, 165, 0, 0.22);
    background: linear-gradient(165deg, rgba(28, 28, 32, 0.98) 0%, rgba(18, 18, 22, 0.99) 100%);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

#post-detail-modal .cpm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

#post-detail-modal .cpm-header-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.02em;
}

#post-detail-modal .cpm-header-title i {
    color: #ffa500;
    margin-right: 8px;
    font-size: 0.9rem;
}

#post-detail-modal .cpm-close,
#post-detail-modal .close-post-modal {
    position: static;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#post-detail-modal .cpm-close:hover,
#post-detail-modal .close-post-modal:hover {
    background: rgba(255, 165, 0, 0.15);
    border-color: rgba(255, 165, 0, 0.35);
    color: #fff;
}

#post-detail-modal .cpm-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    flex: 1;
    min-height: 0;
    max-height: none;
    height: auto;
}

#post-detail-modal .cpm-header-start {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

#post-detail-modal .cpm-sheet-handle {
    display: none;
}

#post-detail-modal .cpm-expand-btn {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    margin: 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 165, 0, 0.08);
    color: #ffb84d;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

#post-detail-modal .cpm-expand-btn:hover {
    background: rgba(255, 165, 0, 0.14);
}

#post-detail-modal .cpm-expand-icon {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
}

#post-detail-modal .cpm-post-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.02);
}

#post-detail-modal .cpm-comments-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
}

#post-detail-modal .post-modal-image-container {
    max-height: 42vh;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#post-detail-modal .post-modal-image-container img {
    display: block;
    max-height: 42vh;
    object-fit: cover;
}

#post-detail-modal .cpm-post-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#post-detail-modal .cpm-author-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

#post-detail-modal .cpm-author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#post-detail-modal .cpm-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a1a1a;
    background: linear-gradient(135deg, #ffb347, #ff8c00);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.25);
}

#post-detail-modal .cpm-author-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#post-detail-modal .cpm-author-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffb84d;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    text-align: left;
    line-height: 1.2;
}

#post-detail-modal .cpm-author-name:hover {
    color: #ffc966;
    text-decoration: underline;
}

#post-detail-modal .cpm-author-name--static {
    cursor: default;
    color: rgba(255, 255, 255, 0.92);
}

#post-detail-modal .cpm-author-name--static:hover {
    text-decoration: none;
}

#post-detail-modal .cpm-author-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

#post-detail-modal .post-creator-badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 165, 0, 0.14);
    border: 1px solid rgba(255, 165, 0, 0.28);
    color: #ffb84d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#post-detail-modal .post-delete-btn-modal {
    flex-shrink: 0;
    padding: 7px 12px;
    font-size: 0.78rem;
    border-radius: 10px;
    border: 1px solid rgba(244, 67, 54, 0.45);
    background: rgba(244, 67, 54, 0.12);
    color: #ff8a80;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#post-detail-modal .post-delete-btn-modal:hover {
    background: rgba(244, 67, 54, 0.22);
}

#post-detail-modal .post-modal-description,
#post-detail-modal .cpm-post-text {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.92);
    word-break: break-word;
    white-space: pre-wrap;
}

#post-detail-modal .cpm-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#post-detail-modal .cpm-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.62);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#post-detail-modal .cpm-meta-chip i {
    color: rgba(255, 165, 0, 0.75);
    font-size: 0.7rem;
}

#post-detail-modal .cpm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}

#post-detail-modal .post-like-btn-modal,
#post-detail-modal .post-comment-btn-modal {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    gap: 6px;
}

#post-detail-modal .post-like-btn-modal i {
    color: rgba(255, 120, 100, 0.9);
}

#post-detail-modal .post-comment-btn-modal {
    cursor: default;
    opacity: 0.85;
}

#post-detail-modal .post-like-btn-modal.liked {
    background: rgba(255, 107, 53, 0.18);
    border-color: rgba(255, 107, 53, 0.45);
    color: #ff9b7a;
}

#post-detail-modal .cpm-comments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#post-detail-modal .cpm-comments-head h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 8px;
}

#post-detail-modal .cpm-comments-head h3 i {
    color: #ffa500;
    font-size: 0.85rem;
}

#post-detail-modal .cpm-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #1a1a1a;
    background: linear-gradient(135deg, #ffb347, #ff8c00);
}

#post-detail-modal .post-modal-comments-section {
    padding: 0;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#post-detail-modal .post-modal-comments-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 0;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#post-detail-modal .cpm-comment {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    margin: 0;
}

#post-detail-modal .cpm-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #1c1c1c;
    background: rgba(255, 165, 0, 0.35);
}

#post-detail-modal .cpm-comment-body {
    flex: 1;
    min-width: 0;
}

#post-detail-modal .cpm-comment-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    margin-bottom: 4px;
}

#post-detail-modal .cpm-comment-author {
    font-size: 0.84rem;
    font-weight: 600;
    color: #ffb84d;
    margin: 0;
}

#post-detail-modal .cpm-comment-author--link {
    cursor: pointer;
}

#post-detail-modal .cpm-comment-author--link:hover {
    text-decoration: underline;
}

#post-detail-modal .cpm-comment-time {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.42);
}

#post-detail-modal .cpm-comment-badges {
    margin-left: auto;
}

#post-detail-modal .cpm-comment-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
    word-break: break-word;
}

#post-detail-modal .cpm-comments-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.88rem;
}

#post-detail-modal .cpm-composer {
    flex-shrink: 0;
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

#post-detail-modal .cpm-composer-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

#post-detail-modal #post-modal-comment-profile-select,
#post-detail-modal .cpm-profile-select {
    width: 118px;
    flex-shrink: 0;
    padding: 10px 28px 10px 10px;
    font-size: 0.78rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 165, 0, 0.25);
    background: rgba(20, 20, 24, 0.95);
    color: #fff;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffa500' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

#post-detail-modal .cpm-composer-input-wrap {
    flex: 1;
    display: flex;
    gap: 8px;
    min-width: 0;
}

#post-detail-modal #post-modal-comment-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    font-size: 0.88rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

#post-detail-modal #post-modal-comment-input:focus {
    outline: none;
    border-color: rgba(255, 165, 0, 0.45);
    box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.12);
}

#post-detail-modal .post-modal-comment-submit,
#post-detail-modal .cpm-send-btn {
    width: 44px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffb347, #ff8c00);
    color: #1a1a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

#post-detail-modal .post-modal-comment-submit:hover,
#post-detail-modal .cpm-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 140, 0, 0.35);
}

@media (max-width: 768px) {
    #post-detail-modal.modal {
        padding: 0;
        align-items: flex-end;
    }

    #post-detail-modal .post-modal-content.cpm-shell,
    #post-detail-modal .post-modal-content.cpm-shell.cpm-shell--mobile {
        width: 100%;
        max-height: min(96dvh, 96vh);
        height: min(96dvh, 96vh);
        border-radius: 20px 20px 0 0;
        display: flex;
        flex-direction: column;
    }

    #post-detail-modal .cpm-sheet-handle {
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.28);
        margin: 0 auto 2px;
    }

    #post-detail-modal .cpm-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 16px 12px;
    }

    #post-detail-modal .cpm-header-start {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    #post-detail-modal .cpm-header-title {
        font-size: 0.88rem;
        text-align: center;
        width: 100%;
    }

    #post-detail-modal .cpm-close {
        position: absolute;
        top: 12px;
        right: 12px;
    }

    #post-detail-modal .post-modal-content.cpm-shell {
        position: relative;
    }

    #post-detail-modal .cpm-layout {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    #post-detail-modal .cpm-expand-btn {
        display: flex;
    }

    #post-detail-modal .cpm-post-panel {
        border-right: none;
        border-bottom: none;
        max-height: none;
        overflow: visible;
        flex-shrink: 0;
    }

    #post-detail-modal .cpm-post-panel.cpm-post-collapsed {
        overflow: hidden;
    }

    #post-detail-modal .cpm-post-panel.cpm-post-collapsed .post-modal-image-container,
    #post-detail-modal .cpm-post-panel.cpm-post-collapsed .post-modal-image-container img {
        max-height: 140px;
    }

    #post-detail-modal .cpm-post-panel.cpm-post-collapsed .cpm-post-body {
        padding: 12px 14px 10px;
        gap: 8px;
    }

    #post-detail-modal .cpm-post-panel.cpm-post-collapsed .cpm-post-text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin: 0;
    }

    #post-detail-modal .cpm-post-panel.cpm-post-collapsed .cpm-actions,
    #post-detail-modal .cpm-post-panel.cpm-post-collapsed .cpm-post-meta {
        display: none;
    }

    #post-detail-modal .cpm-post-panel.cpm-post-expanded .post-modal-image-container,
    #post-detail-modal .cpm-post-panel.cpm-post-expanded .post-modal-image-container img {
        max-height: 36vh;
    }

    #post-detail-modal .cpm-post-panel.cpm-post-expanded .cpm-post-text {
        display: block;
        -webkit-line-clamp: unset;
        overflow: visible;
    }

    #post-detail-modal .cpm-post-panel.cpm-post-expanded .cpm-actions,
    #post-detail-modal .cpm-post-panel.cpm-post-expanded .cpm-post-meta {
        display: flex;
    }

    #post-detail-modal .cpm-comments-panel {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        background: rgba(0, 0, 0, 0.22);
    }

    #post-detail-modal .cpm-comments-head {
        padding: 10px 14px 8px;
    }

    #post-detail-modal .post-modal-comments-list {
        flex: 1;
        min-height: 120px;
        max-height: none;
        padding: 8px 12px 12px;
        -webkit-overflow-scrolling: touch;
    }

    #post-detail-modal .cpm-composer {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    #post-detail-modal .cpm-composer-row {
        flex-wrap: wrap;
    }

    #post-detail-modal #post-modal-comment-profile-select,
    #post-detail-modal .cpm-profile-select {
        width: 100%;
        flex: 1 1 100%;
    }

    #post-detail-modal .cpm-composer-input-wrap {
        flex: 1 1 100%;
    }

    #post-detail-modal .cpm-comment {
        padding: 10px;
    }
}
