/* ═══════════════════════════════════════════════════════
   HK Kampagne Abgeordnete — Frontend
   Step-basierter Wizard: PLZ → MdB-Auswahl → E-Mail
   ═══════════════════════════════════════════════════════ */

.hk-container {
    max-width: 100%;
    margin: 0;
    padding: 20px 0;
}

/* ── Screen-Reader-Only ─────────────────── */
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0; word-wrap: normal !important;
}

/* ── Stepper ────────────────────────────── */
.hk-stepper {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    position: relative;
    gap: 0;
}
.hk-stepper::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 16%;
    right: 16%;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}
.hk-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1 1 0;
    text-align: center;
    position: relative;
    z-index: 1;
    color: #999;
    transition: color .2s;
    user-select: none;
}
.hk-step.is-active { color: #0000b4; font-weight: 600; }
.hk-step.is-done   { color: #0000b4; }
.hk-step.is-clickable { cursor: pointer; }
.hk-step.is-clickable:hover .hk-step-num {
    background: #0000b4;
    border-color: #0000b4;
    color: #fff;
    transform: scale(1.05);
}

.hk-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    transition: all .2s;
}
.hk-step.is-active .hk-step-num {
    background: #0000b4;
    border-color: #0000b4;
    color: #fff;
}
.hk-step.is-done .hk-step-num {
    background: #71b7fa;
    border-color: #71b7fa;
    color: #fff;
}
.hk-step-label {
    font-size: 14px;
    font-weight: 600;
}

/* ── Step Sections ──────────────────────── */
.hk-step-section[hidden] { display: none; }
.hk-step-section { padding: 4px 0; }

/* ── Step 1: Suche ──────────────────────── */
.hk-intro {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 20px;
}
.hk-search-form {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.hk-plz-input {
    flex: 0 0 250px;
    padding: 12px 16px;
    font-size: 15px !important;
    border: 2px solid #ccc;
    border-radius: 3px;
    text-align: left;
    transition: border-color .2s, box-shadow .2s;

    border-bottom-left-radius: 25px !important;
    border-top-left-radius: 25px !important;
    padding-left: 25px !important;
}
.hk-plz-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,.15);
}

