/*
 * Estilos Personalizados Premium - Gerenciador de Atas Sindicais
 * Inspirado em design moderno de SaaS com foco em usabilidade e sofisticação
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    /* Paleta de Cores Harmônicas (Base HSL) */
    --color-primary: #1e40af;       /* Azul Escuro Slate */
    --color-primary-light: #3b82f6; /* Azul Claro Brilhante */
    --color-secondary: #0f172a;     /* Cinza Escuro Charcoal */
    --color-accent: #0d9488;        /* Teal / Azul-Verde */
    --color-success: #10b981;       /* Verde Esmeralda */
    --color-warning: #f59e0b;       /* Amber / Laranja-Amarelo */
    --color-danger: #ef4444;        /* Vermelho Suave */
    
    /* Backgrounds e Superfícies */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    
    /* Efeitos */
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.1);
    --border-radius: 12px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input[name="codigo"],
input[name="codigo_confirmacao"],
input[name="codigo_desativar"] {
    letter-spacing: 0.35em;
    font-size: 1.35rem;
    font-weight: 600;
}

.form-check-lembrar-movel {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--border-radius);
    padding: 1rem 1rem 1rem 2.75rem;
}

.form-check-lembrar-movel .form-check-input {
    width: 1.35rem;
    height: 1.35rem;
    margin-top: 0.15rem;
}

.form-check-lembrar-movel .form-check-label {
    font-weight: 500;
    color: #166534 !important;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-body);
    color: #334155;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-secondary);
    font-weight: 600;
}

/* Navbar Estilo Glassmorphism */
.navbar-custom {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    transition: var(--transition-smooth);
    z-index: 1030;
}

.navbar-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-primary) !important;
    font-size: 1.35rem;
    letter-spacing: -0.5px;
}

.nav-link {
    font-weight: 500;
    color: #475569 !important;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.nav-link:hover, .nav-link.active {
    color: var(--color-primary) !important;
    background-color: rgba(59, 130, 246, 0.08);
}

/* Cartões com Design Premium */
.card-premium {
    background-color: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.card-premium:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(59, 130, 246, 0.2);
}

.card-header-gradient {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    font-family: var(--font-heading);
    font-weight: 600;
    border-bottom: none;
    padding: 1.25rem 1.5rem;
}

