/* ============================================================
   layout.css – Estrutura principal, overlay, painéis
   ============================================================ */

/* A-Frame e MindAR gerenciam o canvas/vídeo da câmera internamente.
   NÃO sobrescrever a-scene para que o rastreamento funcione corretamente. */

/* ---------- Zona de Toque 2D (troca de aba ao tocar no cartão) ----------
   Cobre a metade esquerda da tela onde o cartão físico aparece na câmera.
   É invisível (pointer-events: all, background: transparent) mas aceita
   cliques/toques nativos do browser — muito mais confiável que A-Frame raycaster.
   z-index menor que o painel 2D (right side) para não bloquear os botões.
   ----------------------------------------------------------------- */
#card-tap-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 52%;
    height: 100%;
    z-index: 6;
    pointer-events: none;
    /* desabilitado até cartão ser detectado */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

#card-tap-zone.active {
    pointer-events: all;
    /* habilitado quando cartão detectado */
}

/* Ripple de feedback ao toque */
.tap-ripple {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.35);
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.tap-ripple.animating {
    animation: tap-ripple-anim 0.45s ease-out forwards;
}

@keyframes tap-ripple-anim {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }

    100% {
        transform: scale(3.5);
        opacity: 0;
    }
}

/* Hint label (aparece quando cartão detectado) */
.tap-hint {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.75);
    color: #94A3B8;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 400ms ease;
    pointer-events: none;
}

#card-tap-zone.active .tap-hint {
    opacity: 1;
}


/* ---------- Overlay Principal ---------- */
#ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
}

/* ---------- Header do Overlay ---------- */
#overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 480px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.app-brand__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary), #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
}

.app-brand__name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.app-brand__name span {
    color: var(--color-primary);
}

/* ---------- Botão de Configurações (pointer-events ativo) ---------- */
#btn-settings {
    pointer-events: all;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

#btn-settings:hover {
    background: var(--color-surface-light);
    color: var(--color-text-primary);
    border-color: var(--color-primary);
}

/* ---------- Instrução Central ---------- */
#overlay-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    text-align: center;
    transition: opacity var(--transition-slow);
}

#overlay-hint.hidden {
    opacity: 0;
}

.hint-frame {
    width: 220px;
    height: 140px;
    border: 2px dashed rgba(59, 130, 246, 0.5);
    border-radius: var(--radius-xl);
    position: relative;
    animation: pulse-border 2s ease-in-out infinite;
}

.hint-frame::before,
.hint-frame::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--color-primary);
    border-style: solid;
}

.hint-frame::before {
    top: -2px;
    left: -2px;
    border-width: 3px 0 0 3px;
    border-radius: var(--radius-sm) 0 0 0;
}

.hint-frame::after {
    bottom: -2px;
    right: -2px;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 var(--radius-sm) 0;
}

.hint-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    max-width: 200px;
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: rgba(59, 130, 246, 0.4);
    }

    50% {
        border-color: rgba(59, 130, 246, 0.9);
    }
}

/* ---------- Footer do Overlay ---------- */
#overlay-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    max-width: 360px;
}

/* ---------- Status Badge ---------- */
#status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    backdrop-filter: blur(12px);
    color: var(--color-text-secondary);
    text-shadow: none;
    transition: all var(--transition-base);
}

#status-badge.status--connected {
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
}

#status-badge.status--loading {
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--color-warning);
    background: rgba(245, 158, 11, 0.1);
}

#status-badge.status--error {
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.1);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: currentColor;
}

.status-dot.pulse {
    animation: dot-pulse 1.5s ease-in-out infinite;
}

@keyframes dot-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.8);
    }
}

/* ---------- Botão de Login (pointer-events ativo) ---------- */
#btn-login {
    pointer-events: all;
    width: 100%;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--color-primary), #6366F1);
    color: white;
    font-size: var(--font-size-base);
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-md), var(--shadow-glow-blue);
    transition: all var(--transition-base);
}

#btn-login:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(59, 130, 246, 0.5);
}

#btn-login:active {
    transform: translateY(0);
}

#btn-login.hidden {
    display: none;
}