/* ── Buttons ────────────────────────────── */
.hk-btn {
    padding: 12px 25px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background .2s, transform .1s, opacity .2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    line-height: 1.2;
    box-sizing: border-box;
}
.hk-btn:active { transform: scale(.98); }
.hk-btn:disabled { opacity: .4; cursor: not-allowed; }
.hk-btn.is-disabled { opacity: .4; pointer-events: none; }
.hk-btn-primary { background: #0000b4; color: #fff; }
.hk-btn-primary:hover:not(:disabled):not(.is-disabled) { background: #71b7fa; color: #fff; }
.hk-btn-secondary { background: #f0f0f0; color: #1d2327; border: 1px solid #ccc; }
.hk-btn-secondary:hover { background: #e0e0e0; color: #1d2327; }

/* Inline-SVG-Icons in Buttons (E-Mail-öffnen, Copy-Buttons) */
.hk-btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    vertical-align: -2px;
}

.hk-btn-link {
    background: transparent;
    border: none;
    color: #2271b1;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    text-decoration: underline;
    font-weight: 500;
}
.hk-btn-link:hover { color: #0000b4; }

#hk-search-btn{
    border-bottom-right-radius: 25px;
    border-top-right-radius: 25px;
}

#hk-compose-top,
#hk-compose-bottom{
    border-bottom-right-radius: 25px;
    border-top-right-radius: 25px;
    border-bottom-left-radius: 25px;
    border-top-left-radius: 25px;
}

/* ── Hinweise / Loading ─────────────────── */
.hk-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.5;
}
.hk-message-error   { background: #fef0f0; color: #b91c1c; border: 1px solid #fca5a5; }
.hk-message-info    { background: #eff6ff; color: #0000b4; border: 1px solid #93c5fd; }
.hk-message-warning { background: #fef9e7; color: #92400e; border: 1px solid #fcd34d; }

.hk-loading { text-align: center; padding: 24px; color: #666; font-size: 15px; }
.hk-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: hk-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes hk-spin { to { transform: rotate(360deg); } }

/* ── PLZ-Display Badge ──────────────────── */
.hk-plz-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 15px;
    flex-wrap: wrap;
}
.hk-plz-display strong { color: #0000b4; font-size: 17px; margin-left: 4px; }

/* ── Bulk-Bar (oben & unten) ────────────── */
.hk-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.hk-bulk-bar-bottom {
    margin-top: 16px;
    margin-bottom: 0;
    border-top: 1px solid #e0e0e0;
    padding-top: 16px;
}
.hk-bulk-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hk-counter { color: #555; font-size: 14px; font-weight: 500; margin-left: 8px; }

/* ── MdB-Cards ──────────────────────────── */
.hk-mdb-list { display: flex; flex-direction: column; gap: 8px; }
.hk-mdb-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s;
    margin: 0;
}
.hk-mdb-card:hover {
    background: #eff6ff;
    border-color: #e3f1fe;
}
/* Modern: :has()-Selector für gecheckten Zustand */
.hk-mdb-card:has(input:checked) {
    background: #e3f1fe;
    border-color: #e3f1fe;
    box-shadow: 0 1px 1px rgba(34,113,177,.2);
}

/* Fallback für ältere Browser ohne :has()-Support */
.hk-mdb-card.is-checked {
    background: #dbeafe;
    border-color: #0000b4;
    box-shadow: 0 1px 3px rgba(34,113,177,.2);
}
.hk-mdb-card:focus-within {
    outline: 2px solid #0000b4;
    outline-offset: 2px;
}
.hk-mdb-card input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    accent-color: #0000b4;
    cursor: pointer;
    flex-shrink: 0;
}

.hk-mdb-info { flex: 1; min-width: 0; }
.hk-mdb-name {
    font-size: 17px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 6px 0;
}
.hk-mdb-party {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: #e8f0fe;
    color: #0000b4;
    margin-bottom: 8px;
}
.hk-mdb-meta { font-size: 15px; color: #555; line-height: 1.7; }
.hk-mdb-meta span { display: inline-block; margin-right: 16px; }

/* ── Step 3: E-Mail ─────────────────────── */
.hk-mail-summary { margin-bottom: 20px; }
.hk-mail-summary h3 {
    font-size: 18px;
    margin: 0 0 12px 0;
    color: #1d2327;
}
.hk-recipient-list {
    margin: 0;
    padding: 0;
    list-style: none;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-weight: 400 !important;
}
.hk-recipient-list li {
    padding: 10px 16px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
    color: #333;
}
.hk-recipient-list li:last-child { border-bottom: none; }
.hk-recipient-list .hk-rec-email { color: #0000b4; }

.hk-mail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 16px;
    margin-bottom: 24px;
}
.hk-copy-confirm {
    color: #00a32a;
    font-size: 13px;
    opacity: 0;
    transition: opacity .3s;
    margin-left: 4px;
}
.hk-copy-confirm.show { opacity: 1; }

/* ── Preview-Boxen (Step 3) ───────────────────────────── */
.hk-preview-heading {
    font-size: 16px;
    font-weight: 700;
    color: #1d2327;
    margin: 60px 0 30px 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.hk-preview { display: flex; flex-direction: column; gap: 12px; }
.hk-preview-field {
    position: relative;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    padding: 11px 9px 11px 12px;
    transition: border-color .15s;
}
.hk-preview-field[hidden] { display: none; }
.hk-preview-field:hover { border-color: #0000b4; }
.hk-preview-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #666;
    margin-bottom: 13px;
}
.hk-preview-value {
    font-size: 18px;
    color: #1d2327;
    line-height: 1.5;
    word-break: break-word;
    min-height: 20px;
}
.hk-preview-value-body {
    white-space: pre-wrap;
    max-height: 280px;
    overflow-y: auto;
    line-height: 1.6;
    font-family: inherit;
}
.hk-preview-copy {
    position: absolute;
    top: 9px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    background: #fff;
    color: #1d2327;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s, color .15s;
}
.hk-preview-copy:hover {
    background: #0000b4;
    border-color: #0000b4;
    color: #fff;
}
.hk-preview-copy:focus-visible {
    outline: 2px solid #0000b4;
    outline-offset: 2px;
}
.hk-preview-copy.is-copied {
    background: #00a32a;
    border-color: #00a32a;
    color: #fff;
}

/* Editierbare Felder in den Preview-Boxen — sollen optisch wie die alten
   Divs wirken, aber sich beim Fokus klar als Eingabefeld zu erkennen geben. */
.hk-preview-input,
.hk-preview-textarea {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: 18px;
    color: #1d2327;
    line-height: 1.5;
    box-sizing: border-box;
    outline: none;
    appearance: none;
}
.hk-preview-input:focus,
.hk-preview-textarea:focus {
    outline: 2px solid #0000b4;
    outline-offset: 4px;
    border-radius: 2px;
}

#hk-bcc-hint{
    font-weight: 400 !important;
}

#hk-preview-subject{
    font-size: 18px;
    color: #666;
    padding: 8px 10px;
}

.hk-preview-textarea {
    line-height: 1.6;
    min-height: 200px;
    /* überschreibt die max-height aus .hk-preview-value-body */
    max-height: none;
    resize: vertical;
    white-space: pre-wrap;
    overflow-y: auto;
    border: 1px solid #d0d5dd;
    padding: 10px;

    color: #666;
}

/* Testmodus-Banner — Step 3, nur sichtbar wenn hk_test_mode aktiv */
.hk-test-mode-banner {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    color: #92400e;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}
.hk-test-mode-banner::before {
    content: '⚠️ ';
    margin-right: 6px;
}
.hk-test-mode-banner[hidden] {
    display: none;
}

/* BCC-Hinweis — nur sichtbar bei mehreren Empfängern */
.hk-bcc-hint {
    margin-bottom: 20px;
}

/* ── Kein-Mandat-Hinweise ───────────────── */
.hk-no-mandate {
    background: #fef9e7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    font-size: 15px;
    color: #92400e;
    line-height: 1.6;
}

/* ── Mobile ─────────────────────────────── */
@media (max-width: 600px) {
    .hk-stepper { gap: 4px; }
    .hk-stepper::before { left: 14%; right: 14%; }
    .hk-step-label { font-size: 11px; }

    .hk-search-form { flex-direction: column; }
    .hk-plz-input { flex: none; width: 100%; box-sizing: border-box; }

    .hk-btn { width: 100%; text-align: center; justify-content: center; }
    .hk-btn-link { width: auto; }

    .hk-bulk-bar { flex-direction: column; align-items: stretch; }
    .hk-bulk-info { justify-content: center; }

    .hk-mdb-meta span { display: block; margin-right: 0; }

    .hk-mail-actions { flex-direction: column; align-items: stretch; }
    .hk-copy-confirm { text-align: center; margin: 4px 0 0 0; }

    .hk-plz-display { justify-content: space-between; }
}
