/* ===================================================================
   HELP-CONTENT: Image-Utility-Klassen für Markdown-gerenderte Artikel
   und Styles für die Admin-Bilder-Galerie.
   ================================================================== */

/* --- Artikel-Content: Tabellen ------------------------------------- */
/* Default: keine Linien, nur etwas Padding. Opt-in via {.bordered} */
.help-content table {
    border-collapse: collapse;
    margin: 1.2rem 0;
    font-size: 0.92rem;
}

.help-content th,
.help-content td {
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}

.help-content thead th {
    font-weight: 600;
}

/* Mit Linien + Header-Highlight (Markdown: {.bordered} hinter der Tabelle) */
.help-content table.bordered {
    width: 100%;
}

.help-content table.bordered th,
.help-content table.bordered td {
    border: 1px solid var(--border);
    padding: 8px 12px;
}

.help-content table.bordered thead {
    background: var(--off-white);
}

/* Zebra-Streifen (Markdown: {.striped} oder kombinierbar mit .bordered) */
.help-content table.striped tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.025);
}

/* Mobile: Tabellen horizontal scrollbar, falls breiter als Viewport */
@media (max-width: 768px) {
    .help-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* --- Artikel-Content: Bilder ---------------------------------------- */
.help-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px 0;
    border: none;              /* überschreibt site.css default-Border */
    border-radius: 0;
}

.help-content .img-small  { max-width: 320px; }
.help-content .img-medium { max-width: 600px; }
.help-content .img-large  { max-width: 900px; }
.help-content .img-full   { max-width: 100%; width: 100%; }

.help-content .img-left {
    float: left;
    margin: 4px 24px 16px 0;
    max-width: 50%;
}

.help-content .img-right {
    float: right;
    margin: 4px 0 16px 24px;
    max-width: 50%;
}

/* Klar-Fix nach gefloateten Bildern */
.help-content .img-left + *,
.help-content .img-right + * {
    overflow: hidden;
}

.help-content .screenshot {
    border: 1px solid #e2e2de;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Mobile: alle Bilder full-width, Float-Aufhebung */
@media (max-width: 768px) {
    .help-content img,
    .help-content .img-small,
    .help-content .img-medium,
    .help-content .img-large,
    .help-content .img-left,
    .help-content .img-right {
        float: none;
        max-width: 100%;
        width: 100%;
        margin: 16px 0;
    }
}

/* --- Admin: Bilder-Galerie ----------------------------------------- */
.media-filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin: 20px 0;
    flex-wrap: wrap;
}

.media-filters label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    color: var(--slate, #4a5568);
    gap: 4px;
}

.media-filters select {
    min-width: 180px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.media-card {
    border: 1px solid var(--border, #e2e2de);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s;
}

.media-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.media-thumb {
    aspect-ratio: 4 / 3;
    background: #f8f8f6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.media-meta {
    padding: 12px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.media-filename {
    font-weight: 600;
    word-break: break-all;
    line-height: 1.3;
}

.media-info {
    color: var(--slate, #4a5568);
    font-size: 0.78rem;
}

.media-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.btn-sm {
    font-size: 0.78rem;
    padding: 4px 10px;
}

/* --- Admin: Artikel-Edit, Bild-Liste ------------------------------- */
.article-images-panel {
    margin-top: 24px;
    padding: 16px;
    background: #f8f8f6;
    border: 1px solid var(--border, #e2e2de);
    border-radius: 8px;
}

.article-images-panel h3 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: var(--text-heading, #111110);
}

.article-images-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.article-image-item {
    border: 1px solid var(--border, #e2e2de);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    font-size: 0.78rem;
}

.article-image-item .thumb {
    aspect-ratio: 4 / 3;
    background: #f0f0ed;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.article-image-item .thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.article-image-item .meta {
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.article-image-item .name {
    word-break: break-all;
    line-height: 1.2;
}

.article-image-item .copy {
    background: transparent;
    border: 1px solid var(--border, #e2e2de);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.72rem;
    cursor: pointer;
    color: var(--slate, #4a5568);
}

.article-image-item .copy:hover {
    background: var(--off-white, #f8f8f6);
}

/* --- Delete-Button in Galerie --------------------------------------- */
.btn-danger-sm {
    color: #c0392b;
    border-color: #f5b7b1 !important;
}

.btn-danger-sm:hover:not(:disabled) {
    background: #fdedec;
}

.btn-danger-sm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Lightbox (Artikel-Ansicht) ------------------------------------- */
.help-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
    padding: 24px;
}

.help-lightbox.open {
    display: flex;
}

.help-lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    cursor: default;
}

.help-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.help-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
