/* css/header.css - Estilos específicos do header */

/* ===== AVATAR E DROPDOWN DO USUÁRIO ===== */
.user-avatar-container {
    position: relative;
    cursor: pointer;
}

.user-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #f5a623;
    transition: all 0.3s ease;
}

.user-avatar-img:hover {
    transform: scale(1.05);
    border-color: #e5941f;
}

.user-dropdown-menu {
    position: absolute;
    top: 60px;
    right: 0;
    width: 280px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    top: 55px;
}

.dropdown-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f0e8e2;
}

.dropdown-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-header div {
    flex: 1;
    min-width: 0; /* nome ou e-mail longo não estoura o menu */
}

.dropdown-header strong {
    display: block;
    color: #1f1f1f;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-header small {
    display: block;
    color: #8b7a6b;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-divider {
    height: 1px;
    background: #f0e8e2;
    margin: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #4a4a4a;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: #fef5e8;
    color: #f5a623;
}

.dropdown-item i {
    width: 20px;
    font-size: 16px;
}

/* ===== MENU MOBILE ===== */
.mobile-toggle-btn {
    display: none;
    background: transparent; /* só contorno: o laranja fica para o Cadastre-se */
    border: 1.5px solid #374151;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    color: #1f2328;
    font-size: 18px;
    align-items: center;
    justify-content: center;
}

.mobile-menu-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 9999;
    transition: right 0.3s ease;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto; /* menu maior que a tela (celular deitado ou pequeno): rola por dentro */
    overscroll-behavior: contain;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

