/* ===========================
   VULON APP — MAIN STYLES
   =========================== */

/* CSS Variables */
:root {
    --primary:      #4a0e6e;
    --primary-1:    #5a1a7e;
    --primary-2:    #6d2a94;
    --primary-3:    #7f3aaa;
    --primary-4:    #9150c0;
    --primary-5:    #a366d6;
    --primary-6:    #b87de0;
    --white:        #ffffff;
    --light-bg:     #f5f5f5;
    --nav-icon-bg:  #e8d5f2;
    --nav-icon-border: #d4b5e8;
    --text-muted:   rgba(255, 255, 255, 0.7);
    --border-soft:  rgba(255, 255, 255, 0.2);
}

/* ===========================
   RESET
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===========================
   BASE
   =========================== */
/* Fundo roxo no <html>: com a WebView edge-to-edge (StatusBar
   overlay:true), qualquer area que o conteudo nao cobrir — overscroll
   /bounce do WKWebView, faixa da status bar, area do home indicator —
   mostra a cor do documento. Sem isso o iOS pinta de branco. Vale
   pra TODAS as telas (todas carregam app.css). */
html {
    background-color: var(--primary);
}

body {
    background-color: var(--primary);
    color: var(--white);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
}

/* App-shell (apenas paginas com header+bottom fixos, ex: home).
   Escopado por classe pra NAO afetar telas internas (screens.css)
   que usam scroll de documento. position:fixed no body e a tecnica
   canonica que trava o scroll-bounce do WKWebView no iOS — height
   /overflow no container sozinho nao segura o bounce. */
body.app-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    overflow: hidden;
}

/* ===========================
   APP CONTAINER
   =========================== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    /* Preenche exatamente o body fixed (= viewport abaixo da status
       bar, ja que StatusBar overlay:false). TODO o conteudo (header +
       menu-container) rola junto — em telas pequenas (iPhone SE etc) o
       header sozinho consumia ~314px e empurrava menu pra fora do
       viewport, sem scroll. Bottom-nav fica fixo por position:fixed. */
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--primary);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ===========================
   SETTINGS ICON
   =========================== */
.settings-icon {
    position: absolute;
    top: calc(25px + var(--sat, env(safe-area-inset-top, 0px)));
    right: 25px;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 10;
}

/* ===========================
   HEADER
   =========================== */
.header {
    /* Fixo no topo do app-shell (nao rola). safe-area-inset-top evita
       ficar atras do status bar / notch / Dynamic Island. */
    flex-shrink: 0;
    padding: calc(40px + var(--sat, env(safe-area-inset-top, 0px))) 25px 30px;
}

.header-logo {
    margin-bottom: 22px;
}

