/* ===== BASE GLOBAL ===== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--app-font-family);
    color: var(--app-text);
    background: var(--app-bg);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    position: relative;
    background: var(--header-bg);
    padding-top: 2px;
    text-align: center;
    border-bottom: 1px solid var(--header-border);
}

.header-bar {
    position: relative;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0px;
}

.logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo svg,
.logo img {
    max-width: 220px;
    height: auto;
}

.footer {
    background: var(--footer-bg);
    padding: 10px;
    text-align: center;
    font-size: 13px;
    color: var(--footer-text);
    border-top: 1px solid var(--footer-border);
}

.footer hr {
    width: 40%;
    border: 0;
    border-top: 1px solid var(--footer-border);
    margin: 6px auto;
}

.footer b {
    color: var(--footer-accent);
}

.logo-ring {
    transform-origin: 36px 36px;
    animation: ringRotate 5s linear infinite;
}

@keyframes ringRotate {
    from {
        transform: rotate(0deg);
        transform-origin: 36px 36px;
    }
    to {
        transform: rotate(360deg);
        transform-origin: 36px 36px;
    }
}

/* ===== MENU ===== */

/* ===== MENU ===== */

.menu-toggle {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border: 1px solid var(--app-border);
    background: var(--app-surface);
    color: var(--app-text);
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.menu-toggle:hover {
    background: var(--app-bg-top);
    border-color: var(--app-primary);
}

.menu-toggle span,
.menu-toggle::before,
.menu-toggle::after {
    content: "";
    display: block;
    position: absolute;
    width: 18px;
    height: 2px;
    background: var(--app-text);
    border-radius: 999px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle span {
    transform: translateY(0);
}

.menu-toggle::before {
    transform: translateY(-6px);
}

.menu-toggle::after {
    transform: translateY(6px);
}

.menu-toggle.is-open span {
    opacity: 0;
}

.menu-toggle.is-open::before {
    transform: rotate(45deg);
}

.menu-toggle.is-open::after {
    transform: rotate(-45deg);
}

.style-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 16px;
    width: 180px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    padding: 0 6px 6px 6px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.style-menu.is-open {
    display: block;
}

.style-menu-title {
    margin: 6px 10px 10px 10px;
    padding-bottom: 6px;
    padding-left: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--app-text);
    text-align: left;
    border-bottom: 1px solid var(--app-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.style-list {
    list-style: none;
    margin: 0;
    padding: 0 8px 0 0;
    max-height: 210px;
    overflow-y: auto;
    margin-right: -8px;

    scrollbar-width: thin;
    scrollbar-color: var(--chat-scrollbar) transparent;
}

.style-list::-webkit-scrollbar {
    width: 6px;
}

.style-list::-webkit-scrollbar-thumb {
    background: var(--chat-scrollbar);
    border-radius: 4px;
}

.style-list li + li {
    margin-top: 8px;
}

.style-button {
    width: 100%;
    border: 1px solid var(--app-border);
    background: var(--app-bg);
    color: var(--app-text);
    padding: 9px 11px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.style-button:hover {
    background: var(--app-bg-top);
    border-color: var(--app-primary);
}

.style-button.is-active {
    border-color: var(--app-primary);
    background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 640px) {
    .header-bar {
        justify-content: space-between;
        padding: 0 12px;
    }

    .logo {
        order: 1;
        justify-content: flex-start;
    }

    .menu-toggle {
        position: static;
        transform: none;
        order: 2;
    }

    .style-menu {
        left: auto;
        right: 12px;
    }

    .style-list {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .style-list::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
}

/* ===== SETUP ===== */

body.setup-page {
    background: radial-gradient(circle at top, var(--app-bg-top), var(--app-bg) 60%);
    color: var(--app-text-soft);
}

/* Container central */
.container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Caixa setup */
.setup-box {
    background: var(--app-surface);
    padding: 30px;
    border-radius: 10px;
    width: 350px;
    max-width: 95%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--app-border);
}

/* Título */
.setup-box h2 {
    margin-top: 0;
    text-align: center;
    color: var(--app-text);
}

/* Form */
.setup-box form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Inputs */
.setup-box input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    outline: none;
    background: var(--input-bg);
    color: var(--input-text);
    font-size: 16px;
    box-sizing: border-box;
}

.setup-box input::placeholder {
    color: var(--input-placeholder);
}

.setup-box input:-webkit-autofill {
    background-color: var(--input-bg) !important;
    -webkit-box-shadow: 0 0 0 50px var(--input-bg) inset !important;
    -webkit-text-fill-color: var(--input-text) !important;
}

.setup-box input:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 2px var(--input-focus-ring);
}

/* Botão */
.setup-box button {
    width: 100%;
    padding: 12px;
    background: #14532d;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--app-text);
    transition: background 0.2s ease;
}

.setup-box button:hover {
    background: #166534;
}

/* Estados */
.error {
    background: rgba(127, 29, 29, 0.2);
    border: 1px solid #7f1d1d;
    padding: 10px;
    border-radius: 6px;
    color: #fecaca;
}

.success {
    background: #14532d;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    padding: 10px;
    border-radius: 6px;
    color: var(--app-text);
    text-align: center;
}
/* Mensagens */
.setup-box .message {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}

.success a {
    color: var(--app-text);
    text-decoration: none;
    font-weight: bold;
}

.success a:hover {
    text-decoration: underline;
}
.footer-setup {
    background: var(--header-bg);
    padding: 10px;
    text-align: center;
    font-size: 13px;
    color: var(--footer-text);
    border-top: 1px solid var(--footer-border);
}
.footer-setup hr {
    width: 40%;
    border: 0;
    border-top: 1px solid var(--footer-border);
    margin: 6px auto;
}