.mobile-menu-panel.open {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.mobile-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #f5a623;
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mobile-menu-links a {
    padding: 10px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-menu-links a:hover {
    background: #fef5e8;
    color: #f5a623;
}

.mobile-auth-btn {
    width: 100%;
    background: #f5a623;
    border: none;
    padding: 12px;
    border-radius: 50px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    display: none;
}

.mobile-overlay.active {
    display: block;
}

/* ===== PASSWORD STRENGTH ===== */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 45px;
}

.toggle-password-login,
.toggle-password-register {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    z-index: 10;
}

.toggle-password-login:hover,
.toggle-password-register:hover {
    color: #f5a623;
}

.password-strength {
    margin-top: 8px;
}

.strength-text {
    font-size: 12px;
    color: #666;
}

.strength-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

.strength-level {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
}

.strength-level.weak { width: 25%; background: #dc2626; }
.strength-level.medium { width: 50%; background: #f59e0b; }
.strength-level.strong { width: 75%; background: #10b981; }
.strength-level.very-strong { width: 100%; background: #059669; }

.password-hint {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

/* ===== MENSAGENS DO MODAL ===== */
.auth-message {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    animation: fadeInMessage 0.3s ease;
}

.auth-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

.auth-message.error {
    background-color: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.auth-message.warning {
    background-color: #fff3e0;
    color: #ef6c00;
    border-left: 4px solid #f57c00;
}

.auth-message.info {
    background-color: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #1565c0;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== RECAPTCHA ===== */
.g-recaptcha {
    margin: 15px 0;
    transition: all 0.3s ease;
}

.g-recaptcha.error-highlight {
    filter: drop-shadow(0 0 5px rgba(198, 40, 40, 0.5));
}

.g-recaptcha {
    transform: scale(0.85);
    transform-origin: 0 0;
    margin-bottom: 10px;
}

/* ===== CAMPO DE CÓDIGO ===== */
#registerCodigo {
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
    font-weight: 600;
}

#registerCodigo:focus {
    border-color: #f5a623;
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.1);
}

.btn-verificar-codigo {
    transition: all 0.3s ease;
}

.btn-verificar-codigo:hover {
    background: #e5941f !important;
    transform: scale(1.02);
}

input:disabled {
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.codigo-hint {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== SPINNER ===== */
.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin-right: 5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 991px) {
    .mobile-toggle-btn {
        display: flex;
    }
    /* Sem os links do topo: sino, foto e menu ficam juntos à direita (tablet e celular deitado) */
    .navbar .btn-group-pill {
        margin-left: auto;
        margin-right: 12px;
    }
}

/* ===== DROPDOWN MOBILE - CENTRALIZADO ===== */
@media (max-width: 768px) {
    .user-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: 280px;
        margin-top: 10px;
    }
    
    .user-dropdown-menu.show {
        top: 70px;
        bottom: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    
    /* Seta do dropdown no mobile */
    .user-dropdown-menu::before {
        content: '';
        position: absolute;
        top: -8px;
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 0;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-bottom: 8px solid white;
        z-index: 1;
    }
}

@media (max-width: 576px) {
    .g-recaptcha {
        transform: scale(0.77);
    }
}

@media (max-width: 480px) {
    .user-dropdown-menu {
        width: 260px;
    }
    
    .user-dropdown-menu.show {
        top: 65px;
    }
}
/* Fundação (Etapa 0): logo do menu mobile e botões que agora são links */
.mobile-logo { max-height: 35px; width: auto; }
a.btn-main, a.mobile-auth-btn { color: #212529; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
a.btn-main:hover, a.btn-main:focus, a.mobile-auth-btn:hover, a.mobile-auth-btn:focus { color: #212529; }

/* Etapa 1: botão "Sair" no menu mobile (é um formulário POST) */
.mobile-sair {
    width: 100%; padding: 10px; color: #333; background: none; border: none; border-radius: 8px;
    display: flex; align-items: center; gap: 10px; font: inherit; text-align: left;
}
.mobile-sair:hover { background: #fff4e0; }

/* Marca do menu: altura em .navbar .marca (ver ui.css) */
@media (max-width: 767px) {
    .navbar > .container { flex-wrap: nowrap; gap: 8px; }
    .navbar .mobile-toggle-btn, .navbar .btn-group-pill { flex-shrink: 0; }
    .navbar > .container > a { flex-shrink: 0; }
}

/* Visitante: Cadastre-se (laranja) e Entrar (só contorno; no celular, só o ícone) */
.btn-entrar {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
    margin-left: 10px; border: 1.5px solid #374151; border-radius: 999px; background: transparent; color: #1f2328;
    font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background 0.2s ease;
}
.btn-entrar:hover, .mobile-toggle-btn:hover { background: rgba(31, 35, 40, 0.06); }
.btn-entrar i { font-size: 16px; }
.mobile-auth-btn.mobile-auth-entrar { margin-top: 10px; background: transparent; border: 1.5px solid #374151; color: #1f2328; }
@media (max-width: 767px) {
    /* Celular: só a margem de 16px do container, para caber logo, Cadastre-se, Entrar e menu */
    .navbar { padding-left: 0; padding-right: 0; }
    .navbar .btn-group-pill { margin-right: 6px; }
    .btn-entrar, .mobile-toggle-btn { width: 40px; height: 40px; }
    .btn-entrar { padding: 0; border-radius: 50%; margin-left: 6px; }
    .btn-entrar-texto { display: none; }
    .navbar .btn-group-pill .btn-main { padding: 8px 14px; font-size: 13.5px; }
    .navbar .btn-group-pill .btn-main i { margin-right: 6px; }
}
@media (max-width: 389px) {
    .navbar .btn-group-pill .btn-main { padding: 8px 12px; }
    .navbar .btn-group-pill .btn-main i { display: none; } /* telas bem estreitas: o texto basta */
}

/* Sino de notificações */
.btn-group-pill .sino {
    position: relative; width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    color: #374151; font-size: 1.15rem; text-decoration: none; margin-right: 6px; transition: background 0.2s ease;
}
.btn-group-pill .sino:hover { background: rgba(245, 166, 35, 0.12); color: #1f2328; }
.sino-contador {
    position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: #dc2626; color: #fff; font-size: 0.68rem; font-weight: 800; line-height: 18px; text-align: center;
    border: 2px solid #fdf7f2;
}
.btn-group-pill { display: flex; align-items: center; }
@media (max-width: 389px) { .btn-group-pill .sino { width: 38px; margin-right: 8px; } } /* espaço para o toque não cair na foto */

/* Seção "Anfitrião" nos menus (só para anfitrião aprovado) e contador de pedidos aguardando resposta */
.menu-secao { display: flex; align-items: center; gap: 10px; margin: 8px 16px 2px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #b06f0a; }
.menu-secao::after { content: ''; flex: 1; height: 1px; background: #f0e8e2; }
.mobile-menu-links .menu-secao { margin: 4px 10px 0; }
.menu-contador { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #f5a623; color: #1c1f24; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
@media (min-width: 769px) { .user-dropdown-menu { max-height: calc(100vh - 80px); overflow-y: auto; overscroll-behavior: contain; } }

/* Celular: o menu da conta cabe na tela e rola por dentro, sem levar a página junto (muitos itens: anfitrião, parceiro, admin).
   A seta sai porque a rolagem a cortaria (e ela apontava para o centro, não para a foto). */
@media (max-width: 768px) {
    .user-dropdown-menu { max-height: calc(100vh - 85px); max-height: calc(100dvh - 85px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    .user-dropdown-menu::before { display: none; }
}
/* Menu da conta aberto no celular: a página por trás não rola (classe colocada e retirada pelo app.js) */
@media (max-width: 768px) { html.menu-conta-aberto, html.menu-conta-aberto body { overflow: hidden; } }

/* Cadastro incompleto: "!" na foto do cabeçalho e atalho no topo do menu da conta */
.user-avatar-alerta { position: absolute; top: -3px; right: -3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: #dc2626; color: #fff; font-size: 11px; border: 2px solid #fdf7f2; pointer-events: none; }
.menu-concluir { display: flex; align-items: center; gap: 10px; margin: 8px 12px; padding: 10px 12px; border-radius: 12px; background: #fff4e0; border: 1px solid #f5d9a4; color: #6b4a0a; text-decoration: none; }
.menu-concluir:hover { background: #ffecc9; color: #6b4a0a; }
.menu-concluir > i:first-child { color: #e08a00; }
.menu-concluir > i:last-child { font-size: 0.75rem; color: #b06f0a; }
.menu-concluir span { flex: 1; min-width: 0; display: grid; gap: 1px; }
.menu-concluir strong { font-size: 0.9rem; color: #2a2219; }
.menu-concluir small { font-size: 0.76rem; line-height: 1.35; }
