/* Checklist Downloader - Frontend Styles */

:root {
    --cld-btn-download-bg:    #2563eb;
    --cld-btn-download-hover: #1d4ed8;
    --cld-btn-download-color: #ffffff;
    --cld-btn-submit-bg:      #16a34a;
    --cld-btn-submit-hover:   #15803d;
    --cld-btn-submit-color:   #ffffff;
}

/* Grid */
.cld-wrapper { display: grid; gap: 24px; margin: 30px 0; }
.cld-cols-1 { grid-template-columns: 1fr; }
.cld-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cld-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cld-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
    .cld-cols-2, .cld-cols-3, .cld-cols-4 { grid-template-columns: 1fr; }
}

/* Card */
.cld-card {
    background: #fff;
    border-radius: var(--cld-card-radius, 12px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}
.cld-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.14);
}

/* Preview */
.cld-preview {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #f4f6f8;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cld-preview-img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.3s ease;
}
.cld-preview:hover .cld-preview-img { transform: scale(1.04); }
.cld-preview-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s ease;
}
.cld-preview:hover .cld-preview-overlay { opacity: 1; }
.cld-preview-text {
    color: #fff; font-size: 0.9rem;
    font-weight: 600; letter-spacing: 0.04em;
}
.cld-no-preview {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #888; height: 180px; padding: 20px; text-align: center;
}

/* Info (Titel + Beschreibung) – jetzt oben */
.cld-info { padding: 22px 20px 16px; }
.cld-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cld-btn-submit-bg, #16a34a);
    letter-spacing: -0.01em;
    line-height: 1.3;
    text-align: center;
}
.cld-description { margin: 0; font-size: 0.88rem; color: #666; line-height: 1.5; }

/* Button-Bereich – jetzt unten */
.cld-action {
    padding: 16px 20px 22px;
    margin-top: auto;
}

/* Buttons */
.cld-btn {
    display: inline-block;
    padding: 11px 22px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.4;
    box-sizing: border-box;
    transition: background 0.15s ease;
}
.cld-btn-download {
    background: var(--cld-btn-download-bg) !important;
    color: var(--cld-btn-download-color) !important;
    width: 100%; text-align: center;
}
.cld-btn-download:hover {
    background: var(--cld-btn-download-hover) !important;
    color: var(--cld-btn-download-color) !important;
    text-decoration: none;
}
.cld-btn-submit {
    background: var(--cld-btn-submit-bg) !important;
    color: var(--cld-btn-submit-color) !important;
    width: 100%; text-align: center; margin-top: 10px;
}
.cld-btn-submit:hover {
    background: var(--cld-btn-submit-hover) !important;
    color: var(--cld-btn-submit-color) !important;
}
.cld-btn-submit:disabled { opacity: 0.55; cursor: default; }

/* Scroll-Lock */
body.cld-modal-open {
    overflow: hidden !important;
    padding-right: var(--cld-scrollbar-width, 0px) !important;
}

/*
 * Modal
 * - position:fixed direkt auf <body>-Ebene (kein Stacking-Context-Problem)
 * - KEINE CSS-Animation, KEIN backdrop-filter, KEIN fadeIn
 * - Einfach opacity-Transition ohne transform
 */
.cld-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.55);
    /* display wird ausschliesslich per JS inline-style gesteuert */
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}
.cld-modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 36px 40px;
    max-width: 460px;
    width: 100%;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.16);
    box-sizing: border-box;
    margin: auto 0;
    /* Keine animation-Property – verhindert Flackern */
}
@media (max-width: 500px) {
    .cld-modal-box { padding: 28px 18px; }
}

.cld-modal-close {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none;
    font-size: 1.5rem; cursor: pointer;
    color: #999; padding: 6px 10px; z-index: 1;
    line-height: 1;
}
.cld-modal-close:hover { color: #333; }

.cld-modal-box h3 {
    margin: 0 0 10px;
    font-size: 1.15rem;
    color: #1a2332;
    padding-right: 30px;
    line-height: 1.4;
    word-break: break-word;
}
.cld-modal-box p {
    margin: 0 0 16px;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Formular */
.cld-email-input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 7px;
    font-size: 0.95rem;
    box-sizing: border-box;
    display: block;
    margin-bottom: 10px;
}
.cld-email-input:focus { outline: none; border-color: #2563eb; }

.cld-newsletter-label {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 0.85rem; color: #555;
    margin-bottom: 10px; cursor: pointer; line-height: 1.4;
}
.cld-newsletter-cb { margin-top: 2px; flex-shrink: 0; }

.cld-msg {
    margin-top: 12px; padding: 14px 18px;
    border-radius: 8px; font-size: 0.9rem;
    display: none; word-break: break-word;
    line-height: 1.5;
}
.cld-msg.success {
    background: #dcfce7; color: #166534;
    display: block;
    border-left: 4px solid #16a34a;
    font-size: 0.95rem;
}
.cld-msg.error {
    background: #fee2e2; color: #991b1b;
    display: block;
    border-left: 4px solid #dc2626;
}

/* Lightbox */
.cld-lightbox {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 999999;
    /* display wird ausschliesslich per JS inline-style gesteuert */
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}
.cld-lightbox-inner {
    background: #fff; border-radius: 10px; padding: 20px;
    max-width: 700px; width: 100%; text-align: center;
    position: relative; box-sizing: border-box; margin: auto;
}
.cld-lightbox-inner img {
    max-width: 100%; max-height: 70vh;
    object-fit: contain; border-radius: 6px;
    margin: 0 auto 16px; display: block;
}
.cld-lightbox-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none;
    font-size: 1.8rem; cursor: pointer; color: #666; padding: 4px 8px;
}
.cld-lightbox-download {
    background: var(--cld-btn-download-bg) !important;
    color: var(--cld-btn-download-color) !important;
    border: none; padding: 11px 28px; border-radius: 7px;
    cursor: pointer; font-size: 0.95rem; font-weight: 600;
}
.cld-lightbox-download:hover { background: var(--cld-btn-download-hover) !important; }

.cld-empty { color: #888; font-style: italic; }