/* css/picture-picker.css - "My words" + "New word with a picture" dialog.
   THE SAME FILE in Rapid Naming Activity and Erasmus-reader (see
   js/picture-picker.js). Every class starts with "pp-". */

.pp-dialog {
    --pp-ink: #2c3e50;
    --pp-muted: #4b5563;
    --pp-line: #d5dee8;
    --pp-blue: #0277bd;
    --pp-card: #fdf9e3;
    width: min(980px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    border-radius: 20px;
    color: var(--pp-ink);
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    font-family: Verdana, 'Open Sans', sans-serif;
    overflow: hidden;
}
.pp-dialog[open] { display: flex; flex-direction: column; }
.pp-dialog::backdrop { background: rgba(30, 41, 59, 0.45); }
.pp-dialog button { font: inherit; cursor: pointer; }
[hidden].pp-clear, [hidden].pp-remove-pic, [hidden].pp-saved, .pp-dialog [hidden] { display: none !important; }
/* the apps' own button style (shadow, bold, flex) must not change these */
.pp-dialog button, .pp-new, .pp-mine-acts button, .pp-toast-undo, .pp-create-from-search { box-shadow: none; transition: background-color 0.15s ease; }
.pp-dialog .pp-tile, .pp-dialog .pp-btn, .pp-dialog .pp-x, .pp-dialog .pp-clear { display: flex; align-items: center; justify-content: center; }

.pp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 12px 18px; border-bottom: 1px solid #e5e7eb; }
.pp-title { margin: 0; font-size: 1.2rem; }
.pp-x { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; background: #f1f5f9; color: var(--pp-ink); font-size: 1.25rem; }
.pp-x:hover { background: #e2e8f0; }

.pp-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding: 18px; overflow: auto; flex: 1; align-content: start; }
.pp-label { display: block; font-weight: bold; margin-bottom: 6px; }
.pp-inwrap { position: relative; }
.pp-input {
    width: 100%; height: 60px; box-sizing: border-box; padding: 0 58px 0 16px;
    border: 2px solid #94a3b8; border-radius: 14px; font-size: 1.5rem; font-family: inherit; color: #1f2937; background: #fff;
}
.pp-input:focus { outline: none; border-color: var(--pp-blue); box-shadow: 0 0 0 4px rgba(2, 119, 189, 0.18); }
.pp-clear { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #f1f5f9; color: var(--pp-ink); font-size: 1.05rem; }

.pp-msg { margin: 12px 0; font-size: 0.98rem; line-height: 1.4; }
.pp-msg:empty { display: none; }
.pp-msg-info, .pp-msg-warn, .pp-msg-off, .pp-msg-none, .pp-msg-error { padding: 12px 14px; border-radius: 12px; }
.pp-msg-info { background: #f3f8fc; color: #1e3a5f; }
.pp-msg-warn { background: #fff7e6; color: #7a4b00; }
.pp-msg-off, .pp-msg-error { background: #fef2f2; color: #7f1d1d; }
.pp-msg-none { background: #f8fafc; color: #334155; text-align: center; padding: 24px 16px; }

.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.pp-tile {
    position: relative; aspect-ratio: 1; padding: 8px; box-sizing: border-box;
    border: 3px solid #e5e7eb; border-radius: 16px; background: #fff;
    display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.pp-tile img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.pp-dialog .pp-tile:active { transform: scale(0.97); }
.pp-tile:hover { border-color: #93c5fd; }
.pp-tile:focus-visible { outline: 3px solid var(--pp-blue); outline-offset: 2px; }
.pp-tile.pp-sel { border-color: var(--pp-blue); box-shadow: 0 0 0 4px rgba(2, 119, 189, 0.2); }
.pp-tile.pp-sel::after {
    content: '\2713'; position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%;
    background: var(--pp-blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: bold;
}
.pp-skeleton { background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9); background-size: 200% 100%; animation: pp-shine 1.2s infinite; }
@keyframes pp-shine { to { background-position: -200% 0; } }

.pp-cap { font-weight: bold; margin-bottom: 8px; }
.pp-card {
    background: var(--pp-card); border: 3px solid #fff; border-radius: 18px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 16px; min-height: 290px; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.pp-card-img { width: 180px; height: 180px; object-fit: contain; }
.pp-card-ph {
    width: 180px; height: 180px; box-sizing: border-box; padding: 10px; border: 3px dashed #cbd5e1; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 0.9rem;
}
.pp-card-word { font-family: 'OpenDyslexic', 'OpenDyslexicRegular', sans-serif; font-size: 2.3rem; color: #333; margin-top: 6px; overflow-wrap: anywhere; }
.pp-saved { margin-top: 10px; color: #166534; text-align: center; }
.pp-remove-pic { margin-top: 10px; width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--pp-line); background: #fff; color: #b42318; }

.pp-foot { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid #e5e7eb; background: #fafafa; }
.pp-foot .pp-credit { flex: 1; margin: 0; }
.pp-btn { min-height: 52px; padding: 0 20px; border-radius: 14px; font-weight: bold; font-size: 1rem; }
.pp-btn-2 { border: 2px solid var(--pp-ink); background: #fff; color: var(--pp-ink); }
.pp-btn-1 { border: 0; background: #16a34a; color: #fff; padding: 0 28px; }

.pp-credit { font-size: 0.75rem; color: #6b7280; margin-top: 12px; }

.pp-toast {
    position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 5;
    display: flex; align-items: center; gap: 14px; max-width: calc(100% - 24px); box-sizing: border-box;
    padding: 10px 10px 10px 20px; border-radius: 999px; background: #2c3e50; color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); font-size: 1rem; font-family: Verdana, 'Open Sans', sans-serif;
    animation: pp-in 0.2s ease-out;
}
body > .pp-toast { position: fixed; bottom: 24px; z-index: 10050; }
.pp-toast-undo { flex: none; white-space: nowrap; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: #fff; color: #2c3e50; font-weight: bold; font: inherit; font-weight: bold; cursor: pointer; }
@keyframes pp-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* "My words" section */
.pp-sec-title { margin: 0 0 4px; }
.pp-sec-hint { margin: 0 0 12px; color: #4b5563; font-size: 0.92rem; }
.pp-new {
    display: flex; align-items: center; justify-content: center; width: 100%; min-height: 60px; box-sizing: border-box;
    border: 2px dashed #0277bd; border-radius: 14px; background: #f3f8fc; color: #0277bd;
    font: inherit; font-size: 1.08rem; font-weight: bold; cursor: pointer;
}
.pp-new:hover { background: #e6f1fa; }
.pp-empty { margin: 12px 0 0; color: #6b7280; font-size: 0.9rem; }
.pp-mine { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.pp-mine-item { border: 1px solid #d5dee8; border-radius: 14px; padding: 10px; background: #fff; text-align: center; min-width: 0; }
.pp-mine-img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fdf9e3; border-radius: 10px; }
.pp-mine-word { font-family: 'OpenDyslexic', 'OpenDyslexicRegular', sans-serif; font-size: 1.2rem; margin: 6px 0 8px; overflow-wrap: anywhere; }
.pp-mine-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-mine-acts button { flex: 1; min-width: 0; min-height: 44px; white-space: nowrap; font-weight: normal; padding: 0 6px; border-radius: 10px; border: 1px solid #d5dee8; background: #f5f6fa; color: #2c3e50; font: inherit; font-size: 0.85rem; cursor: pointer; }
.pp-mine-acts .pp-mine-del { color: #b42318; }
.pp-create-from-search { width: 100%; min-height: 48px; margin-top: 8px; border: 2px dashed #0277bd; border-radius: 12px; background: #f3f8fc; color: #0277bd; font: inherit; font-weight: bold; cursor: pointer; }

@media (max-width: 700px) {
    .pp-dialog { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border-radius: 0; margin: 0; }
    .pp-body { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 12px; }
    .pp-main { display: contents; }
    .pp-label { order: -3; margin: 0; }
    .pp-inwrap { order: -2; }
    .pp-side { order: -1; position: sticky; top: -12px; z-index: 3; background: #fff; padding: 6px 0; }
    .pp-msg { order: 0; margin: 0; }
    .pp-grid { order: 1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .pp-tile { border-radius: 12px; padding: 5px; }
    .pp-cap { display: none; }
    .pp-side { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
    .pp-preview { flex-basis: 100%; }
    .pp-remove-pic { width: auto; min-height: 40px; margin: 0 0 0 auto; padding: 0 14px; }
    .pp-card { flex-direction: row; min-height: 0; padding: 10px; gap: 14px; justify-content: flex-start; text-align: left; }
    .pp-card-img, .pp-card-ph { width: 84px; height: 84px; flex: none; }
    .pp-card-ph { font-size: 0.7rem; }
    .pp-card-word { font-size: 1.8rem; margin: 0; }
    .pp-saved { text-align: left; margin: 0; }
    .pp-foot { flex-wrap: wrap; padding: 10px 12px; }
    .pp-foot .pp-credit { flex-basis: 100%; order: 3; font-size: 0.68rem; }
    .pp-foot .pp-btn { flex: 1; }
    .pp-toast { bottom: 150px; width: calc(100% - 24px); justify-content: space-between; }
    body > .pp-toast { bottom: 16px; }
    .pp-mine { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pp-mine-acts { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
    .pp-skeleton, .pp-toast { animation: none; }
}
@media print { .pp-dialog, .pp-toast { display: none !important; } }

/* 2026-11-01: the app's picture, own photo, who sees it */
.pp-tile-app, .pp-tile-photo { padding-bottom: 30px; }
.pp-tile-lbl { position: absolute; left: 4px; right: 4px; bottom: 4px; font-size: 0.72rem; font-weight: bold; line-height: 1.2; color: #334155; text-align: center; }
.pp-now { color: #166534; }
.pp-tile-photo img, .pp-photo { object-fit: cover !important; border-radius: 10px; }
.pp-tile-cam { flex-direction: column; gap: 4px; border: 3px dashed #0277bd; background: #f0f7fc; color: #0277bd; font-weight: bold; font-size: 0.9rem; text-align: center; cursor: pointer; }
.pp-tile-cam small { font-weight: normal; color: #475569; font-size: 0.75rem; }
.pp-cam-ic { font-size: 2rem; line-height: 1; }
.pp-who { margin-top: 12px; border: 1px solid #d5dee8; border-radius: 14px; padding: 10px 12px; background: #fff; font-size: 0.92rem; }
.pp-who-title { display: block; margin-bottom: 6px; }
.pp-who-row { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.pp-who-row input[type=radio] { width: 20px; height: 20px; flex: none; }
.pp-who-sel { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid #94a3b8; min-width: 0; flex: 1; }
.pp-photo-note { margin-top: 8px; font-size: 0.78rem; color: #475569; line-height: 1.35; }
.pp-mine-badge { display: inline-block; margin: 0 0 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: bold; background: #ede9fe; color: #5b21b6; }
.pp-mine-badge.pp-all { background: #e0f2fe; color: #075985; }
.pp-mine-note { font-size: 0.78rem; color: #6b7280; margin: 0 0 8px; }
.pp-mine-acts .pp-mine-app { color: #0f5f99; }
.pp-mine-acts button { flex: 1 1 100%; }
.own-pic-badge { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; font-size: 0.72rem; font-weight: bold; background: #ede9fe; color: #5b21b6; vertical-align: middle; }
.own-pic-badge.own-all { background: #e0f2fe; color: #075985; }
