/* ==========================================================================
   Free tools: lootjes trekken, verlanglijstje, sinterklaasgedicht.
   Builds on modern-theme.css tokens; loaded only on the tool pages.
   ========================================================================== */

/* --- Layout --------------------------------------------------------------- */

.tool-wrap { max-width: 860px; margin: 0 auto; }
.tool-wrap-sm { max-width: 640px; margin: 0 auto; }

.tool-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    padding: clamp(1.25rem, 4vw, 2.25rem);
}
.tool-panel + .tool-panel { margin-top: 1.5rem; }
.tool-panel-lift { margin-top: -3.5rem; position: relative; z-index: 2; }

.tool-panel-title { font-size: 1.25rem; margin: 0 0 0.25rem; display: flex; align-items: center; gap: 0.625rem; }
.tool-panel-title .step {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--brand-50); color: var(--brand-700); font-size: 0.875rem; font-weight: 800;
}
.tool-panel-sub { color: var(--text-muted); margin: 0 0 1.25rem; font-size: 0.9375rem; }
.tool-divider { height: 1px; background: var(--border); margin: 1.75rem 0; border: 0; }

.tool-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.tool-grid-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .tool-grid-2, .tool-grid-3 { grid-template-columns: 1fr; } }

.form-hint { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.375rem; }
.form-error { font-size: 0.8125rem; color: var(--error); margin-top: 0.375rem; font-weight: 500; }
.form-control.is-invalid { border-color: var(--error); }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.optional { font-weight: 400; color: var(--text-light); }

/* --- Flash messages --------------------------------------------------------- */

.tool-flash {
    display: flex; gap: 0.75rem; align-items: flex-start;
    padding: 0.875rem 1rem; border-radius: var(--radius-lg);
    font-size: 0.9375rem; margin-bottom: 1.25rem;
}
.tool-flash i { margin-top: 0.2rem; }
.tool-flash.ok { background: var(--success-soft); color: #166534; }
.tool-flash.err { background: var(--error-soft); color: #991b1b; }
.tool-flash.info { background: var(--brand-50); color: var(--brand-800); }

/* --- Segmented choice (tone, length, occasion) ------------------------------ */

.seg { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.625rem 1rem; border-radius: var(--radius-full);
    border: 1px solid var(--border-strong); background: var(--white);
    font-size: 0.9375rem; font-weight: 500; color: var(--gray-700);
    cursor: pointer; transition: all .15s;
}
.seg label:hover { border-color: var(--brand-300); }
.seg input:checked + label { background: var(--brand-600); border-color: var(--brand-600); color: var(--white); box-shadow: var(--shadow-glow); }
.seg input:focus-visible + label { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* --- Participants editor (lootjes) --------------------------------------------- */

.people { display: grid; gap: 0.625rem; }
.person {
    display: grid; grid-template-columns: 34px 1.2fr 1fr 1fr 40px; gap: 0.5rem; align-items: center;
    padding: 0.5rem; border-radius: var(--radius-lg); background: var(--light); border: 1px solid transparent;
    transition: border-color .15s, background .15s;
}
.person:focus-within { background: var(--white); border-color: var(--brand-200); }
.person-num {
    width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--white); color: var(--brand-700); font-weight: 700; font-size: 0.8125rem; box-shadow: var(--shadow-xs);
}
.person .form-control { height: 40px; font-size: 0.9375rem; }
.person-remove {
    width: 36px; height: 36px; border: 0; background: none; color: var(--gray-400); border-radius: var(--radius);
    cursor: pointer; font-size: 1rem;
}
.person-remove:hover { color: var(--error); background: var(--error-soft); }
.people-head { display: grid; grid-template-columns: 34px 1.2fr 1fr 1fr 40px; gap: 0.5rem; padding: 0 0.5rem 0.25rem; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 720px) {
    .people-head { display: none; }
    .person { grid-template-columns: 30px 1fr 36px; }
    .person .person-email, .person .person-partner { grid-column: 2 / 3; }
    .person-num { width: 26px; height: 26px; }
}
.people-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin-top: 0.875rem; }
.people-count { font-size: 0.875rem; color: var(--text-muted); }

/* --- Link rows (admin + share) ---------------------------------------------- */

.link-list { display: grid; gap: 0.625rem; }
.link-row {
    display: grid; grid-template-columns: auto 1fr auto; gap: 0.875rem; align-items: center;
    padding: 0.75rem 0.875rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--white);
}
.link-avatar {
    width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: var(--white); background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
}
.link-name { font-weight: 600; color: var(--dark); }
.link-meta { font-size: 0.8125rem; color: var(--text-muted); }
.link-meta .seen { color: var(--success); font-weight: 600; }
.link-actions { display: flex; gap: 0.375rem; }
@media (max-width: 560px) {
    .link-row { grid-template-columns: auto 1fr; }
    .link-actions { grid-column: 1 / -1; }
    .link-actions .btn { flex: 1; }
}

.copy-field { display: flex; gap: 0.5rem; }
.copy-field input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 0.8125rem; background: var(--light); }
@media (max-width: 480px) { .copy-field { flex-direction: column; } }

