html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ==========================================================================
   PALETA DE CORES E VARIÁVEIS GLOBAIS (FeiraNaMão)
   ========================================================================== */
:root {
    /* Cores Primárias */
    --verde-floresta: #044537;
    --verde-esmeralda: #10AC89;
    --ambar-colheita: #F7BC5C;

    /* Cores de Apoio */
    --creme-kraft: #EFE8E1;
    --branco: #FFFFFF;
    --esmeralda-escuro: #086B55;
    --texto-principal: #1F2A26;
    --texto-secundario: #4A5550;
    --borda-campo: #7D8782;
    --divisoria: #E2DBD2;
    --vermelho-remocao: #C82333;

    /* Sobredescrita das variáveis nativas do Bootstrap */
    --bs-primary: #044537;
    --bs-primary-rgb: 4, 69, 55;
    --bs-secondary: #10AC89;
    --bs-secondary-rgb: 16, 172, 137;
    --bs-warning: #F7BC5C;
    --bs-warning-rgb: 247, 188, 92;
    --bs-body-bg: #EFE8E1;
    --bs-body-color: #1F2A26;
    --bs-border-radius: 8px;
    --bs-border-radius-lg: 12px;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--creme-kraft);
    color: var(--texto-principal);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   LAYOUT PADRÃO (TEMPLATE COMPARTILHADO)
   ========================================================================== */
.fnm-header {
    background-color: var(--verde-floresta);
    color: var(--branco);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.fnm-header .navbar-brand {
    color: var(--branco);
    font-weight: 700;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fnm-header .navbar-brand:hover {
    color: var(--ambar-colheita);
}

.fnm-header .nav-link {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.fnm-header .nav-link:hover,
.fnm-header .nav-link.active {
    color: var(--ambar-colheita);
    background-color: rgba(255, 255, 255, 0.08);
}

/* Botões do Cabeçalho */
.btn-fnm-outline-light {
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    color: var(--branco);
    background: transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 7px 16px;
    transition: all 0.2s;
}

.btn-fnm-outline-light:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--branco);
    border-color: var(--branco);
}

.btn-fnm-ambar {
    background-color: var(--ambar-colheita);
    color: #1a1a1a;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 8px 22px;
    transition: all 0.2s;
}

.btn-fnm-ambar:hover {
    background-color: #e5aa48;
    color: #000;
}

/* Contêiner Padrão 1200px */
.container-1200 {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

/* Rodapé Verde Floresta */
.fnm-footer {
    background-color: var(--verde-floresta);
    color: rgba(255, 255, 255, 0.85);
    padding: 40px 0 24px 0;
    margin-top: auto;
    font-size: 0.9rem;
}

.fnm-footer a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: color 0.2s;
}

.fnm-footer a:hover {
    color: var(--ambar-colheita);
}

.fnm-footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 16px;
    margin-top: 24px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.65);
}

/* ==========================================================================
   PADRÃO B · TELAS DE ACESSO (LOGIN E CADASTRO)
   ========================================================================== */
.auth-page-wrapper {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

.auth-card {
    background: var(--branco);
    border-radius: 12px;
    border: 1px solid var(--divisoria);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    padding: 36px 40px;
    width: 100%;
}

.auth-card-login {
    max-width: 480px;
}

.auth-card-cadastro {
    max-width: 620px;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--texto-principal);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--texto-secundario);
    margin-bottom: 0;
}

/* Campos de Formulário FNM */
.fnm-form-group {
    margin-bottom: 18px;
}

.fnm-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--texto-principal);
    margin-bottom: 6px;
}

.fnm-input,
.fnm-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--borda-campo);
    border-radius: 8px;
    background-color: var(--branco);
    color: var(--texto-principal);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.fnm-input:focus,
.fnm-select:focus {
    outline: none;
    border-color: var(--verde-esmeralda);
    box-shadow: 0 0 0 3px rgba(16, 172, 137, 0.2);
}

.fnm-input::placeholder {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.9rem;
}

/* Botão Principal de Ação */
.btn-fnm-submit {
    width: 100%;
    padding: 12px;
    background-color: #121816;
    color: var(--branco);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.btn-fnm-submit:hover {
    background-color: var(--verde-floresta);
    color: var(--branco);
}

/* Divisores e Links de Acesso */
.auth-footer-link {
    text-align: center;
    margin-top: 22px;
    font-size: 0.9rem;
    color: var(--texto-secundario);
}

.auth-footer-link a {
    color: var(--verde-floresta);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer-link a:hover {
    text-decoration: underline;
    color: var(--esmeralda-escuro);
}

.auth-divider {
    border: 0;
    border-top: 1px solid var(--divisoria);
    margin: 22px 0;
}

/* ==========================================================================
   PADRÃO C · PAINEL DO PRODUTOR (WIREFRAME C)
   ========================================================================== */
.painel-container {
    padding: 32px 0 60px 0;
}

.painel-sidebar {
    background: var(--branco);
    border-radius: 12px;
    border: 1px solid var(--divisoria);
    padding: 24px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.painel-sidebar-support {
    padding: 16px;
}

.mobile-card-list {
    display: none;
}

.mobile-data-card {
    background: var(--branco);
    border: 1px solid var(--divisoria);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.mobile-card-warning {
    border-color: #F7BC5C;
    background: #fffaf0;
}

.mobile-card-thumb {
    width: 58px;
    height: 58px;
    min-width: 58px;
    border-radius: 10px;
    object-fit: cover;
}

.mobile-card-thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f2;
    color: var(--texto-secundario);
    font-size: 1.4rem;
}

.mobile-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.image-upload-feedback {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.image-preview-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    border: 1px solid var(--divisoria);
    object-fit: cover;
}

.upload-error {
    color: var(--vermelho-remocao);
    font-size: 0.875rem;
    font-weight: 600;
}

.painel-sidebar-header {
    padding: 0 12px 18px 12px;
    border-bottom: 1px solid var(--divisoria);
    margin-bottom: 16px;
}

.painel-sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--texto-principal);
    margin-bottom: 2px;
}

.painel-sidebar-subtitle {
    font-size: 0.82rem;
    color: var(--texto-secundario);
}

.painel-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--texto-principal);
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    margin-bottom: 4px;
    transition: all 0.15s;
}

