/* ============ Identidade visual: navy profundo, dourado e vinho ============ */
:root {
    --bg: #0a1430;
    --bg-elevated: #101f45;
    --bg-input: #162853;
    --border: #24356b;
    --gold: #c9a45c;
    --gold-bright: #e8cf96;
    --gold-dark: #9a7a3c;
    --text: #f3ead6;
    --text-muted: #9aa6c8;
    --wine: #5c1832;
    --wine-deep: #3f1024;
    --error: #f0938f;

    --font-display: "Cinzel", Georgia, "Times New Roman", serif;
    --font-body: "EB Garamond", Georgia, "Times New Roman", serif;
}

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

html, body {
    height: 100%;
}

body {
    background: radial-gradient(ellipse at top, #12224c 0%, var(--bg) 55%, #060d20 100%);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17px;
}

/* ============ Cards centralizados (Login / Setup) ============ */
.center-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.card {
    background: linear-gradient(160deg, var(--bg-elevated), #0c1938);
    border: 1px solid var(--gold);
    outline: 1px solid rgba(201, 164, 92, 0.25);
    outline-offset: 4px;
    border-radius: 14px;
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

/* Selo circular: cruz dourada no centro e uma letra em cada quadrante (D W / A I) */
.brand-badge {
    position: relative;
    width: 116px;
    height: 116px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    border: 2px solid var(--gold);
    outline: 1px solid rgba(201, 164, 92, 0.4);
    outline-offset: 3px;
    background: radial-gradient(circle at 35% 30%, #1a2c5c, #0a142e);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    font-family: var(--font-display);
    overflow: hidden;
}

/* Braços da cruz */
.brand-badge::before,
.brand-badge::after {
    content: "";
    position: absolute;
    background: var(--gold);
}

.brand-badge::before {
    /* braço vertical */
    top: 16%;
    bottom: 16%;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
}

.brand-badge::after {
    /* braço horizontal */
    left: 16%;
    right: 16%;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
}

.brand-badge-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}

/* Letras de cima em creme; de baixo em dourado */
.brand-badge-letter.tl,
.brand-badge-letter.tr {
    color: var(--text);
}

.brand-badge-letter.bl,
.brand-badge-letter.br {
    color: var(--gold-bright);
}

/* Aproxima cada letra do centro do selo (horizontal e vertical) */
.brand-badge-letter.tl { transform: translate( 22%,  22%); }
.brand-badge-letter.tr { transform: translate(-22%,  22%); }
.brand-badge-letter.bl { transform: translate( 22%, -22%); }
.brand-badge-letter.br { transform: translate(-22%, -22%); }

.card-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-align: center;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.title-accent {
    color: var(--gold-bright);
}

.card-tagline {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.card-tagline em {
    color: var(--gold);
    font-style: normal;
}

.card-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(201, 164, 92, 0.3);
}

/* ============ Formulários ============ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group > label {
    display: block;
    margin-bottom: 0.4rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1.05rem;
    font-family: var(--font-body);
}

.form-group input:focus {
    outline: 1px solid var(--gold);
    border-color: var(--gold);
}

.field-error, .validation-summary {
    color: var(--error);
    font-size: 0.9rem;
}

.validation-summary {
    margin-bottom: 0.75rem;
}

.form-success {
    color: var(--gold-bright);
    background: rgba(201, 164, 92, 0.12);
    border: 1px solid var(--gold-dark);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    text-align: center;
}

.auth-forgot {
    margin-top: 0.4rem;
    text-align: right;
    font-size: 0.9rem;
}

.auth-forgot a {
    color: var(--gold-bright);
    font-weight: 600;
    text-decoration: none;
}

.auth-forgot a:hover {
    text-decoration: underline;
}

.validation-summary ul {
    list-style: none;
}

/* ============ Botões ============ */
.btn {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    padding: 0.7rem 1rem;
    font-family: var(--font-display);
    letter-spacing: 0.06em;
}

.btn-primary {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, var(--gold-dark));
    color: #1d1428;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.95rem;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-block {
    width: 100%;
}

.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(201, 164, 92, 0.3);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-switch a {
    color: var(--gold-bright);
    font-weight: 600;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--gold-dark);
    color: var(--gold);
    font-size: 0.8rem;
    padding: 0.4rem 0.9rem;
}

.btn-secondary:hover {
    color: var(--gold-bright);
    border-color: var(--gold);
    background: rgba(201, 164, 92, 0.08);
}

.btn-link {
    background: none;
    color: var(--text-muted);
    text-decoration: underline;
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.logout-link {
    text-align: center;
    margin-top: 1rem;
}

/* ============ Setup: opções de modo ============ */
.mode-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.mode-option {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem;
    cursor: pointer;
}

.mode-option:hover {
    border-color: var(--gold);
}

.mode-option input {
    margin-top: 0.3rem;
    accent-color: var(--gold);
}

.mode-option strong {
    font-family: var(--font-display);
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: var(--gold-bright);
}

.mode-option small {
    display: block;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.92rem;
}

.mode-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 0.6rem;
}

/* ============ Planos (cadastro) ============ */
.plan-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.plan-option {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem;
    cursor: pointer;
}

.plan-option:hover {
    border-color: var(--gold);
}

.plan-option input {
    margin-top: 0.3rem;
    accent-color: var(--gold);
}

.plan-info {
    flex: 1;
}

.plan-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.plan-head strong {
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.04em;
    color: var(--gold-bright);
}

.plan-price {
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

.plan-option small {
    display: block;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.88rem;
}

/* ============ Chat ============ */
.chat-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.25rem;
    background: linear-gradient(180deg, #101f45, #0b1735);
    border-bottom: 1px solid var(--gold-dark);
    flex-wrap: wrap;
}

.chat-header-left, .chat-header-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.chat-brand {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--text);
}

.chat-user {
    font-weight: 600;
    color: var(--text);
    font-size: 1.05rem;
    padding-left: 0.85rem;
    border-left: 1px solid rgba(201, 164, 92, 0.35);
}

.chat-mode {
    background: var(--wine);
    border: 1px solid var(--gold-dark);
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* ============ Barra de uso de tokens ============ */
.token-meter {
    background: linear-gradient(180deg, #0e1c40, #0b1735);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.25rem 0.6rem;
    cursor: pointer;
    user-select: none;
}

.token-meter:hover {
    background: linear-gradient(180deg, #12234c, #0d1a3d);
}

.token-meter-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
}

.token-meter-caption {
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
}

.token-meter-numbers {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.token-meter-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.token-meter-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
    transition: width 0.4s ease;
}

.token-meter-fill.monthly {
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
}

/* Perto/ao ultrapassar o limite diário, fica avermelhado */
.token-meter.is-full .token-meter-fill {
    background: linear-gradient(90deg, #b3402f, var(--error));
}

.token-meter-monthly {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(201, 164, 92, 0.25);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-empty {
    margin: auto;
    text-align: center;
    color: var(--text-muted);
    line-height: 1.9;
    font-size: 1.15rem;
}

.chat-empty strong {
    color: var(--gold-bright);
}

.message {
    display: flex;
    gap: 0.8rem;
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    padding: 0.95rem 1.1rem;
    border-radius: 12px;
}

.message-user {
    background: linear-gradient(160deg, var(--wine), var(--wine-deep));
    border: 1px solid rgba(201, 164, 92, 0.25);
}

.message-assistant {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
}

.message-avatar {
    flex-shrink: 0;
    font-size: 1.3rem;
}

.message-content {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.6;
    font-size: 1.05rem;
}

.chat-error {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    color: var(--error);
    background: rgba(240, 147, 143, 0.08);
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

/* ============ Área de entrada ============ */
.chat-input-area {
    padding: 1rem;
    background: linear-gradient(0deg, #060d20, rgba(6, 13, 32, 0.6));
    border-top: 1px solid var(--gold-dark);
}

.chat-form {
    display: flex;
    gap: 0.6rem;
    max-width: 820px;
    margin: 0 auto;
}

.chat-form textarea {
    flex: 1;
    resize: none;
    padding: 0.8rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 1.05rem;
    font-family: var(--font-body);
    max-height: 10rem;
}

.chat-form textarea:focus {
    outline: 1px solid var(--gold);
    border-color: var(--gold);
}

.btn-send {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, var(--gold-dark));
    color: #1d1428;
    font-size: 1.1rem;
    padding: 0 1.15rem;
    border-radius: 10px;
}

.btn-send:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-send:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ============ Aviso de sucesso ============ */
.chat-notice {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    color: #9fe0a6;
    background: rgba(120, 200, 130, 0.1);
    border: 1px solid #4f8a58;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

/* ============ Avatar + menu do usuário ============ */
.user-menu {
    position: relative;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--gold);
    background: radial-gradient(circle at 35% 30%, var(--wine), var(--wine-deep));
    color: var(--gold-bright);
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar:hover {
    border-color: var(--gold-bright);
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    min-width: 190px;
    background: var(--bg-elevated);
    border: 1px solid var(--gold-dark);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    padding: 0.4rem;
    z-index: 20;
}

.user-dropdown-name {
    padding: 0.5rem 0.7rem;
    color: var(--gold-bright);
    font-weight: 600;
    border-bottom: 1px solid rgba(201, 164, 92, 0.25);
    margin-bottom: 0.3rem;
}

.user-dropdown a,
.user-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: rgba(201, 164, 92, 0.12);
    color: var(--gold-bright);
}

/* ============ Páginas internas (Planos / Conta) ============ */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.25rem;
    background: linear-gradient(180deg, #101f45, #0b1735);
    border-bottom: 1px solid var(--gold-dark);
}

.page-back {
    color: var(--gold);
    text-decoration: none;
    font-size: 0.95rem;
}

.page-back:hover {
    color: var(--gold-bright);
}

.page-body {
    flex: 1;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.page-body.page-narrow {
    max-width: 560px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-align: center;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.page-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ============ Cards de planos (pricing) ============ */
.pricing {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
}

.pricing-card {
    position: relative;
    flex: 1 1 240px;
    max-width: 300px;
    background: linear-gradient(160deg, var(--bg-elevated), #0c1938);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.pricing-card.current {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(201, 164, 92, 0.4);
}

.pricing-badge {
    position: absolute;
    top: -0.7rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gold);
    color: #1d1428;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    white-space: nowrap;
}

.pricing-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    color: var(--gold-bright);
    text-align: center;
}

.pricing-price {
    text-align: center;
    margin: 0.5rem 0 1.25rem;
    color: var(--text);
    font-size: 1.9rem;
    font-weight: 700;
}

.pricing-price small {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.pricing-features {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    flex: 1;
}

.pricing-features li {
    position: relative;
    padding: 0.4rem 0 0.4rem 1.5rem;
    color: var(--text);
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pricing-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--gold);
    font-weight: 700;
}

/* ============ Painéis (Minha conta) ============ */
.panel {
    background: linear-gradient(160deg, var(--bg-elevated), #0c1938);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    color: var(--gold);
    margin-bottom: 1rem;
}

.panel-line {
    color: var(--text);
    margin-bottom: 0.5rem;
}

.panel-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============ Checkout (protótipo) ============ */
.proto-tag {
    text-align: center;
    color: var(--gold-bright);
    background: rgba(201, 164, 92, 0.1);
    border: 1px dashed var(--gold-dark);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.checkout-row {
    display: flex;
    gap: 0.75rem;
}

.checkout-row .form-group {
    flex: 1;
}

.form-group input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
