/* Seletor "Tirar Foto / Enviar do dispositivo" e câmera do Nexo (ver scripts/nexo-camera.js).
   A folha de escolha segue o tema do sistema; a câmera é sempre escura, como em apps de câmera,
   para o preview não competir com a interface. */

dialog.nexo-cam {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    max-width: none;
    max-height: none;
    overflow: visible;
    font-family: inherit;
}

dialog.nexo-cam::backdrop {
    background: rgba(6, 10, 16, 0.62);
    backdrop-filter: blur(3px);
}

.nexo-cam [hidden] {
    display: none !important;
}

.nexo-cam button {
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* ------------------------------------------------------------------ folha de escolha */

dialog.nexo-cam--escolha {
    width: 100%;
    margin: auto 0 0 0;
    animation: nexo-cam-sobe 0.22s ease-out;
}

.nexo-cam__folha {
    background: var(--cor-superficie-elevada, #171d28);
    color: var(--cor-texto, #f2f5f9);
    border: 1px solid var(--cor-borda, #2b3544);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    padding: 10px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.35);
}

.nexo-cam__alca {
    width: 42px;
    height: 4px;
    border-radius: 4px;
    background: var(--cor-borda-forte, #3a4658);
    margin: 0 auto 14px;
}

.nexo-cam__titulo {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    color: var(--cor-texto, #f2f5f9);
}

.nexo-cam__opcoes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nexo-cam__opcao {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    text-align: left;
    color: inherit;
    background: var(--cor-superficie-suave, #141922);
    border: 1px solid var(--cor-borda, #2b3544);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.nexo-cam__opcao:hover {
    border-color: var(--cor-primaria, #4f8cff);
}

.nexo-cam__opcao:active {
    transform: scale(0.985);
}

.nexo-cam__opcao:focus-visible,
.nexo-cam__cancelar:focus-visible {
    outline: 2px solid var(--cor-primaria, #4f8cff);
    outline-offset: 2px;
}

.nexo-cam__opcao--destaque {
    background: var(--cor-primaria-suave, rgba(79, 140, 255, 0.14));
    border-color: var(--cor-navegacao-ativa-borda, rgba(79, 140, 255, 0.28));
}

.nexo-cam__opcao-icone {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--cor-superficie, #171d28);
    color: var(--cor-primaria, #4f8cff);
}

.nexo-cam__opcao--destaque .nexo-cam__opcao-icone {
    background: var(--cor-primaria, #4f8cff);
    color: #fff;
}

.nexo-cam__opcao-icone svg {
    width: 24px;
    height: 24px;
}

.nexo-cam__opcao-texto {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.nexo-cam__opcao-texto strong {
    font-size: 0.98rem;
    font-weight: 650;
}

.nexo-cam__opcao-texto small {
    font-size: 0.8rem;
    color: var(--cor-texto-secundario, #a8b3c4);
}

.nexo-cam__cancelar {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--cor-texto-secundario, #a8b3c4);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.nexo-cam__cancelar:hover {
    background: var(--cor-superficie-suave, #141922);
}

@media (min-width: 640px) {
    dialog.nexo-cam--escolha {
        width: 400px;
        margin: auto;
        animation: nexo-cam-pop 0.18s ease-out;
    }

    .nexo-cam__folha {
        border-bottom: 1px solid var(--cor-borda, #2b3544);
        border-radius: 22px;
        padding-bottom: 18px;
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    }

    .nexo-cam__alca {
        display: none;
    }
}

/* ------------------------------------------------------------------ câmera */

dialog.nexo-cam--camera {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    animation: nexo-cam-fade 0.18s ease-out;
}

.nexo-cam__palco {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0d12;
    color: #fff;
    user-select: none;
}

@media (min-width: 900px) {
    dialog.nexo-cam--camera {
        width: min(960px, 94vw);
        height: min(720px, 92dvh);
        margin: auto;
    }

    .nexo-cam__palco {
        border-radius: 22px;
        box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
    }
}

.nexo-cam__video,
.nexo-cam__revisao-midia {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.nexo-cam__video {
    object-fit: contain;
    background: #0a0d12;
}

.nexo-cam__video--espelho {
    transform: scaleX(-1);
}

.nexo-cam__revisao-midia {
    display: grid;
    place-items: center;
    background: #0a0d12;
    z-index: 2;
}

.nexo-cam__revisao-midia img,
.nexo-cam__revisao-midia video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.nexo-cam__flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}

.nexo-cam__flash--on {
    animation: nexo-cam-flash 0.28s ease-out;
}

/* topo */

.nexo-cam__topo {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 28px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}

.nexo-cam__btn-vidro {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.nexo-cam__btn-vidro:hover {
    background: rgba(255, 255, 255, 0.26);
}

.nexo-cam__btn-vidro:active {
    transform: scale(0.92);
}

.nexo-cam__btn-vidro:disabled {
    opacity: 0.4;
    pointer-events: none;
}

.nexo-cam__btn-vidro svg {
    width: 22px;
    height: 22px;
}

.nexo-cam__rec {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    font-variant-numeric: tabular-nums;
    font-size: 0.92rem;
    font-weight: 600;
}

.nexo-cam__rec i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ff4d5e;
    animation: nexo-cam-pisca 1s ease-in-out infinite;
}

/* base */

.nexo-cam__base {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 36px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.62), transparent);
}

.nexo-cam__modos {
    display: inline-flex;
    padding: 4px;
    gap: 2px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(10px);
    transition: opacity 0.15s;
}

.nexo-cam__modos.bloqueado {
    opacity: 0.4;
    pointer-events: none;
}

.nexo-cam__modo {
    padding: 7px 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.nexo-cam__modo.ativo {
    background: rgba(255, 255, 255, 0.95);
    color: #0a0d12;
}

.nexo-cam__controles {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: min(100%, 420px);
}

.nexo-cam__slot {
    display: flex;
    align-items: center;
}

.nexo-cam__slot--dir {
    justify-content: flex-end;
}

.nexo-cam__disparo {
    position: relative;
    display: grid;
    place-items: center;
    width: 78px;
    height: 78px;
    padding: 0;
    border: 4px solid #fff;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: transform 0.1s;
}

.nexo-cam__disparo:active {
    transform: scale(0.94);
}

.nexo-cam__disparo:focus-visible {
    outline: 2px solid var(--cor-primaria, #4f8cff);
    outline-offset: 4px;
}

.nexo-cam__disparo i {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    transition: background 0.15s, border-radius 0.15s, width 0.15s, height 0.15s;
}

.nexo-cam__disparo--video i {
    background: #ff4d5e;
}

.nexo-cam__disparo.gravando i {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.nexo-cam__concluir {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--cor-primaria, #4f8cff);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.nexo-cam__concluir svg {
    width: 18px;
    height: 18px;
}

.nexo-cam__concluir:hover {
    background: var(--cor-primaria-hover, #6aa0ff);
}

/* miniaturas (campos com vários arquivos) */

.nexo-cam__faixa {
    display: flex;
    gap: 8px;
    width: min(100%, 520px);
    padding: 2px 2px 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nexo-cam__faixa::-webkit-scrollbar {
    display: none;
}

.nexo-cam__mini {
    position: relative;
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: #1b222d;
}

.nexo-cam__mini img,
.nexo-cam__mini video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.nexo-cam__mini-play {
    position: absolute;
    left: 4px;
    bottom: 4px;
    width: 16px;
    height: 16px;
    color: #fff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.nexo-cam__mini-rm {
    position: absolute;
    top: 2px;
    right: 2px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    cursor: pointer;
}

.nexo-cam__mini-rm svg {
    width: 11px;
    height: 11px;
}

/* barra de revisão (campo de arquivo único) */

.nexo-cam__barra-revisao {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 7;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 40px 16px calc(22px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}

.nexo-cam__acao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 132px;
    padding: 13px 22px;
    border: 0;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.nexo-cam__acao:active {
    transform: scale(0.97);
}

.nexo-cam__acao svg {
    width: 20px;
    height: 20px;
}

.nexo-cam__acao--primaria {
    background: var(--cor-primaria, #4f8cff);
    color: #fff;
}

.nexo-cam__acao--primaria:hover {
    background: var(--cor-primaria-hover, #6aa0ff);
}

.nexo-cam__acao--suave {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    backdrop-filter: blur(10px);
}

.nexo-cam__acao--suave:hover {
    background: rgba(255, 255, 255, 0.26);
}

.nexo-cam__topo--revisao {
    z-index: 8;
}

/* estados: carregando / erro */

.nexo-cam__estado {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.92rem;
    pointer-events: none;
}

.nexo-cam__spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: #fff;
    animation: nexo-cam-gira 0.8s linear infinite;
}

.nexo-cam__erro {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    text-align: center;
    background: #0a0d12;
}

.nexo-cam__erro-icone {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

.nexo-cam__erro-icone svg {
    width: 30px;
    height: 30px;
}

.nexo-cam__erro p {
    margin: 0;
    max-width: 320px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.95rem;
    line-height: 1.45;
}

.nexo-cam__erro-acoes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

/* animações */

@keyframes nexo-cam-sobe {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes nexo-cam-pop {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes nexo-cam-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes nexo-cam-flash {
    0% { opacity: 0.85; }
    100% { opacity: 0; }
}

@keyframes nexo-cam-pisca {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

@keyframes nexo-cam-gira {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    dialog.nexo-cam,
    .nexo-cam__flash--on,
    .nexo-cam__rec i,
    .nexo-cam__spinner {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
    }
}
