/* ════════════════════════════════════════════════════════════════════
   Photo Uploader — componente compartilhado (abertura + conclusão)
   Botão único "Adicionar Fotos" + grid de thumbnails com remover.
   ════════════════════════════════════════════════════════════════════ */

.pu-zone {
    border: 1.5px dashed #c5cae9;
    border-radius: 10px;
    padding: 18px;
    background: #f8f9fc;
    text-align: center;
}

.pu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: #fff;
    color: #1a237e;
    border: 1.5px solid #1a237e;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    font-size: .88rem;
    cursor: pointer;
    transition: background .15s, color .15s, transform .15s;
}
.pu-btn:hover:not(:disabled) {
    background: #1a237e;
    color: #fff;
    transform: translateY(-1px);
}
.pu-btn:disabled { opacity: .5; cursor: not-allowed; }

.pu-counter {
    margin-left: 10px;
    font-size: .82rem;
    color: #555;
    font-weight: 600;
}

.pu-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.pu-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #dde1e8;
    background: #fff;
    aspect-ratio: 1 / 1;
}
.pu-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pu-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,.65);
    color: #fff;
    border: none;
    font-size: .8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    padding: 0;
}
.pu-remove:hover { background: rgba(220,53,69,.95); }

.pu-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    color: #fff;
    font-size: .68rem;
    padding: 14px 6px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pu-error {
    color: #c62828;
    background: #fdecea;
    border: 1px solid #f5c2c0;
    border-radius: 6px;
    font-size: .78rem;
    text-align: left;
    padding: 8px 10px;
    margin-top: 8px;
}

/* Placeholder quando o navegador não consegue renderizar o preview (HEIC fora do Safari) */
.pu-thumb-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef0f7;
    color: #7986cb;
    font-size: 1.8rem;
}

/* Fallback para navegadores sem input.files programável (Safari < 14.5):
   os inputs nativos aparecem, um por foto. */
.pu-native { text-align: left; margin-top: 6px; }
.pu-native-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.pu-native-label {
    font-size: .8rem;
    font-weight: 700;
    color: #555;
    min-width: 56px;
}
/* 16px evita o zoom automático do Safari iOS ao tocar no campo. */
.pu-native-row input[type="file"] { font-size: 16px; flex: 1 1 200px; }

[data-theme="dark"] .pu-zone {
    background: rgba(255,255,255,.03);
    border-color: #3d4148;
}
[data-theme="dark"] .pu-btn {
    background: #2d3038;
    color: #93c5fd;
    border-color: #93c5fd;
}
[data-theme="dark"] .pu-btn:hover:not(:disabled) {
    background: #3b82f6;
    color: #fff;
}
[data-theme="dark"] .pu-counter { color: #9ca3af; }
[data-theme="dark"] .pu-thumb { background: #1e2027; border-color: #3d4148; }
[data-theme="dark"] .pu-error {
    background: rgba(198,40,40,.15);
    border-color: rgba(198,40,40,.45);
    color: #ef9a9a;
}
[data-theme="dark"] .pu-thumb-ph { background: #2d3038; color: #93c5fd; }
[data-theme="dark"] .pu-native-label { color: #9ca3af; }