.btn-whatsapp { background: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1ebe5b; color: #fff; }

.share-box {
    display: grid; gap: 0.75rem; padding: 1.25rem; border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--brand-50), #fff); border: 1px solid var(--brand-100);
}
.share-box-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* --- Reveal (lootje) --------------------------------------------------------- */

.reveal { text-align: center; padding: 1rem 0 0.5rem; }
.reveal-gift {
    position: relative; width: 180px; height: 180px; margin: 0 auto 1.25rem; cursor: pointer;
    border: 0; background: none; padding: 0;
}
.reveal-gift .box {
    position: absolute; left: 20px; right: 20px; bottom: 0; height: 110px; border-radius: 14px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-800));
    box-shadow: 0 20px 40px -12px rgba(3, 100, 186, .55);
}
.reveal-gift .lid {
    position: absolute; left: 10px; right: 10px; top: 42px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
    transition: transform .6s cubic-bezier(.3, 1.6, .5, 1), opacity .6s;
    transform-origin: left bottom; z-index: 2;
}
.reveal-gift .ribbon-v { position: absolute; left: 50%; width: 22px; margin-left: -11px; top: 42px; bottom: 0; background: #fff; opacity: .92; z-index: 3; transition: opacity .3s; }
.reveal-gift .bow { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font-size: 40px; color: #fff; z-index: 4; transition: transform .6s, opacity .4s; text-shadow: 0 4px 10px rgba(0,0,0,.2); }
.reveal-gift:hover .box, .reveal-gift:hover .lid { filter: brightness(1.08); }
.reveal-gift:not(.open) { animation: wiggle 2.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 84% { transform: rotate(-4deg); } 88% { transform: rotate(4deg); } 92% { transform: rotate(-3deg); } 96% { transform: rotate(2deg); } }
.reveal-gift.open .lid { transform: translate(-30px, -60px) rotate(-35deg); opacity: 0; }
.reveal-gift.open .bow { transform: translate(-50%, -80px) scale(.6); opacity: 0; }
.reveal-gift.open .ribbon-v { opacity: 0; }
.reveal-hint { color: var(--text-muted); font-size: 0.9375rem; }
.reveal-name {
    font-family: var(--font-display); font-size: clamp(2.5rem, 9vw, 4.5rem); font-weight: 800; line-height: 1.05;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-800)); -webkit-background-clip: text; background-clip: text; color: transparent;
    margin: 0.25rem 0 0.5rem; letter-spacing: -0.02em;
}
.reveal-result { display: none; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
.reveal.is-open .reveal-result { display: block; }
.reveal.is-open .reveal-hint { display: none; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }

.fact-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.625rem; margin-top: 1rem; }
.fact {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.875rem; border-radius: var(--radius-full);
    background: var(--brand-50); color: var(--brand-800); font-weight: 600; font-size: 0.875rem;
}

.wish-card { background: var(--light); border-radius: var(--radius-lg); padding: 1rem 1.125rem; white-space: pre-line; color: var(--gray-700); }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 3000; }

/* --- Wishlist items ---------------------------------------------------------- */

