/* /home/wander/crebortoli/static/css/style2.css (Refatorado) */

/* ==========================================================================
   1. ESTILOS GLOBAIS E VARIÁVEIS DE COR
   ========================================================================== */

:root {
    --cor-principal: #6C63FF; /* modern indigo */
    --cor-accent: #00BFA6; /* teal accent */
    --cor-titulo: #2a254b; /* deep indigo for headings */
    --cor-texto: #0f1724; /* slate-900 */
    --cor-texto-claro: #ffffff;
    --cor-fundo: #f7f8fc; /* very light */
    --cor-borda: #e6e9f2;
    --sombra-suave: 0 6px 18px rgba(15, 20, 32, 0.06);
    --fonte-principal: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    --fonte-titulo: 'World of Water', cursive;
}

@font-face {
    font-family: 'World of Water';
    src: url('../fonts/World_Discovery_Five_PERSONAL_Regular.otf') format('truetype');
    font-weight: normal;
    font-style: normal;
}


/* Reset básico e configuração da fonte */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--fonte-principal);
    line-height: 1.6;
    background-color: var(--cor-fundo);
    color: var(--cor-texto);
}

a {
    color: var(--cor-principal);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--cor-titulo);
}

/* ==========================================================================
   2. LAYOUT PRINCIPAL E CONTAINER
   ========================================================================== */

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

.main-content {
    padding: 2rem 0;
}

/* ==========================================================================
   3. CABEÇALHO E NAVEGAÇÃO
   ========================================================================== */

.header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background-color: #fff;
    border-bottom: 1px solid var(--cor-borda);
    box-shadow: var(--sombra-suave);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-title {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--cor-titulo);
}

.site-title {
    font-family: var(--fonte-titulo);
    font-size: 1.5rem;
    color: var(--cor-principal);
}

.main-nav {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.main-nav .menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.main-nav .menu > .nav-item {
    position: relative;
}

.main-nav .menu > .nav-item > a {
    display: block;
    text-decoration: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: var(--cor-texto);
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
}

.main-nav .menu > .nav-item > a:hover {
    background-color: rgba(108,99,255,0.1);
    color: var(--cor-principal);
    text-decoration: none;
}

/* Estilos do Submenu (Dropdown) */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    border: 1px solid var(--cor-borda);    
    border-radius: 0 0 8px 8px;
    box-shadow: var(--sombra-suave);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    min-width: 200px;
    z-index: 1001;
}

.nav-item.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu .dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--cor-texto);
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-menu .dropdown-item:hover {
    background-color: rgba(108,99,255,0.1);
    color: var(--cor-principal);
}

.dropdown-toggle::after {
    content: ' ▼';
    font-size: 0.7rem;
}

/* Botão do Menu Sanduíche (Mobile) - Escondido por padrão em telas grandes */
.sandwich-button {
    display: none;
    align-items: center;
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1002;
}

.sandwich-button span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--cor-texto);
    margin: 5px 0;
    transition: 0.3s;
}

/* sandwich active (X) */
.sandwich-button.is-active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.sandwich-button.is-active span:nth-child(2) {
    opacity: 0;
}
.sandwich-button.is-active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Mobile overlay for off-canvas menu */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(19, 20, 20, 0.52);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
    z-index: 999;
}
.mobile-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* Support single .sandwich-icon element (uses pseudo elements) */
.sandwich-button .sandwich-icon {
    display: block;
    width: 24px;
    height: 3px;
    background-color: var(--cor-texto);
    position: relative;
    transition: background-color 0.25s ease, transform 0.25s ease;
}
.sandwich-button .sandwich-icon::before,
.sandwich-button .sandwich-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: #6C63FF;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.sandwich-button .sandwich-icon::before { top: -8px; }
.sandwich-button .sandwich-icon::after { bottom: -8px; }

.sandwich-button.is-active .sandwich-icon {
    background-color: transparent;
}
.sandwich-button.is-active .sandwich-icon::before {
    transform: translateY(8px) rotate(45deg);
}
.sandwich-button.is-active .sandwich-icon::after {
    transform: translateY(-8px) rotate(-45deg);
}
/* ==========================================================================
   4. SEÇÕES E COMPONENTES GERAIS
   ========================================================================== */

