/* Reset básico para remover margens e paddings padrão */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Estilo geral do corpo */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #eaeaea;
    color: #222;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Cabeçalho */
header {
    background: #333;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
    position: relative;
    z-index: 10;
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

/* Conteúdo principal */
main, .admin-main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Seções */
section, .admin-section {
    margin-bottom: 2rem;
}

section h2, .admin-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Links */
a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

a:focus,
button:focus,
summary:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Formulários */
form {
    margin-bottom: 2rem;
}

form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

form input,
form textarea {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

/* Rodapé */
footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 1rem 0;
    width: 100%;
    z-index: 10;
}

/* Desktop */
@media (min-width: 769px) {
    footer {
        position: fixed;
        bottom: 0;
    }
}

/* Mobile */
@media (max-width: 768px) {
    footer {
        position: static;
    }
}

/* Tabelas */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

table th,
table td {
    border: 1px solid #ccc;
    padding: 0.5rem;
    text-align: left;
}

table th {
    background: #f4f4f4;
}

/* Painel Administrativo */
.admin-header {
    background: #222;
    color: #fff;
    padding: 1rem;
    text-align: center;
}

.admin-header h1 {
    margin: 0;
    font-size: 2rem;
}

.admin-nav {
    background: #333;
    color: #fff;
    padding: 0.5rem;
    text-align: center;
}

.admin-nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 1rem;
    transition: color 0.3s ease;
}

.admin-nav a:hover {
    text-decoration: underline;
    color: #ddd;
}

.admin-main {
    padding: 2rem;
}

.admin-section {
    margin-bottom: 2rem;
}

.admin-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Estilo para detalhes/summary */
details {
    border: 1px solid #ccc;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    background-color: #fff;
}

summary {
    font-weight: bold;
    cursor: pointer;
    color: #333;
    outline: none;
    min-height: 44px;
    display: flex;
    align-items: center;
    width: 100%;
}

details summary::after {
    font-size: 0.9rem;
    color: #888;
}

details[open] summary::after {
    font-size: 0.9rem;
    color: #555;
}

details[open] .conteudo-menu {
    border-top: 1px solid #ccc;
    padding-top: 1rem;
}

#menusPainel,
#menusDeveloper,
.conteudo-menu {
    clear: both;
    width: 100%;
    margin-top: 0.8rem;
}

/* Itens listados */
.item {
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.item a {
    color: #007bff;
    font-weight: bold;
}

/* Responsividade */
@media (max-width: 768px) {
    main, .admin-main {
        padding: 1rem;
    }

    header, footer {
        padding: 1rem 0.5rem;
    }

    table, th, td {
        font-size: 0.9rem;
    }

    .admin-nav a {
        display: block;
        margin: 0.5rem 0;
    }
}
details > div {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

details button {
    align-self: flex-start;
}

details a,
details button,
.item a,
.item button,
.admin-status-card a,
.admin-status-card button,
.stacked-actions a,
.stacked-actions button,
form button {
    display: flex;
    width: fit-content;
    margin-bottom: 0.5rem;
}

.admin-status-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: left;
}

.admin-status-box h2,
.admin-status-box h3 {
    margin-bottom: 0.75rem;
}

.admin-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.admin-status-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.75rem;
    background: #f9f9f9;
}

.admin-status-card.online {
    border-color: #b7e4c7;
}

.admin-status-card.offline {
    border-color: #f2c6c6;
}

.acessos-lista {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
}

.acessos-lista li {
    margin-bottom: 0.5rem;
}

.sub-details {
    margin-top: 0.75rem;
}

.descricao-texto {
    white-space: pre-wrap;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.msg-acoes {
    min-height: 1.5rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* Atualização do painel administrativo */
.login-box, #painelPrincipal, #menusPainel, #lista-itens {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

#msgLogin, #msg2fa, #msgRecuperacaoSenha, #msgReativacao,
#msgAlterarSenhaAdmin, #msgContaAdmin, #msgDoisFatoresAdmin,
#msgDeveloperAdmins, #msgChatAdmin, #msgNotificarUsuarios,
#msgNovaCategoria, #msgUploadArquivo, #msgLimparAcessos,
#msgDeveloperServidor {
    min-height: 1.5rem;
    margin: 0.5rem 0 1rem;
    font-weight: 600;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 0.4rem;
}

input[type="submit"], button {
    margin-top: 0.25rem;
    margin-right: 0.4rem;
    justify-content: center;
}

.log-container {
    max-height: 320px;
    overflow: auto;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 0.75rem;
    background: #f6f8fa;
}

.admin-status-card.online {
    background: #f0fff4;
}

.admin-status-card.offline {
    background: #fff5f5;
}

@media (max-width: 520px) {
    button, input[type="submit"] {
        width: 100%;
    }
}

/* Camada Bootstrap MR-Store */
:root {
    --mrstore-primary: #0d6efd;
    --mrstore-surface: #ffffff;
    --mrstore-border: #d7dee8;
    --mrstore-text-muted: #5f6b7a;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: #f4f6f9;
    color: #1f2937;
    padding-bottom: 5rem;
}

.app-header {
    padding: 0.75rem 0;
    text-align: left;
    box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.12);
}