.header-logo-img {
    width: 110px;
    display: block;
    mix-blend-mode: screen;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.profile-circle {
    width: 90px;
    height: 90px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    flex-shrink: 0;
    background-color: var(--primary-1);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.profile-info { flex: 1; }

.welcome-text {
    font-size: 0.95rem;
    margin-bottom: 2px;
    opacity: 0.9;
    font-weight: 400;
}

.user-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.user-id {
    font-size: 0.8rem;
    opacity: 0.7;
    font-weight: 400;
}

/* ===========================
   ACCOUNT INFO
   =========================== */
.account-info {
    display: flex;
    gap: 35px;
    margin-bottom: 25px;
}

.info-item { display: flex; flex-direction: column; }

.info-label {
    font-size: 0.8rem;
    opacity: 0.75;
    margin-bottom: 4px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.info-value {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ===========================
   BALANCE
   =========================== */
.balance-section { margin-top: 15px; }

.balance-label {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    opacity: 0.85;
    font-weight: 500;
    cursor: pointer;
}

.balance-label i { font-size: 0.9rem; }

.balance-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ===========================
   MENU
   =========================== */
.menu-container {
    /* Antes era o unico que rolava. Agora o scroll subiu pro
       .app-container (header rola junto). Mantemos flex column +
       padding-bottom pro bottom-nav fixo + home indicator. */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 0 calc(96px + var(--sab, env(safe-area-inset-bottom, 0px)));
    margin-top: 10px;
}

.menu-item {
    padding: 22px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.15s ease;
    font-size: 1.1rem;
    font-weight: 500;
    border: none;
    background: none;
    color: var(--white);
    text-align: left;
    width: 100%;
    border-radius: 20px 20px 0 0;
    margin: 0;
    margin-top: -12px;
    position: relative;
    z-index: 1;
}

.menu-item:first-child { margin-top: 0; }
.menu-item:active { opacity: 0.85; }
.menu-item i { font-size: 1.4rem; opacity: 0.9; }
/* Garante aspecto de "barra" (nao link) quando o item eh <a> — vence
 * o reset do Bootstrap que sublinha <a> e pinta de azul. !important
 * porque Bootstrap CSS carrega depois de algumas regras vulon. */
a.menu-item,
a.menu-item:hover,
a.menu-item:focus,
a.menu-item:visited,
a.menu-item:active {
  text-decoration: none !important;
  color: var(--white) !important;
}

.item-1 { background-color: var(--primary-1); border-radius: 20px 20px 0 0; }
.item-2 { background-color: var(--primary-2); border-radius: 20px 20px 0 0; }
.item-3 { background-color: var(--primary-3); border-radius: 20px 20px 0 0; }
.item-4 { background-color: var(--primary-4); border-radius: 20px 20px 0 0; }
.item-5 { background-color: var(--primary-5); border-radius: 20px 20px 0 0; }
.item-6 { background-color: var(--primary-3); border-radius: 20px 20px 0 0; }
.item-7 { background-color: var(--primary-2); border-radius: 20px 20px 0 0; }

/* ===========================
   BOTTOM NAV
   =========================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background-color: var(--light-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    /* safe-area-inset-bottom: nao colar no home indicator do iPhone */
    padding: 12px 0 calc(12px + var(--sab, env(safe-area-inset-bottom, 0px)));
    border-radius: 25px 25px 0 0;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.7rem;
    gap: 6px;
    flex: 1;
    transition: all 0.2s ease;
}

.nav-icon-box {
    width: 50px;
    height: 50px;
    background-color: var(--nav-icon-bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--nav-icon-border);
    transition: all 0.2s ease;
}

.nav-item i { font-size: 1.5rem; color: var(--primary); }
.nav-item.active .nav-icon-box {
    background-color: var(--primary);
    border-color: var(--primary);
}
.nav-item.active i { color: var(--white); }
.nav-item.active { color: var(--primary); }

/* Label inativo cinza-azulado pra ser legivel; ativo herda o roxo do
   .nav-item.active acima. */
.nav-label { font-weight: 500; font-size: 0.75rem; color: #6b6b8a; }
.nav-item.active .nav-label { color: var(--primary); }

/* ===========================
   VULON STATUS BADGE
   =========================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.status-start  { background-color: #27ae60; color: #fff; }
.status-plus   { background-color: #2980b9; color: #fff; }
.status-prime  { background-color: #8e44ad; color: #fff; }
.status-black  { background-color: #1a1a2e; color: #fff; border: 1px solid #555; }

/* ===========================
   SHARED BUTTONS
   =========================== */
.btn-vulon-primary {
    background-color: var(--white);
    color: var(--primary);
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    display: block;
    text-align: center;
    text-decoration: none;
}

.btn-vulon-primary:hover {
    background-color: #f0e8f8;
    transform: translateY(-1px);
    color: var(--primary);
    text-decoration: none;
}

.btn-vulon-primary:active { transform: translateY(0); }

.btn-vulon-outline {
    background-color: transparent;
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 14px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    display: block;
    text-align: center;
    text-decoration: none;
}

.btn-vulon-outline:hover {
    border-color: var(--white);
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    text-decoration: none;
}

/* ===========================
   SHARED FORM ELEMENTS
   =========================== */
.vulon-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: var(--white);
    padding: 14px 16px;
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s ease, background 0.2s ease;
    font-family: inherit;
}

.vulon-input::placeholder { color: rgba(255, 255, 255, 0.4); }

.vulon-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
}

.vulon-input.is-invalid { border-color: #e74c3c; }

.vulon-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: var(--white);
    padding: 14px 16px;
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s ease;
    font-family: inherit;
    appearance: none;
    cursor: pointer;
}

.vulon-select option { background-color: var(--primary-2); color: var(--white); }

.vulon-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
}

.form-label-vulon {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 6px;
    display: block;
    letter-spacing: 0.2px;
}

.field-error {
    font-size: 0.78rem;
    color: #ff6b6b;
    margin-top: 5px;
    display: none;
}

.field-error.show { display: block; }

/* ===========================
   SHARED ALERTS
   =========================== */
.vulon-alert {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vulon-alert-success {
    background-color: rgba(39, 174, 96, 0.2);
    border: 1px solid rgba(39, 174, 96, 0.4);
    color: #a8f5c2;
}

.vulon-alert-error {
    background-color: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.4);
    color: #ffaaaa;
}

.vulon-alert-warning {
    background-color: rgba(241, 196, 15, 0.2);
    border: 1px solid rgba(241, 196, 15, 0.4);
    color: #ffe08a;
}

/* ===========================
   CARDS
   =========================== */
.vulon-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-soft);
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 480px) {
    .app-container { max-width: 100%; }
    .bottom-nav { max-width: 100%; }
    /* mantem safe-area: a home nao tem contentInset nativo (body
       position:fixed), entao o padding precisa empurrar abaixo do
       notch. base 35px (telas pequenas) + safe-area. */
    .header { padding: calc(35px + var(--sat, env(safe-area-inset-top, 0px))) 20px 25px; }
    .menu-item { padding: 20px 20px; }
}
