.group-stories-container {
    height: 100vh; 
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --background-color: #f4f7f6;
    --surface-color: #ffffff;
    --text-color: #333333;
    --light-gray-color: #ecf0f1;
    --font-family: 'Poppins', sans-serif;
    --border-radius: 12px;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.07);
    --transition-speed: 0.3s;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 80px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1;
}

a {
    text-decoration: none;
}

header.fixed-top {
    background-color: var(--surface-color) !important;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    transition: background-color var(--transition-speed) ease;
}

.navbar-brand img {
    transition: transform var(--transition-speed) ease;
}

.navbar-brand:hover img {
    transform: scale(1.05) rotate(-3deg);
}

.search-bar-custom .form-control {
    border-radius: var(--border-radius);
    border: 1px solid var(--light-gray-color);
    transition: all var(--transition-speed) ease;
}

.search-bar-custom .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.card, .post-card {
    background-color: var(--surface-color);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    overflow: hidden;
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
}

.card-body {
   /* padding: 1.75rem; */
}

.card-type-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    text-transform: uppercase;
    text-align: center;
    display: inline-block;
    margin: 0.5rem;
}

blockquote {
    margin: 1.5rem;
    padding: 1rem 1rem 0.1rem 1.5rem;
    border-left: 4px solid var(--primary-color);
    background-color: var(--light-gray-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    color: var(--text-color);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

.custom-quote {
    border-left: 3px solid #ccc;
    padding-left: 15px;
    margin: 15px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #555;
    background-color: #f9f9f9;
    border-radius: 10px;
}

.custom-quote a {
    color: inherit;
    text-decoration: none;
}

.custom-quote a:hover {
    text-decoration: underline;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: var(--surface-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.post-content th,
.post-content td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--light-gray-color);
}

.post-content thead th {
    background-color: #fafafa;
    font-weight: 600;
    color: var(--text-color);
}

.post-content tbody tr:hover {
    background-color: #f8f9fa;
}

.post-content tbody tr:last-child td {
    border-bottom: none;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: all var(--transition-speed) ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
    background-color: #2980b9;
    border-color: #2980b9;
}

.user-stats-sidebar {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%) translateX(-100%);
    width: 280px;
    background: var(--surface-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    box-shadow: var(--shadow);
    z-index: 1051;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.user-stats-sidebar.show {
    transform: translateY(-50%) translateX(0);
}

.stats-toggle-btn {
    position: absolute;
    top: 50%;
    right: -30px;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 10px 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.stats-toggle-btn:hover {
    background-color: #2980b9;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
}

.progress {
    height: 10px;
    border-radius: var(--border-radius);
}

.progress-bar {
    background-color: var(--secondary-color);
}

.footer {
    background-color: var(--surface-color);
    border-top: 1px solid var(--light-gray-color);
    padding: 2rem 0;
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 3rem;
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }

    .post-card:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    .post-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

.lei-item {
    padding: 8px;
    border-left: 2px solid transparent;
    transition: background-color 0.2s, border-color 0.2s;
    border-radius: 8px;
    margin-bottom: 2px;
}


.lei-item:hover {
    background-color: #f0f0f0;
    border-left-color: #a8dadc;
}

.lei-item .numero {
    font-weight: bold;
    color: #343a40;
    margin-right: 10px;
}

.lei-item .titulo {
    font-style: italic;
    color: #6c757d;
    display: block;
}

.lei-item.grifado {
    background-color: #fff3cd;
    border-left-color: #ffc107;
}

.lei-item-actions {
    opacity: 0;
    transition: opacity 0.2s;
    text-align: right;
}


.lei-item:hover .lei-item-actions {
    opacity: 1;
}

.group-carousel-item {
    height: 180px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.group-carousel-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    transition: transform 0.3s ease;
}

.group-carousel-item:hover .group-carousel-banner {
    transform: scale(1.1);
}

.group-carousel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.1));
    z-index: 2;
}

.group-carousel-content {
    position: relative;
    z-index: 3;
    padding: 1rem;
}

.group-carousel-avatar {
    width: 60px;
    height: 60px;
    object-fit: cover;
}

.text-shadow {
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.tns-controls button {
    display: none;
}

.fab-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.fab-item {
    width: 40px;
    height: 40px;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.fab-item:hover {
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.filter-fab {
    background-color: var(--bs-secondary);
}

.groups-fab {
    background-color: var(--bs-info);
}

#groq-chat-fab {
    background-color: var(--bs-primary);
}

.modal-xl {
    max-width: 90%;
}

.modal-body {
    background-color: #f8f9fa;
}

.chat-container {
    height: 60vh;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.references-container-wrapper {
    height: 60vh;
    display: flex;
    flex-direction: column;
}

.references-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    border-left: 1px solid #dee2e6;
}

.chat-message {
    max-width: 85%;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.chat-message .message-content {
    padding: 10px 15px;
    border-radius: 15px;
    line-height: 1.5;
}

.chat-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message.user .message-content {
    background-color: var(--bs-primary);
    color: white;
    border-bottom-right-radius: 3px;
}

.chat-message.ai {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-message.ai .message-content {
    background-color: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 3px;
}

.chat-message.ai .message-content p {
    margin-bottom: 0.5em;
}

.chat-message.loading {
    align-self: flex-start;
}

.chat-message.loading .message-content {
    background-color: #e9ecef;
}

.dot-flashing {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #9880ff;
    color: #9880ff;
    animation: dot-flashing 1s infinite linear alternate;
    animation-delay: 0.5s;
}

.dot-flashing::before, .dot-flashing::after {
    content: "";
    display: inline-block;
    position: absolute;
    top: 0;
}

.dot-flashing::before {
    left: -15px;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #9880ff;
    color: #9880ff;
    animation: dot-flashing 1s infinite alternate;
    animation-delay: 0s;
}

.dot-flashing::after {
    left: 15px;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #9880ff;
    color: #9880ff;
    animation: dot-flashing 1s infinite alternate;
    animation-delay: 1s;
}

@keyframes dot-flashing {
    0% {
        background-color: #9880ff;
    }
    50%, 100% {
        background-color: rgba(152, 128, 255, 0.2);
    }
}

.reference-card {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background-color: #fff;
    transition: box-shadow 0.2s ease-in-out;
}

.reference-card:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.reference-card-title {
    font-weight: bold;
    color: var(--bs-primary);
    text-decoration: none;
}

.reference-card-title:hover {
    text-decoration: underline;
}

.reference-card-snippet {
    font-size: 0.875em;
    color: #6c757d;
}

@media (min-width: 992px) {
    .groups-fab {
        display: none !important;
    }
}

@media (max-width: 992px) {
    .sidebarg {
        display: none !important;
    }
}

/* ====================================================== */
/* ESTILOS PARA O MODAL DE CHAT RESPONSIVO                */
/* ====================================================== */

/* Estilo para o cabeçalho do acordeão que não deve fechar */
.accordion-button.non-collapsible:not(.collapsed) {
  background-color: #f7f7f7; /* Cor de fundo suave */
  color: #212529;
  box-shadow: none;
}
.accordion-button.non-collapsible:not(.collapsed)::after {
  background-image: none; /* Remove a seta de expandir/recolher */
  transform: none;
}
.accordion-button.non-collapsible:focus {
  box-shadow: none;
  border-color: rgba(0,0,0,.125);
}

/* Ajustes para telas pequenas (abaixo do breakpoint 'md' do Bootstrap) */
@media (max-width: 767.98px) {
  .modal-chat-responsive {
    /* Faz o modal ocupar mais espaço vertical na tela */
    max-width: 95%;
    margin: 1.75rem auto;
  }

  .modal-chat-responsive .modal-body {
    padding: 0.5rem;
    /* Remove a rolagem do body e a transfere para os containers internos */
    overflow-y: hidden; 
  }

  /* Define uma altura máxima para o container do chat */
  .modal-chat-responsive .chat-container {
    height: 60vh; /* Ocupa 60% da altura da tela */
    max-height: 60vh;
    overflow-y: auto; /* Adiciona rolagem interna */
    padding: 0.5rem;
  }
  
  /* Garante que o acordeão de referências não ocupe a tela inteira */
  .modal-chat-responsive #references-container {
      max-height: 40vh; /* Altura máxima para referências */
      overflow-y: auto;
  }
  
  /* Ajusta o padding do rodapé para ficar mais compacto */
  .modal-chat-responsive .modal-footer {
    padding: 0.5rem;
  }

  /* Força a quebra de linha nas colunas para garantir o empilhamento */
  .modal-chat-responsive .row > * {
    margin-bottom: 0.75rem;
  }
  .modal-chat-responsive .row > *:last-child {
    margin-bottom: 0;
  }
}