/* Runde 3 – Team T4: eigene Styles (site.css gehoert T6).
   Story & Teilen (_StoryShare), Gäste-Seite (/friends), Export (/friends/export). */

/* ==========================================================================
   Story box: sharing per device
   ========================================================================== */
.story-share__controls {
    min-width: 0;
}

.story-share__actions {
    margin-top: 0;
}

.story-share__actions .story-share__btn {
    white-space: normal;
    line-height: 1.25;
}

/* "Copy link" is always there, but never louder than the one primary action */
.story-share__btn--copy {
    border-color: var(--gray);
    color: var(--white);
}

.story-share__btn--copy.is-done {
    border-color: var(--success);
    color: var(--success);
}

/* Desktop: download + copy side by side, the QR code next to it */
@media (min-width: 992px) {
    .story-share__actions[data-mode="desktop"] {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Phones: a smaller preview, so the share buttons are close to the top */
@media (max-width: 576px) {
    .story-share__preview {
        width: 52%;
        max-width: 200px;
    }
}

.story-share__qr {
    max-width: 36rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.875rem;
    border: 1px solid var(--gray-dark);
    border-radius: var(--radius-md, 10px);
    background: var(--black);
}

.story-share__qr[hidden] {
    display: none;
}

.story-share__qr-code {
    flex: 0 0 auto;
    width: 132px;
    height: 132px;
    border-radius: 6px;
    background: #fff;
    image-rendering: pixelated;
}

.story-share__qr-text {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--white);
}

.story-share__download-note {
    margin-top: 0.75rem;
}

.story-share__download-note[hidden] {
    display: none;
}

.story-share__photo {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-dark);
}

.story-share__controls > .story-share__photo:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.story-share__photo-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.story-share__photo-tools:not(:has(> :not([hidden]))) {
    display: none;
}

.story-share__photo-tools .btn {
    min-height: 44px;
}

.story-share__remove {
    color: var(--white-dim);
}

.story-share__remove:hover,
.story-share__remove:focus-visible {
    color: var(--error);
}

.story-share__photo .form-text[hidden] {
    display: none;
}

.story-choice span {
    min-height: 44px;
}

.story-share__howto {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--white-dim);
    line-height: 1.5;
}

.story-share__howto > summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
    color: var(--white);
    font-weight: 700;
}

.story-share__howto > summary:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 2px;
}

.story-share__howto p {
    margin: 0.25rem 0 0.5rem;
}

.story-share__howto strong {
    color: var(--white);
}

/* ==========================================================================
   Guests page (/friends)
   ========================================================================== */
.guests-export {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.guests-export__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.guests-export__hint {
    max-width: 26rem;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--white-dim);
    text-align: right;
}

@media (max-width: 767.98px) {
    .guests-export {
        align-items: stretch;
        width: 100%;
    }

    .guests-export__hint {
        max-width: none;
        text-align: left;
    }
}

.guests-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 575.98px) {
    .guests-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .guests-stats > :last-child {
        grid-column: 1 / -1;
    }
}

.guests-toolbar[hidden],
.guests-noresult[hidden],
.guests-group[hidden],
.guest-row[hidden] {
    display: none !important;
}

.guests-toolbar__count {
    white-space: nowrap;
}

.guests-pending-hint {
    margin: 0 0 1rem;
}

.guests-group {
    margin-bottom: 1.5rem;
    border: 1px solid var(--gray-dark);
    border-radius: var(--radius-md, 10px);
    background: var(--black-light);
    overflow: hidden;
}

.guests-group__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-dark);
}

.guests-group__title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.guests-group__title a {
    color: var(--white);
    text-decoration: none;
}

.guests-group__title a:hover,
.guests-group__title a:focus-visible {
    color: var(--accent-hover);
    text-decoration: underline;
}

.guests-group__meta {
    font-size: 0.8rem;
    color: var(--white-dim);
}

.guests-group__locked {
    margin: 0;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--gray-dark);
    background: var(--black-lighter);
    font-size: 0.85rem;
    color: var(--white);
}

.guests-group .table-responsive {
    margin: 0;
}

.guests-table {
    margin: 0;
}

.guests-table th {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--white-dim);
    white-space: nowrap;
}