.wish-list { display: grid; gap: 0.75rem; }
.wish {
    display: grid; grid-template-columns: 76px 1fr auto; gap: 1rem; align-items: center;
    padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--white);
    transition: box-shadow .2s, opacity .2s;
}
.wish:hover { box-shadow: var(--shadow-md); }
.wish-img {
    width: 76px; height: 76px; border-radius: var(--radius-lg); object-fit: contain; background: var(--white);
    border: 1px solid var(--gray-100);
}
.wish-img.placeholder { display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-500); font-size: 1.5rem; border: 0; }
.wish-title { font-weight: 600; color: var(--dark); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wish-title a { color: inherit; text-decoration: none; }
.wish-title a:hover { color: var(--brand-600); }
.wish-note { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.125rem; }
.wish-price { font-weight: 700; color: var(--brand-700); font-size: 0.9375rem; margin-top: 0.25rem; }
.wish-actions { display: flex; gap: 0.375rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.wish.is-reserved { opacity: .6; }
.wish.is-reserved .wish-img { filter: grayscale(1); }
.reserved-tag { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; font-weight: 600; color: var(--success); }
.icon-btn {
    width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); background: var(--white); color: var(--gray-500); border-radius: var(--radius);
    cursor: pointer; font-size: 0.8125rem;
}
.icon-btn:hover { color: var(--brand-700); border-color: var(--brand-200); }
.icon-btn.danger:hover { color: var(--error); border-color: var(--error); background: var(--error-soft); }
@media (max-width: 560px) {
    .wish { grid-template-columns: 60px 1fr; }
    .wish-img { width: 60px; height: 60px; }
    .wish-actions { grid-column: 1 / -1; justify-content: stretch; }
    .wish-actions > .btn, .wish-actions > form, .wish-actions > details { flex: 1; }
    .wish-actions > form .btn, .wish-actions > details > summary { width: 100%; }
}

.reserve-pop summary { list-style: none; cursor: pointer; }
.reserve-pop summary::-webkit-details-marker { display: none; }
.reserve-pop[open] summary { display: none; }
.reserve-pop form { display: flex; gap: 0.375rem; }
.reserve-pop .form-control { height: 36px; font-size: 0.875rem; min-width: 0; width: 150px; }
@media (max-width: 560px) { .reserve-pop .form-control { width: auto; flex: 1; } }

/* Search-as-you-type results */
.search-box { position: relative; }
.search-box .fa-magnifying-glass { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.search-box .form-control { height: 52px; padding-left: 2.75rem; font-size: 1rem; border-radius: var(--radius-lg); }
.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.search-result {
    display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--white); overflow: hidden; text-align: left;
}
.search-result img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; padding: 0.5rem; }
.search-result-body { padding: 0.625rem 0.75rem 0.75rem; display: flex; flex-direction: column; gap: 0.375rem; flex: 1; }
.search-result-name { font-size: 0.8125rem; font-weight: 600; color: var(--dark); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-result-price { font-size: 0.8125rem; font-weight: 700; color: var(--brand-700); }
.search-result .btn { margin-top: auto; }
.search-status { margin-top: 0.875rem; color: var(--text-muted); font-size: 0.875rem; display: flex; align-items: center; gap: 0.5rem; }

.empty-state { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2rem; color: var(--brand-300); margin-bottom: 0.75rem; display: block; }

/* --- Poem ---------------------------------------------------------------------- */

.poem-paper {
    position: relative; max-width: 620px; margin: 0 auto; padding: clamp(1.75rem, 5vw, 3rem) clamp(1.25rem, 5vw, 3rem);
    background: #fffdf7; border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl), inset 0 0 0 1px #f3ead2;
}
.poem-paper::before {
    content: ""; position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(-2deg);
    width: 110px; height: 28px; background: rgba(195, 224, 251, .75); border-radius: 3px;
}
.poem-text {
    font-family: "Georgia", "Times New Roman", serif; font-size: clamp(1rem, 2.4vw, 1.125rem); line-height: 1.85;
    color: #3b2f1c; white-space: pre-line; text-align: center; margin: 0;
}
.poem-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.75rem; }

.poem-loading { display: none; text-align: center; padding: 1rem 0 0; color: var(--brand-700); font-weight: 600; }
.poem-loading .quill { display: inline-block; animation: write 1s ease-in-out infinite; margin-right: 0.5rem; }
@keyframes write { 0%, 100% { transform: translate(0, 0) rotate(-10deg); } 50% { transform: translate(8px, -2px) rotate(8deg); } }
form.is-busy .poem-loading { display: block; }
form.is-busy button[type=submit] { opacity: .6; pointer-events: none; }

.limit-meter { display: flex; align-items: center; gap: 0.5rem; justify-content: center; font-size: 0.875rem; color: var(--text-muted); margin-top: 0.875rem; }
.limit-meter .dots { display: inline-flex; gap: 4px; }
.limit-meter .dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-500); }
.limit-meter .dots span.used { background: var(--gray-200); }

/* --- Tool landing extras --------------------------------------------------------- */

.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.how-step { text-align: center; padding: 1.25rem 1rem; }
.how-step-icon {
    width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 0.875rem; display: flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand-600); font-size: 1.375rem;
}
.how-step h3 { font-size: 1rem; margin: 0 0 0.25rem; }
.how-step p { font-size: 0.875rem; color: var(--text-muted); margin: 0; }
@media (max-width: 640px) { .how-steps { grid-template-columns: 1fr; } .how-step { display: grid; grid-template-columns: 56px 1fr; gap: 0 1rem; text-align: left; padding: 0.5rem 0; } .how-step-icon { margin: 0; grid-row: span 2; } }

.my-items { display: grid; gap: 0.5rem; }
.my-item {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem;
    border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; color: var(--dark); background: var(--white);
}
.my-item:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); }
.my-item small { color: var(--text-muted); }

.faq details { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.faq summary { font-weight: 600; color: var(--dark); cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand-600); font-weight: 700; font-size: 1.25rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0.625rem 0 0; color: var(--text-muted); }

.tool-cross { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tool-cross.cols-1 { grid-template-columns: 1fr; }
.tool-cross.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 760px) { .tool-cross, .tool-cross.cols-2 { grid-template-columns: 1fr; } }
.tool-card {
    display: flex; flex-direction: column; gap: 0.5rem; padding: 1.25rem; border-radius: var(--radius-xl);
    border: 1px solid var(--border); background: var(--white); text-decoration: none; color: var(--gray-700);
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-200); }
.tool-card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-600); font-size: 1.125rem; }
.tool-card strong { color: var(--dark); font-size: 1.0625rem; }
.tool-card span { font-size: 0.875rem; color: var(--text-muted); }

@media print {
    .modern-nav, footer, .poem-actions, .no-print, .page-hero .breadcrumbs { display: none !important; }
    .poem-paper { box-shadow: none; background-image: none; }
}