.page-header,
.intro-section {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.intro-section {
    border-bottom: 1px solid var(--cor-borda);
}

.intro-section h2, .page-header h2 {
    font-size: 2.5rem;
}

.intro-section p {
    font-size: 1.1rem;
    color: #555;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
}

/* Mensagens Flash (feedback para o usuário) */
.flash-messages {
    margin-bottom: 1.5rem;
}
.alert {
    padding: 1rem;
    border-radius: 5px;
    color: #fff;
    margin-bottom: 1rem;
}
.alert-success { background-color: #28a745; }
.alert-danger { background-color: #dc3545; }
.alert-warning { background-color: #ffc107; color: #333; }
.alert-info { background-color: #17a2b8; }

/* ==========================================================================
   5. CARTÕES DE POSTAGEM
   ========================================================================== */

.post-list {
    display: grid;
    gap: 2rem;
}

.post-card {
    background-color: #fff;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    box-shadow: var(--sombra-suave);
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f7f2fa;
    font-size: 0.9rem;
    color: #555;
}

.post-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
}

.post-body {
    padding: 1.5rem;
}

.post-comment {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-top: 1px solid var(--cor-borda);
}

.comment-text {
    font-style: italic;
    color: #555;
    border-left: 4px solid var(--cor-principal);
    padding-left: 1rem;
    margin: 0;
}

.comment-meta {
    font-size: 0.85rem;
    color: #777;
    margin-top: 1rem;
    text-align: right;
}

.no-posts {
    text-align: center;
    padding: 2rem;
    color: #777;
}

/* ==========================================================================
   6. FORMULÁRIOS
   ========================================================================== */

.comment-form-section {
    margin-top: 3rem;
    padding: 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: var(--sombra-suave);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--cor-borda);
    border-radius: 5px;
    font-family: var(--fonte-principal);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--cor-principal);
    box-shadow: 0 0 0 3px rgba(138, 75, 175, 0.2);
}

.btn-submit {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: var(--cor-principal);
    color: var(--cor-texto-claro);
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.btn-submit:hover {
    background-color: var(--cor-principal-escura);
    transform: scale(1.05);
    text-decoration: none;
}

/* ==========================================================================
   7. DASHBOARD E TABELAS
   ========================================================================== */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.dashboard-card {
  background-color: #fff; /* CORRIGIDO: Usando uma cor definida */
  border: 1px solid var(--cor-borda);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--sombra-suave);
  display: flex;
  flex-direction: column;
}

.dashboard-card h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.dashboard-value {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--cor-principal); /* CORRIGIDO: Usando uma cor definida */
  margin-bottom: 1rem;
  flex-grow: 1;
}

.card-link {
  color: var(--cor-principal);
  text-decoration: none;
  font-weight: bold;
  align-self: flex-start;
  transition: transform 0.2s ease;
}

.card-link:hover {
  text-decoration: underline;
  transform: translateX(4px);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.table th,
.table td {
  border: 1px solid var(--cor-borda);
  padding: 0.75rem;
  text-align: left;
  /* word-break: break-word; */
  white-space: nowrap;
  /* overflow: hidden;
  text-overflow: ellipsis; */
}

.table th {
  background-color: #f2f2f2;
  font-weight: bold;
}

.actions-cell {
  text-align: center;
  white-space: nowrap;
}

.btn-action {
  display: inline-block;
  padding: 6px;
  border-radius: 50%; /* Círculo para ícones */
  transition: background-color 0.2s ease;
}

.btn-action img {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.btn-action:hover {
    background-color: #f0e4f7; /* Fundo roxo bem claro */
}

.btn-delete:hover {
  background-color: #ffdddd;
}

.search-form {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.search-form .form-group {
  flex-grow: 1;
  margin-bottom: 0;
}

/* ==========================================================================
   8. RODAPÉ
   ========================================================================== */

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 2rem;
    margin-top: 2rem;
    background-color: #333;
    color: var(--cor-texto-claro);
}

.footer-social a {
    margin-left: 1rem;
}

.footer-social img {
    width: 24px;
    height: 24px;
    transition: transform 0.2s;
}

.footer-social img:hover {
    transform: scale(1.2);
}

/* ==========================================================================
   9. RESPONSIVIDADE
   ========================================================================== */

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 1rem;
    }

    .header {
        padding: 0.75rem 1rem;
        position: relative; 
        z-index: 1002;
    }
    
    .header-container {
        flex-wrap: wrap;
    }

    .sandwich-button {
        display: flex; /* Exibe o botão em telas pequenas */
    }

    .site-title {
        font-size: 1.2rem;
    }

    .main-nav {
        display: none; /* Esconde o menu por padrão */
        position: fixed;
        top: 0;
        right: 0;
        width: 75%;
        max-width: 300px;
        height: 100%;
        background-color: #fff;
        box-shadow: var(--sombra-suave);
        z-index: 1001;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }

    .main-nav.is-active {
        display: flex;
        transform: translateX(0);
    }

    .main-nav .menu {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding-top: 1rem;
    }

    .main-nav .menu > .nav-item {
        width: 100%;
    }

    .main-nav .menu > .nav-item > a {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--cor-borda);
        color: var(--cor-texto);
    }

    /* Ajusta o comportamento do dropdown no mobile para ser estático */
    .main-nav .dropdown-menu {
        position: static;
        display: none; /* Oculto por padrão no mobile. */
        width: 100%;
        border: none;
        box-shadow: none;
        background-color: transparent; /* keep transparent on indigo background */
        padding-left: 2.5rem; /* Indentação para mostrar a hierarquia */
    }
    
    /* SUGESTÃO: Use JavaScript para adicionar uma classe 'submenu-open' ao item pai (.nav-item) quando tocado, para mostrar o submenu. */
    .main-nav .menu > .nav-item.submenu-open .dropdown-menu {
        display: block;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }
}
    /* ... existing styles ... */
    
    /* Styles for the contrast button */
    .contrast-button {
        background-color: transparent;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        margin-right: 1rem;  /* Adjust spacing */
    }
    
    .contrast-icon {
        /* Style your contrast icon – a simple example */
        display: inline-block;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-color: var(--cor-texto); /* Initially use text color for icon */
        position: relative;
    }
    
    .contrast-icon::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background-color: var(--cor-fundo);
    }
    
    /* Toggle contrast using a class on the body */
    body.high-contrast {
        --cor-fundo: var(--cor-texto);
        --cor-texto: var(--cor-fundo-original); /* Swap background and text */
    }
    
    /* Store the original background color for toggling */
    :root {
        /* ... other variables ... */
        --cor-fundo-original: var(--cor-fundo);
    }
    
    /* ... rest of your CSS, adjust for contrast where needed ... */
    
    
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
    .search-form {
        margin-bottom: 20px;
    }
    .table-responsive {
        overflow-x: auto;
    }
    
/* ==========================================================================
   10. UTILITIES
   ========================================================================== */
.text-success {
    color: #28a745 !important; /* Verde para sucesso/lucro */
}

.text-danger {
    color: #dc3545 !important; /* Vermelho para perigo/prejuízo */
}