.guests-table td {
    vertical-align: middle;
}

.guests-table .guest-status {
    margin-left: 0.35rem;
}

.guests-mail {
    overflow-wrap: anywhere;
}

.guests-cards {
    padding: 0.75rem;
}

.guests-card__foot {
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.guests-delete {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.guest-status--onlist {
    background: transparent;
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.5);
}

.guest-status--waiting {
    background: transparent;
    color: var(--warning);
    border: 1px dashed rgba(245, 158, 11, 0.6);
}

.guest-newsletter {
    font-size: 0.85rem;
    white-space: nowrap;
}

.guest-newsletter--yes {
    color: var(--success);
}

.guest-newsletter--pending {
    color: var(--warning);
}

.guest-newsletter--none {
    color: var(--white-dim);
}

/* ==========================================================================
   Export (/friends/export)
   ========================================================================== */
.lead-export,
.lead-export__preview,
.lead-export__builder {
    min-width: 0;
    max-width: 100%;
}

/* The wide preview table scrolls inside its box. contain:inline-size keeps its width out of
   the min-content size of the page columns (otherwise flex parents without min-width:0 grow
   and the whole page scrolls sideways - the global .app-main fix comes from T6). */
.lead-export__table-wrap {
    overflow-x: auto;
    max-width: 100%;
    contain: inline-size;
}

.lead-export__csv {
    max-width: 100%;
    overflow-x: auto;
    contain: inline-size;
}

.lead-export__free {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius-md, 10px);
    background: var(--accent-glow);
}

.lead-export__free-text {
    flex: 1 1 20rem;
    margin: 0;
    color: var(--white);
    line-height: 1.5;
}

.lead-export__free .btn {
    min-height: 44px;
    white-space: normal;
}

.lead-export__cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 575.98px) {
    .lead-export__cards {
        grid-template-columns: 1fr;
    }
}

.lead-export__card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 44px;
    padding: 1rem 1.125rem;
    border: 1px solid var(--gray);
    border-radius: var(--radius-md, 10px);
    background: var(--black-lighter);
    color: var(--white);
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.lead-export__card:hover {
    border-color: var(--accent);
    color: var(--white);
}

.lead-export__card:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 2px;
}

.lead-export__card.is-active {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.lead-export__card-title {
    font-weight: 700;
    line-height: 1.3;
}

.lead-export__card-text {
    font-size: 0.85rem;
    color: var(--white-dim);
    line-height: 1.45;
}

.lead-export__card-count {
    margin-top: auto;
    padding-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--accent-hover);
}

.lead-export__doi[hidden] {
    display: none;
}

.lead-export__raw > summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
}

.lead-export__builder {
    border: 1px dashed var(--gray);
    border-radius: var(--radius-md, 10px);
}

.lead-export__builder-summary {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 44px;
    padding: 0.875rem 1rem;
    cursor: pointer;
}

.lead-export__builder-summary:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 2px;
}

.lead-export__builder-title {
    font-weight: 700;
    color: var(--accent-hover);
}

.lead-export__builder-hint {
    font-size: 0.8rem;
    color: var(--white-dim);
}

.lead-export__builder-body {
    padding: 0 0.75rem 0.75rem;
}

.lead-export__builder .lead-export__section {
    background: var(--black-light);
}

.lead-export__template-select,
.lead-export__template-name {
    min-width: 0;
    max-width: 100%;
}

.lead-export__dialog {
    width: min(34rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 1.25rem;
    border: 1px solid var(--gray);
    border-radius: var(--radius-md, 10px);
    background: var(--black-light);
    color: var(--white);
}

.lead-export__dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.lead-export__dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.lead-export__dialog-actions .btn {
    min-height: 44px;
}

/* Download stays visibly "not yet" until the checkbox is ticked (no Bootstrap blue) */
.lead-export__dialog-actions .btn-primary:disabled {
    background: var(--gray);
    border-color: var(--gray);
    color: var(--white-dim);
    opacity: 1;
}

.lead-export__bar .btn {
    min-height: 44px;
}

/* Phones: the sticky download bar sits above the bottom navigation, never behind it */
@media (max-width: 992px) {
    .lead-export__bar {
        bottom: calc(60px + env(safe-area-inset-bottom));
    }
}