.app-header-grid {
    display: grid;
    grid-template-columns: minmax(160px, auto) minmax(180px, 1fr) minmax(220px, 380px);
    gap: 1rem;
    align-items: center;
}

.navbar-brand {
    font-size: 1.45rem;
    font-weight: 700;
    grid-column: 1;
    grid-row: 1;
}

.app-nav-panels {
    display: grid;
    gap: 0.65rem;
    grid-column: 3;
    grid-row: 2;
    align-self: start;
}

.mrstore-public-metrics {
    display: grid;
    gap: 0.1rem;
    color: #f8f9fa;
    line-height: 1.35;
    grid-column: 2 / 4;
    grid-row: 1;
    justify-self: end;
    text-align: right;
}

.mrstore-public-metrics span {
    display: block;
}

.mrstore-page-navigation {
    display: grid;
    grid-template-columns: minmax(220px, 380px);
    gap: 0.6rem;
    align-items: center;
    justify-content: end;
}

.mrstore-page-navigation .form-select {
    min-height: 44px;
    margin: 0;
}

.mrstore-back-slot {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    align-self: start;
}

.mrstore-back-slot .back-button {
    width: auto;
    min-width: 88px;
}

.mrstore-search {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: 680px;
    justify-self: center;
    align-self: start;
    margin: 0;
    overflow: visible;
}

.mrstore-search-controls {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    overflow: visible;
}

.mrstore-search input[type="search"] {
    min-height: 44px;
    min-width: 0;
    margin: 0;
}

.mrstore-search #mrstoreSearchAction {
    display: block;
    flex: 0 0 auto;
    min-width: 88px;
    min-height: 44px;
    visibility: visible;
    opacity: 1;
    white-space: nowrap;
    position: relative;
    z-index: 2;
}

.mrstore-search-status {
    display: block;
    min-height: 1.35rem;
    margin-top: 0.25rem;
    color: #f8f9fa;
    font-size: 0.88rem;
    line-height: 1.35;
}

.mrstore-search-summary {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--mrstore-border);
    border-radius: 0.5rem;
    background: #eef5ff;
}

.mrstore-search-summary h2 {
    margin-bottom: 0.25rem;
    font-size: 1.25rem;
}

.mrstore-search-summary p,
.mrstore-search-location {
    margin-bottom: 0;
}

.mrstore-search-location {
    color: var(--mrstore-text-muted);
    overflow-wrap: anywhere;
}

.chat-moderation-actions {
    padding: 1rem 1rem 0;
}

.chat-message-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--mrstore-border);
}

.chat-message-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.chat-delete-button {
    flex: 0 0 auto;
}

.mrstore-page-section[hidden] {
    display: none;
}

.app-menu-panel,
details,
.item,
.admin-status-box,
.admin-status-card,
.login-box > form,
.auth-details {
    border: 1px solid var(--mrstore-border);
    border-radius: 0.5rem;
    background: var(--mrstore-surface);
    box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.06);
}

.app-menu-panel {
    color: #1f2937;
    margin: 0;
}

details {
    padding: 0;
    overflow: hidden;
}

summary {
    min-height: 46px;
    padding: 0.75rem 1rem;
    color: #1f2937;
    background: #f8fafc;
    border-radius: 0.5rem;
}

details[open] summary {
    border-bottom: 1px solid var(--mrstore-border);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

details > div,
.conteudo-menu {
    padding: 1rem;
    margin-top: 0;
}

main,
.admin-main,
.login-box,
#painelPrincipal,
#menusPainel,
#lista-itens {
    max-width: 1120px;
}

.login-box {
    max-width: 560px;
}

main.login-box {
    max-width: 560px;
}

.login-box > form,
.auth-details {
    margin-bottom: 1rem;
}

.login-box .card-body {
    padding: 1.25rem;
    width: 100%;
}

.login-box p {
    margin-bottom: 1rem;
}

.login-box label,
.auth-details label,
details label {
    display: grid;
    width: 100%;
    gap: 0.35rem;
}

.login-box button,
.auth-details button,
details button,
.item button {
    width: fit-content;
    min-width: 118px;
    white-space: nowrap;
}