.painel-nav-item:hover {
    background-color: rgba(4, 69, 55, 0.06);
    color: var(--verde-floresta);
}

.painel-nav-item.active {
    background-color: #E2EBE7;
    color: var(--verde-floresta);
    font-weight: 600;
}

.painel-card {
    background: var(--branco);
    border-radius: 12px;
    border: 1px solid var(--divisoria);
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.stat-card {
    background: var(--branco);
    border-radius: 12px;
    border: 1px solid var(--divisoria);
    padding: 20px 24px;
    height: 100%;
}

.stat-title {
    font-size: 0.85rem;
    color: var(--texto-secundario);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--texto-principal);
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-meta {
    font-size: 0.82rem;
    color: #6b7280;
}

/* ==========================================================================
   UI/UX ENHANCEMENTS & BOOTSTRAP REFINEMENTS
   ========================================================================== */

/* Elevação suave de cards no hover */
.transition-hover {
    transition: transform 0.22s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.22s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.transition-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(4, 69, 55, 0.1) !important;
}

/* Limitador de linhas de texto (Line Clamp) */
.text-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sombra de texto suave para banners */
.text-shadow {
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* Customização dos Indicadores do Carrossel */
#carouselFeirasHome .carousel-indicators [data-bs-target] {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    border: none;
    margin: 0 4px;
    transition: all 0.25s ease-in-out;
}

#carouselFeirasHome .carousel-indicators .active {
    width: 26px;
    border-radius: 6px;
    background-color: var(--ambar-colheita);
}

/* Setas de navegação do carrossel */
#carouselFeirasHome .carousel-control-prev,
#carouselFeirasHome .carousel-control-next {
    width: 4.5rem;
    opacity: 0.75;
    transition: opacity 0.2s;
}

#carouselFeirasHome .carousel-caption-content {
    max-width: 760px;
    margin-left: clamp(2.5rem, 8vw, 7rem);
    margin-right: clamp(2.5rem, 8vw, 7rem);
}

#carouselFeirasHome .carousel-control-prev:hover,
#carouselFeirasHome .carousel-control-next:hover {
    opacity: 1;

}

@media (max-width: 575.98px) {
    #carouselFeirasHome .carousel-control-prev,
    #carouselFeirasHome .carousel-control-next {
        width: 3rem;
    }

    #carouselFeirasHome .carousel-caption-content {
        margin-left: 2rem;
        margin-right: 2rem;
    }
}

/* ==========================================================================
   ACERTOS DE USABILIDADE, ACESSIBILIDADE E MICROINTERAÇÕES (WCAG 2.1 AA)
   ========================================================================== */

/* Link de salto de acessibilidade (Skip link) */
.skip-to-content:focus {
    outline: 3px solid #000000 !important;
    outline-offset: 2px;
}

/* Indicador de foco de alto contraste para teclado (WCAG 2.4.7) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--verde-esmeralda) !important;
    outline-offset: 2px;
}

/* Feedback tátil nos botões no clique */
.btn:active,
.btn-fnm-submit:active {
    transform: scale(0.97);
}

/* Botão Voltar ao Topo Flutuante */
#btnVoltarTopo {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1040;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: var(--verde-floresta);
    color: #ffffff;
    border: 2px solid var(--ambar-colheita);
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(4, 69, 55, 0.3);
    cursor: pointer;
    transition: all 0.25s ease-in-out;
}

#btnVoltarTopo:hover {
    background-color: var(--esmeralda-escuro);
    color: var(--ambar-colheita);
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(4, 69, 55, 0.4);
}

/* Destacamento sutil de links ativos na barra de navegação */
.fnm-header .nav-link.active {
    color: var(--ambar-colheita) !important;
    font-weight: 700 !important;
    position: relative;
}

.fnm-header .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 12px;
    right: 12px;
    height: 3px;
    background-color: var(--ambar-colheita);
    border-radius: 2px;
}

@media (max-width: 767.98px) {
    .desktop-data-table {
        display: none;
    }

    .mobile-card-list {
        display: grid;
        gap: 12px;
    }

    .painel-card {
        padding: 18px 16px;
    }

    .painel-container {
        padding-top: 20px;
    }

    .display-6 {
        font-size: 2rem;
    }
}
