/* public/css/share.css — Share button + sheet.
 * Visibility is controlled by JS (only mounts when enabled). */

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: #2563eb;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.share-btn:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); }
.share-btn-icon { font-size: 16px; }

/* Floating position — fixed bottom-right */
.share-btn--floating {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 900;
}

/* In-header / in-footer positions just flow inline */
.share-btn--header, .share-btn--footer { margin-left: 10px; }

/* Overlay + sheet */
.share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: share-fade 140ms ease-out;
}
@keyframes share-fade { from { opacity: 0 } to { opacity: 1 } }

.share-sheet {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: share-rise 160ms cubic-bezier(.2,.9,.2,1);
}
@keyframes share-rise { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.share-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    gap: 10px;
}
.share-sheet-head strong {
    font-size: 15px;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.share-sheet-close {
    appearance: none;
    border: 0;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.share-sheet-close:hover { background: #f3f4f6; color: #111827; }

.share-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 16px;
}
@media (max-width: 380px) { .share-sheet-grid { grid-template-columns: repeat(3, 1fr); } }

.share-channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    aspect-ratio: 1;
    padding: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    color: #111827;
    transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.share-channel:hover {
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}
.share-channel-icon { font-size: 22px; line-height: 1; }
.share-channel-label { font-size: 12px; color: #374151; text-align: center; line-height: 1.2; }

/* Channel brand tints */
.share-channel--facebook .share-channel-icon { color: #1877f2; font-weight: 700; font-style: italic; }
.share-channel--twitter  .share-channel-icon { color: #111; font-weight: 700; }
.share-channel--whatsapp .share-channel-icon { color: #25d366; }
.share-channel--linkedin .share-channel-icon { color: #0a66c2; font-weight: 700; }

.share-qr-slot:empty { display: none; }
.share-qr-box {
    padding: 14px 16px 18px;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}
.share-qr-box svg { margin: 0 auto; display: block; max-width: 180px; }
.share-qr-box small { display: block; margin-top: 8px; color: #6b7280; font-size: 11px; word-break: break-all; }

/* Toast */
.share-toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    padding: 10px 16px;
    background: #111827;
    color: #fff;
    border-radius: 999px;
    font-size: 13px;
    z-index: 1300;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    animation: share-toast-in 180ms forwards;
}
.share-toast.is-gone { animation: share-toast-out 300ms forwards; }
@keyframes share-toast-in  { to { opacity: 1 } }
@keyframes share-toast-out { to { opacity: 0; transform: translate(-50%, 8px); } }

/* Install-help modal — shown when native install prompt isn't available */
.install-help-sheet { max-width: 480px; }
.install-help-body { padding: 16px 18px 20px; max-height: 70vh; overflow-y: auto; }
.install-help-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #e5e7eb; }
.install-help-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.install-help-section.is-primary { background: #eff6ff; border-radius: 8px; padding: 12px 14px; border: 0; }
.install-help-section h3 { margin: 0 0 8px; font-size: 14px; color: #111827; }
.install-help-section ol { margin: 0; padding-left: 20px; color: #374151; font-size: 13px; line-height: 1.6; }
.install-help-section.is-primary ol { color: #1e3a8a; }
[data-theme="dark"] .install-help-section { border-bottom-color: var(--border-color); }
[data-theme="dark"] .install-help-section h3 { color: var(--text-color); }
[data-theme="dark"] .install-help-section ol { color: var(--text-light); }
[data-theme="dark"] .install-help-section.is-primary { background: #1e293b; }
[data-theme="dark"] .install-help-section.is-primary ol { color: var(--text-color); }

/* Hide everything share-related when printing */
@media print {
    .share-btn, .share-overlay, .share-toast { display: none !important; }
}

/* Dark theme — share sheet + toast repainted against the dark palette. */
[data-theme="dark"] .share-overlay { background: rgba(0, 0, 0, 0.7); }
[data-theme="dark"] .share-sheet { background: var(--card-bg); color: var(--text-color); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55); }
[data-theme="dark"] .share-sheet-head { border-bottom-color: var(--border-color); }
[data-theme="dark"] .share-sheet-head strong { color: var(--text-color); }
[data-theme="dark"] .share-sheet-close { color: var(--text-light); }
[data-theme="dark"] .share-sheet-close:hover { background: var(--card-hover-bg); color: var(--text-color); }
[data-theme="dark"] .share-channel { background: var(--card-hover-bg); border-color: var(--border-color); color: var(--text-color); }
[data-theme="dark"] .share-channel:hover { border-color: var(--primary-color); }
[data-theme="dark"] .share-channel-label { color: var(--text-light); }
[data-theme="dark"] .share-channel--twitter .share-channel-icon { color: var(--text-color); }
[data-theme="dark"] .share-qr-box { background: var(--background-alt); border-top-color: var(--border-color); }
[data-theme="dark"] .share-qr-box small { color: var(--text-light); }
/* QR itself: keep the white-on-black scan target for reliable reading */

[data-theme="dark"] .share-toast { background: #f1f5f9; color: #0f172a; }