.field-help {
    display: block;
    color: var(--mrstore-text-muted);
    font-size: 0.9rem;
    font-weight: 400;
    margin-top: -0.35rem;
    margin-bottom: 0.85rem;
}

.server-usage {
    border-top: 1px solid var(--mrstore-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.server-usage ul {
    list-style: disc;
    padding-left: 1.25rem;
}

.server-usage li {
    margin: 0.35rem 0;
}

.item {
    padding: 1rem;
    margin-bottom: 0.85rem;
}

.item p:last-child,
.admin-status-card p:last-child,
.log-container p:last-child {
    margin-bottom: 0;
}

.admin-status-box {
    padding: 1.25rem;
}

.admin-status-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.admin-status-card {
    background: #fff;
}

.admin-status-card.online {
    background: #f0fff7;
    border-color: #9ad8b0;
}

.admin-status-card.offline {
    background: #fff7f7;
    border-color: #efb4b4;
}

button,
input[type="submit"],
.back-button {
    border-radius: 0.375rem;
    font-weight: 600;
}

button:not(.btn),
input[type="submit"] {
    background: var(--mrstore-primary);
    border: 1px solid var(--mrstore-primary);
    color: #fff;
    padding: 0.55rem 0.9rem;
}

button:not(.btn):hover,
input[type="submit"]:hover {
    background: #0b5ed7;
    border-color: #0a58ca;
}

.back-button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.45rem 0.85rem;
    background: #e9ecef;
    color: #1f2937;
}

form input,
form textarea,
textarea {
    border-radius: 0.375rem;
    border-color: #ced4da;
}

.log-container {
    background: #f8fafc;
    border-color: var(--mrstore-border);
}

.app-footer,
footer {
    background: #212529;
    color: #f8f9fa;
    padding: 1rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.footer-links a,
.footer-action {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f8f9fa;
}

.footer-action {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.36);
}

.reactivation-box {
    margin-top: 1rem;
    padding: 0.85rem;
    border: 1px solid #b7d5ff;
    border-radius: 0.5rem;
    background: #f0f7ff;
}

.mrstore-upload-dashboard {
    margin: 1rem;
    padding: 1rem;
    border: 1px solid var(--mrstore-border);
    border-radius: 0.5rem;
    background: #f8fafc;
}

.mrstore-upload-dashboard h3 {
    margin-bottom: 0.75rem;
}

.mrstore-upload-dashboard progress {
    display: block;
    width: 100%;
    height: 1.15rem;
    overflow: hidden;
    accent-color: var(--mrstore-primary);
}

.mrstore-upload-summary,
.mrstore-upload-stats,
.mrstore-upload-state {
    margin: 0.5rem 0 0;
}

.mrstore-upload-summary,
.mrstore-upload-stats {
    color: #465467;
    font-size: 0.94rem;
}

.mrstore-upload-file-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.mrstore-upload-file {
    padding: 0.9rem;
    border: 1px solid var(--mrstore-border);
    border-left: 0.3rem solid #6c757d;
    border-radius: 0.45rem;
    background: #fff;
}

.mrstore-upload-file h4 {
    margin: 0 0 0.6rem;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.mrstore-upload-file.is-complete {
    border-left-color: #198754;
    background: #f2fff8;
}

.mrstore-upload-file.is-error {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.mrstore-upload-file.is-complete .mrstore-upload-state {
    color: #146c43;
    font-weight: 700;
}

.mrstore-upload-file.is-error .mrstore-upload-state {
    color: #b02a37;
    font-weight: 700;
}

@media (min-width: 769px) {
    footer {
        position: static;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 0;
    }

    .app-header-grid {
        grid-template-columns: 1fr;
    }

    .navbar-brand,
    .mrstore-public-metrics,
    .mrstore-back-slot,
    .mrstore-search,
    .app-nav-panels {
        grid-column: 1;
        grid-row: auto;
        width: 100%;
    }

    .mrstore-public-metrics {
        justify-self: stretch;
        text-align: left;
    }

    .mrstore-back-slot {
        justify-self: stretch;
    }

    .mrstore-search {
        max-width: none;
    }

    .mrstore-search-controls {
        display: block;
        position: relative;
    }

    .mrstore-search input[type="search"] {
        width: 100%;
        padding-right: 100px;
    }

    .mrstore-search #mrstoreSearchAction {
        position: absolute;
        top: 0;
        right: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        z-index: 2;
    }

    .mrstore-page-navigation {
        grid-template-columns: 1fr;
        justify-content: stretch;
    }

    .mrstore-page-navigation .form-select {
        width: 100%;
        max-width: none;
    }

    .chat-message-row {
        align-items: stretch;
        flex-direction: column;
    }

    main,
    .admin-main {
        padding: 1rem;
    }
}
