/**
 * Portal de Transparência - Estilos
 * Área pública do portal municipal
 */

/* ====================================
   VARIÁVEIS E RESET
   ==================================== */

:root {
    --header-height-public: 80px;
    --accessibility-height: 32px;
}

/* Reset para área pública */
.public-page {
    padding-top: var(--accessibility-height);
}

/* Hero section - forçar cor branca nos títulos */
.hero-section h1,
.hero-section p {
    color: #fff;
}

.public-page .sidebar,
.public-page .top-header {
    display: none;
}

/* ====================================
   BARRA DE ACESSIBILIDADE
   ==================================== */

.accessibility-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--accessibility-height);
    background-color: var(--gov-blue-dark, #071D41);
    color: #fff;
    z-index: 2000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.accessibility-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accessibility-links,
.accessibility-external {
    display: flex;
    gap: 10px;
    align-items: center;
}

.accessibility-link {
    color: #fff;
    text-decoration: none;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.accessibility-link:hover,
.accessibility-link:focus {
    background-color: rgba(255, 255, 255, 0.15);
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}

.accesskey {
    font-size: 9px;
    opacity: 0.7;
}

/* ====================================
   HEADER PÚBLICO
   ==================================== */

.public-header {
    position: fixed;
    top: var(--accessibility-height);
    left: 0;
    right: 0;
    height: var(--header-height-public);
    background: linear-gradient(135deg, var(--gov-blue-primary, #1351B4) 0%, var(--gov-blue-dark, #071D41) 100%);
    color: #fff;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Brand */
.header-brand {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: #fff;
}

.brand-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.brand-icon {
    font-size: 40px;
    color: #FFD700;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 18px;
    font-weight: 600;
}

.brand-subtitle {
    font-size: 14px;
    color: #fff;
}

/* Navegação */
.header-nav {
    display: flex;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.nav-link i {
    font-size: 16px;
}

/* Menu Mobile */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
}

/* ====================================
   CONTEÚDO PRINCIPAL
   ==================================== */

.public-main {
    margin-top: calc(var(--accessibility-height) + var(--header-height-public));
    min-height: calc(100vh - var(--accessibility-height) - var(--header-height-public) - 300px);
    padding: 30px 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* ====================================
   CARDS DE ESTATÍSTICAS
   ==================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
}

.stat-icon.blue,
.stat-icon.green,
.stat-icon.orange,
.stat-icon.purple {
    background: linear-gradient(135deg, var(--gov-blue-primary, #1351B4) 0%, var(--gov-blue-dark, #071D41) 100%);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--gov-gray-darkest, #333);
    line-height: 1;
    margin-bottom: 3px;
}

.stat-label {
    font-size: 11px;
    color: var(--gov-gray-dark, #666);
}

/* ====================================
   SEÇÃO DE CONTEÚDO
   ==================================== */

.content-section {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 18px;
    overflow: hidden;
}

.section-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gov-gray-darkest, #333);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--gov-blue-primary, #1351B4);
}

.section-body {
    padding: 12px;
}

/* ====================================
   FILTROS
   ==================================== */

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 140px;
}

.filter-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gov-gray-dark, #666);
    text-transform: uppercase;
}

.filter-select {
    padding: 6px 28px 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") right 10px center no-repeat;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--gov-blue-primary, #1351B4);
    box-shadow: 0 0 0 3px rgba(19, 81, 180, 0.1);
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--gov-blue-primary, #1351B4);
    color: #fff;
}

.btn-primary:hover {
    background: var(--gov-blue-dark, #071D41);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* ====================================
   TABELA DE LICITAÇÕES
   ==================================== */

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gov-gray-dark, #666);
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table td {
    font-size: 12px;
    color: var(--gov-gray-darkest, #333);
}

.table-link {
    color: var(--gov-blue-primary, #1351B4);
    text-decoration: none;
    font-weight: 500;
}

.table-link:hover {
    text-decoration: underline;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
}

.badge-blue { background: #E3F2FD; color: #1565C0; }
.badge-green { background: #E8F5E9; color: #2E7D32; }
.badge-orange { background: #FFF3E0; color: #E65100; }
.badge-red { background: #FFEBEE; color: #C62828; }
.badge-gray { background: #F5F5F5; color: #616161; }
.badge-purple { background: #F3E5F5; color: #7B1FA2; }

/* Objeto - texto completo */
.data-table td.objeto-text,
.objeto-text {
    white-space: normal;
    word-wrap: break-word;
    text-align: justify !important;
}

/* Coluna mobile - escondida por padrão no desktop */
.data-table th.col-info-mobile,
.data-table td.col-info-mobile {
    display: none;
}

/* Badge de modalidade dentro da coluna processo - oculto no desktop */
.mobile-badge {
    display: none;
}

/* Link no objeto - estilo discreto */
.objeto-link {
    color: inherit;
    text-decoration: none;
}

.objeto-link:hover {
    color: var(--gov-blue-primary, #1351B4);
    text-decoration: underline;
}

/* Estilo da coluna combinada (sempre definido, visível só em mobile) */
.info-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-stack .info-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ====================================
   PAGINAÇÃO
   ==================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 20px;
    border-top: 1px solid #eee;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: var(--gov-gray-dark, #666);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 12px;
}

.pagination-btn:hover:not(.active):not(:disabled) {
    background: #f0f0f0;
    border-color: #ccc;
}

.pagination-btn.active {
    background: var(--gov-blue-primary, #1351B4);
    border-color: var(--gov-blue-primary, #1351B4);
    color: #fff;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    margin: 0 15px;
    font-size: 14px;
    color: var(--gov-gray-dark, #666);
}

/* ====================================
   DETALHES DA LICITAÇÃO
   ==================================== */

.detail-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--gov-blue-primary, #1351B4) 0%, var(--gov-blue-dark, #071D41) 100%);
    color: #fff;
}

.detail-processo {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.detail-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 15px 0;
    line-height: 1.4;
    color: #fff;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.detail-meta-item i {
    opacity: 0.8;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.info-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.info-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gov-gray-dark, #666);
    margin-bottom: 4px;
}

.info-value {
    font-size: 13px;
    color: var(--gov-gray-darkest, #333);
}

/* Timeline de Movimentações */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e0e0e0;
}

.timeline-item {
    position: relative;
    padding-bottom: 25px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -26px;
    top: 13px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gov-blue-primary, #1351B4);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px var(--gov-blue-primary, #1351B4);
}

.timeline-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background-color 0.2s;
}

.timeline-content[data-link] {
    cursor: pointer;
}

.timeline-content[data-link]:hover {
    background: #e9ecef;
}

.timeline-date {
    font-size: 12px;
    color: var(--gov-gray-dark, #666);
    margin-bottom: 0;
    white-space: nowrap;
    min-width: 140px;
}

.timeline-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--gov-gray-darkest, #333);
    margin-bottom: 0;
    flex: 1;
}

.timeline-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gov-blue-primary, #1351B4);
    text-decoration: none;
}

.timeline-link:hover {
    text-decoration: underline;
}

/* ====================================
   MENSAGENS
   ==================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gov-gray-dark, #666);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

.loading {
    text-align: center;
    padding: 40px;
}

.loading i {
    font-size: 32px;
    color: var(--gov-blue-primary, #1351B4);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ====================================
   FOOTER PÚBLICO
   ==================================== */

.public-footer {
    background: linear-gradient(135deg, var(--gov-blue-dark, #071D41) 0%, #0a2a5c 100%);
    color: #fff;
    padding: 30px 0 15px;
    margin-top: 35px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-logo {
    opacity: 0.7;
    height: 70px;
    width: auto;
}

.footer-icon {
    font-size: 32px;
    color: #FFD700;
}

.footer-brand-text {
    display: flex;
    flex-direction: column;
}

.footer-brand-name {
    font-size: 13px;
    font-weight: 600;
}

.footer-brand-subtitle {
    font-size: 11px;
    opacity: 0.8;
}

.footer-text {
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.9;
    margin: 0;
}

.footer-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #FFD700;
    margin: 0 0 6px 0;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links li {
    margin-bottom: 6px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s, padding-left 0.2s;
}

.footer-links a:hover {
    color: #FFD700;
    padding-left: 5px;
}

.footer-links a i {
    width: 16px;
}

.footer-contact {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.footer-contact i {
    color: #FFD700;
    margin-top: 2px;
    width: 16px;
    font-size: 12px;
}

.footer-social {
    display: flex;
    gap: 10px;
}

.footer-social a {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s;
}

.footer-social a:hover {
    background: #FFD700;
    color: var(--gov-blue-dark, #071D41);
    transform: translateY(-3px);
}

.footer-divider {
    height: 1px;
    background: rgba(255, 215, 0, 0.3);
    margin-bottom: 12px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
}

.footer-copyright {
    margin: 0;
    opacity: 0.7;
}

.footer-credits {
    margin: 0;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mediaware-brand {
    font-weight: 600;
    color: #FFD700;
}

/* ====================================
   RESPONSIVO
   ==================================== */

@media (max-width: 992px) {
    /* Menu mobile - escondido por padrão */
    .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, var(--gov-blue-primary, #1351B4) 0%, var(--gov-blue-dark, #071D41) 100%);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        padding: 10px 0;
    }

    /* Menu mobile - visível quando ativo */
    .header-nav.active {
        display: block;
    }

    .header-nav .nav-menu {
        flex-direction: column;
        gap: 0;
    }

    .header-nav .nav-link {
        padding: 15px 20px;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .header-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .accessibility-bar {
        display: none;
    }

    /* Ocultar seção de modalidade em mobile */
    .section-modalidade {
        display: none;
    }

    .public-header {
        top: 0;
        height: 60px;
    }

    .public-main {
        margin-top: 60px;
        padding: 12px 10px;
    }

    .brand-text {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        padding: 10px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
        font-size: 11px;
    }

    /* Tabela responsiva - esconder colunas individuais em mobile */
    .data-table th.col-modalidade,
    .data-table td.col-modalidade,
    .data-table th.col-orgao,
    .data-table td.col-orgao,
    .data-table th.col-situacao,
    .data-table td.col-situacao,
    .data-table th.col-data,
    .data-table td.col-data,
    .data-table th.col-acoes,
    .data-table td.col-acoes {
        display: none;
    }

    /* Mostrar colunas combinadas em mobile */
    .data-table th.col-info-mobile,
    .data-table td.col-info-mobile {
        display: table-cell;
    }

    /* Mostrar badge da modalidade abaixo do processo em mobile */
    .mobile-badge {
        display: block;
        margin-top: 4px;
    }

    /* Centralizar coluna processo (2ª) e coluna info em mobile */
    .data-table td:nth-child(2),
    .data-table td.col-info-mobile {
        text-align: center;
    }

    .info-stack {
        align-items: center;
    }

    .info-stack .info-row {
        justify-content: center;
    }

    .detail-header {
        padding: 12px;
    }

    .detail-title {
        font-size: 14px;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-main {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* ====================================
   ALTO CONTRASTE
   ==================================== */

body.high-contrast {
    filter: contrast(1.3);
}

body.high-contrast .accessibility-bar {
    background-color: #000;
    border-bottom: 3px solid #ff0;
}

body.high-contrast .public-header {
    background: #000;
}

body.high-contrast .content-section,
body.high-contrast .stat-card {
    border: 2px solid #000;
}

/* ====================================
   PRINT
   ==================================== */

@media print {
    .accessibility-bar,
    .public-header,
    .public-footer,
    .filters-bar,
    .pagination {
        display: none !important;
    }

    .public-main {
        margin-top: 0;
    }

    .content-section {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