/* Dashboard Widgets */
.widget-stat {
    position: relative;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.widget-stat:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.widget-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Badges e Status */
.badge-custom {
    padding: 0.45em 0.8em;
    font-weight: 600;
    border-radius: 30px;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-rascunho { background-color: rgba(71, 85, 105, 0.1); color: #475569; }
.badge-assinaturas { background-color: rgba(59, 130, 246, 0.1); color: #2563eb; }
.badge-encerrada { background-color: rgba(13, 148, 136, 0.1); color: #0f766e; }
.badge-homologada { background-color: rgba(16, 185, 129, 0.1); color: #047857; }

/* Botões Modernos */
.btn-premium {
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    transition: var(--transition-smooth);
    border: none;
}

.btn-premium-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
}

.btn-premium-primary:hover {
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
    opacity: 0.95;
    color: white;
}

.btn-premium-accent {
    background: linear-gradient(135deg, var(--color-accent), #0f766e);
    color: white;
}

.btn-premium-accent:hover {
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.35);
    opacity: 0.95;
    color: white;
}

/* Tela de Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(26, 54, 93, 0.95) 0%, rgba(15, 23, 42, 1) 90%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    overflow: hidden;
    padding: 2.5rem;
}

/* Painel de Comentários / Chat Interno */
.comments-sidebar {
    background: var(--bg-card);
    border-left: 1px solid #e2e8f0;
    height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
    display: flex;
    flex-direction: column;
}

.comment-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.comment-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    transition: var(--transition-smooth);
}

.comment-item:hover {
    border-color: rgba(59, 130, 246, 0.3);
}

.comentario-ref-trecho {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.comentario-ir-trecho:hover .comentario-ref-trecho {
    background-color: #fef08a !important;
}

mark.comentario-trecho-destaque {
    background-color: #fde047;
    padding: 0 2px;
    border-radius: 2px;
    animation: trecho-pulse 1.5s ease-in-out 2;
}

/* Seleção ao ir ao trecho do comentário (CKEditor e visualização) */
.ck-editor__editable::selection,
#texto-conteudo-ata::selection {
    background-color: #fbbf24;
    color: #1e293b;
}

@keyframes trecho-pulse {
    0%, 100% { background-color: #fde047; }
    50% { background-color: #facc15; }
}

/* Busca avançada em atas */
.busca-destaque {
    background-color: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

.busca-trecho {
    background: #f8fafc;
    border-left: 3px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    border-radius: 0 6px 6px 0;
}

.busca-resultado-card {
    transition: box-shadow 0.2s ease;
}

.busca-resultado-card:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.comment-input-area {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    background: white;
}

/* Alerta de Pendência Ativa no Dashboard */
.pending-alert-banner {
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    border-left: 5px solid var(--color-warning);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    animation: pulseGlow 3s infinite ease-in-out;
}

/* Caixa de Destaque da IA */
.ai-summary-box {
    background: linear-gradient(135deg, rgba(236, 254, 255, 0.9), rgba(224, 242, 254, 0.5));
    border-left: 5px solid var(--color-accent);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Estilo para Tabela de Auditoria */
.table-responsive-custom {
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: white;
}

.table-custom th {
    background-color: #f1f5f9;
    font-family: var(--font-heading);
    font-weight: 600;
    color: #475569;
    padding: 1rem;
}

.table-custom td {
    padding: 1rem;
    vertical-align: middle;
}

/* Ações na tabela de usuários (Configurações) */
.usuario-col-acoes {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle !important;
}

.usuario-acoes-btns {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.usuario-acoes-btns .btn {
    flex: 0 0 auto;
    width: 2.125rem;
    height: 2.125rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.usuario-acoes-btns .btn i {
    line-height: 1;
    font-size: 0.95rem;
}

.usuario-nivel-badges .badge {
    white-space: nowrap;
}

/* Quórum / Lista de Presença */
.quorum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.quorum-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
}

.quorum-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: white;
}

/* Rodapé */
footer {
    background: var(--bg-sidebar);
    color: #94a3b8;
    padding: 1.5rem 0;
    margin-top: auto;
    border-top: 1px solid #1e293b;
}

/* Animações */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 10px rgba(245, 158, 11, 0.05);
    }
    50% {
        box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
    }
}

/* ========== Mobile: navegação e layout ========== */
body.has-mobile-nav {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

.mobile-bottom-nav {
    display: none;
}

.mobile-bottom-nav button {
    cursor: pointer;
}

.navbar-mobile-user {
    display: none;
}

.mobile-menu-list .list-group-item {
    border: none;
    border-radius: 10px !important;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.offcanvas-bottom {
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
}

@media (max-width: 991.98px) {
    .navbar-actions-mobile {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
        gap: 0.5rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid #e2e8f0;
    }

    .navbar-actions-mobile .btn {
        flex: 1 1 auto;
        min-width: calc(50% - 0.25rem);
        justify-content: center;
    }

    .navbar-custom {
        margin-bottom: 0.75rem !important;
    }

    .container.my-5 {
        margin-top: 1rem !important;
        margin-bottom: 1.25rem !important;
    }

    .widget-stat {
        padding: 1rem;
    }

    .widget-stat .h2 {
        font-size: 1.5rem;
    }

    .row.g-4.mb-5 > [class*="col-md-3"] {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .pending-alert-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .pending-alert-banner .btn {
        width: 100%;
    }

    .card-premium:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    footer .container span,
    footer .container small {
        font-size: 0.7rem;
    }
}

/* Cards de reunião no dashboard (mobile) */
.reuniao-cards-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.reuniao-card-mobile {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.reuniao-card-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.reuniao-card-mobile-titulo {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-secondary);
    line-height: 1.35;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.reuniao-card-mobile-meta {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
    word-break: break-word;
}

.reuniao-card-mobile .btn {
    min-height: 2.75rem;
    font-weight: 600;
}

.reuniao-card-mobile-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}

.reuniao-card-mobile--pendencia {
    border-color: #fcd34d;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 28%);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15), var(--shadow-sm);
}

.table-custom tbody tr.reuniao-row-pendencia {
    background-color: #fffbeb;
}

.table-custom tbody tr.reuniao-row-pendencia:hover {
    background-color: #fef3c7;
}

.table-custom tbody tr.reuniao-row-pendencia td:first-child {
    box-shadow: inset 4px 0 0 var(--color-warning);
}

/* Pendências em ata-visualizar (mobile) */
.pendencia-cards-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pendencia-card-mobile {
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    padding: 1rem;
    background: #fff;
}

.pendencia-card-mobile--aberta {
    border-color: #fecaca;
    background: linear-gradient(180deg, #fef2f2 0%, #fff 35%);
    box-shadow: inset 4px 0 0 var(--color-danger);
}

.pendencia-card-mobile--aguardando {
    border-color: #fcd34d;
    background: linear-gradient(180deg, #fffbeb 0%, #fff 35%);
    box-shadow: inset 4px 0 0 var(--color-warning);
}

.pendencia-andamento-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    color: #78350f;
    line-height: 1.4;
}

.pendencia-card-mobile-desc {
    font-weight: 600;
    color: var(--color-secondary);
    line-height: 1.45;
    margin-bottom: 0.75rem;
    word-break: break-word;
}

.pendencia-card-mobile-meta li {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.pendencia-card-mobile .btn {
    min-height: 2.75rem;
    font-weight: 600;
}

#secao-pendencias .card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
}

#texto-conteudo-ata {
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 767.98px) {
    .card-premium,
    .card-premium .card-body {
        overflow: visible;
    }

    .table-responsive-custom {
        overflow-x: visible !important;
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
        padding: 0.25rem 0 calc(0.25rem + env(safe-area-inset-bottom, 0px));
        justify-content: space-around;
        align-items: stretch;
    }

    .mobile-bottom-nav a,
    .mobile-bottom-nav button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.35rem 0.2rem;
        text-decoration: none;
        color: #64748b;
        font-size: 0.65rem;
        font-weight: 600;
        border: none;
        background: transparent;
        min-height: 3.25rem;
    }

    .mobile-bottom-nav a.active,
    .mobile-bottom-nav button.active {
        color: var(--color-primary);
    }

    .mobile-bottom-nav a i,
    .mobile-bottom-nav button i {
        font-size: 1.3rem;
        margin-bottom: 0.1rem;
    }

    /* Tabelas viram cards empilhados */
    .table-stack-mobile thead {
        display: none;
    }

    .table-stack-mobile tbody tr {
        display: block;
        margin: 0.65rem;
        border: 1px solid #e2e8f0;
        border-radius: var(--border-radius);
        background: #fff;
        box-shadow: var(--shadow-sm);
    }

    .table-stack-mobile tbody tr:hover {
        background: #fff;
    }

    .table-stack-mobile tbody td {
        display: block;
        padding: 0.6rem 1rem;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        text-align: left !important;
        width: 100% !important;
    }

    .table-stack-mobile tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0.85rem;
    }

    .table-stack-mobile tbody td[data-label]:not(.cell-card-title)::before {
        content: attr(data-label);
        display: block;
        font-size: 0.68rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #94a3b8;
        margin-bottom: 0.2rem;
    }

    .table-stack-mobile td.cell-card-title {
        padding: 1rem;
        background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
        border-bottom: 1px solid #e2e8f0;
    }

    .table-stack-mobile td.cell-card-title .meta-por {
        display: block;
        margin-top: 0.35rem;
        font-size: 0.8rem;
        color: #64748b;
        line-height: 1.35;
        word-break: break-word;
    }

    .table-stack-mobile td.cell-card-action .btn {
        width: 100%;
        padding: 0.55rem 1rem;
    }

    .table-responsive-custom:has(.table-stack-mobile) {
        border: none;
        background: transparent;
        overflow: visible;
    }

    .table-responsive-custom:has(.table-stack-mobile) .table-stack-mobile {
        border: none;
        margin: 0;
    }

    .table-stack-mobile tbody td[colspan] {
        margin: 0.65rem;
        border-radius: var(--border-radius);
    }

    /* Pendências: cards mais legíveis */
    .pendencia-mobile-card {
        background: #f8fafc;
        border-radius: 10px;
        padding: 1rem;
        margin-bottom: 0.75rem;
        border: 1px solid #e2e8f0;
    }

    .pendencia-mobile-card .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    .dashboard-welcome .btn-premium {
        width: 100%;
    }

    .form-control,
    .form-select {
        font-size: 16px;
    }

    .table-stack-mobile tbody td.d-none {
        display: none !important;
    }

    .ata-acoes-topo .btn {
        flex: 1 1 100%;
        justify-content: center;
    }

    #secao-pendencias .card-body {
        padding: 0.75rem !important;
    }
}
