/* ========================================
   Estilos para páginas de artigos - SV Revestimentos
   Responsivo e otimizado para todas as telas
   ======================================== */

/* ========== HEADER DO ARTIGO ========== */
.page-header {
    background: linear-gradient(135deg, #003555 0%, #0d47a1 100%);
    min-height: 300px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 60px 0;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.03) 10px,
        rgba(255,255,255,0.03) 20px
    );
}

.page-header .container {
    position: relative;
    z-index: 1;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

/* ========== CONTEÚDO DO ARTIGO ========== */
article.bg-white {
    border-radius: 12px;
    background: white;
    padding: 40px;
}

article h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1.2rem;
    color: #003555;
    line-height: 1.4;
    scroll-margin-top: 100px; /* Para scroll suave com navbar fixa */
}

article h2:first-of-type {
    margin-top: 0;
}

article h2#introducao {
    font-size: 1.9rem;
    color: #0d47a1;
}

article h2.text-primary {
    color: #003555 !important;
    border-left: 4px solid #003555;
    padding-left: 15px;
}

article p {
    font-size: 1.1rem;
    line-height: 1.9;
    color: #333;
    margin-bottom: 1.5rem;
    text-align: justify;
}

article img {
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    max-width: 100%;
    height: auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

article img:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

article .img-fluid {
    display: block;
    margin: 30px auto;
}

/* Caixa de destaque/conclusão */
article .border-start {
    background: linear-gradient(135deg, rgba(0, 53, 85, 0.03) 0%, rgba(13, 71, 161, 0.05) 100%);
    border-left: 4px solid #003555 !important;
    padding: 25px;
    border-radius: 8px;
    margin: 30px 0;
}

article .border-start p:last-child {
    margin-bottom: 0;
}

article .border-start a {
    color: #003555;
    font-weight: 600;
    text-decoration: underline;
}

article .border-start a:hover {
    color: #0d47a1;
}

/* ========== SIDEBAR - SUMÁRIO ========== */
.bg-artigo {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 20px;
}

.sticky-container,
aside.sidebar-sumario {
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 10;
    align-self: flex-start;
}

/* Força o parent a permitir sticky */
.row {
    display: flex;
    flex-wrap: wrap;
}

.col-md-2 {
    flex: 0 0 auto;
}

/* Scrollbar customizada para o sumário */
.sticky-container::-webkit-scrollbar,
aside.sidebar-sumario::-webkit-scrollbar {
    width: 6px;
}

.sticky-container::-webkit-scrollbar-track,
aside.sidebar-sumario::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sticky-container::-webkit-scrollbar-thumb,
aside.sidebar-sumario::-webkit-scrollbar-thumb {
    background: #003555;
    border-radius: 10px;
}

.sticky-container::-webkit-scrollbar-thumb:hover,
aside.sidebar-sumario::-webkit-scrollbar-thumb:hover {
    background: #0d47a1;
}

.sticky-container h5,
aside.sidebar-sumario h5 {
    color: #003555;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #003555;
    word-wrap: break-word;
}

.sticky-container ul,
aside.sidebar-sumario ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sticky-container li,
aside.sidebar-sumario li {
    margin-bottom: 0.75rem;
}

.sticky-container li a,
aside.sidebar-sumario li a {
    color: #0d47a1;
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.5;
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 25px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.sticky-container li a::before,
aside.sidebar-sumario li a::before {
    content: '▸';
    position: absolute;
    left: 8px;
    color: #003555;
    transition: transform 0.3s ease;
}

.sticky-container li a:hover,
aside.sidebar-sumario li a:hover {
    background: rgba(0, 53, 85, 0.08);
    color: #003555;
    transform: translateX(5px);
}

.sticky-container li a:hover::before,
aside.sidebar-sumario li a:hover::before {
    transform: translateX(3px);
}

.topic-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 12px;
    background: white;
}

.topic-item:hover {
    background: rgba(0, 53, 85, 0.05);
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.topic-image {
    width: 60px;
    height: 60px;
    min-width: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.topic-text {
    font-size: 0.85rem;
    color: #0d47a1;
    text-decoration: none;
    font-weight: 500;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex: 1;
}

.topic-text:hover {
    color: #003555;
    text-decoration: underline;
}

/* Cards de artigos */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    background: white;
}

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

.card-img-top {
    height: 220px;
    object-fit: cover;
    width: 100%;
    transition: transform 0.3s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

.card-body {
    min-height: 100px;
}

.btn-outline-primary {
    border: 2px solid #003555;
    color: #003555;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background-color: #003555;
    color: white;
    border-color: #003555;
    transform: scale(1.05);
}

/* ========== MAPA DO SITE ========== */
.mapa-do-site {
    padding-left: 0;
    list-style: none;
}

.mapa-do-site > li {
    margin-bottom: 1.5rem;
}

.mapa-do-site > li > a {
    font-size: 1.3rem;
    font-weight: 600;
}

.mapa-do-site li {
    margin-bottom: 0.75rem;
}

.mapa-do-site a {
    color: #0d47a1;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.mapa-do-site a:hover {
    color: #003555;
    text-decoration: underline;
    transform: translateX(5px);
}

.mapa-do-site ul {
    list-style: none;
    padding-left: 25px;
    margin-top: 10px;
}

.mapa-do-site ul li a {
    font-size: 1rem;
    color: #666;
}

.mapa-do-site ul li a:hover {
    color: #003555;
}

/* ========== UTILITÁRIOS ========== */
.container-xxl {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

.text-primary {
    color: #003555 !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.shadow {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

.rounded {
    border-radius: 12px !important;
}

/* ========== ANIMAÇÕES ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fadeIn {
    animation: fadeIn 0.6s ease-out;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* ========== RESPONSIVIDADE ========== */

/* Tablets e dispositivos médios (768px - 1024px) */
@media (max-width: 1024px) {
    .page-header h1 {
        font-size: 2rem;
    }
    
    article.bg-white {
        padding: 30px;
    }
    
    article h2 {
        font-size: 1.6rem;
    }
    
    .sticky-container {
        top: 80px;
        max-height: calc(100vh - 100px);
    }
}

/* Tablets portrait e smartphones landscape (max-width: 768px) */
@media (max-width: 768px) {
    .page-header {
        min-height: 200px;
        padding: 40px 0;
    }
    
    .page-header h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    /* Sidebar vira bloco normal em mobile */
    .sticky-container {
        position: relative !important;
        top: 0 !important;
        max-height: none !important;
        margin-bottom: 30px;
        align-self: auto !important;
    }
    
    /* Row volta ao normal em mobile */
    .row {
        display: block;
    }
    
    .col-md-2,
    .col-md-8 {
        width: 100%;
        max-width: 100%;
        flex: none;
    }
    
    /* Artigo */
    article.bg-white {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    article h2 {
        font-size: 1.4rem;
        margin-top: 2rem;
    }
    
    article h2#introducao {
        font-size: 1.6rem;
    }
    
    article p {
        font-size: 1rem;
        line-height: 1.7;
        text-align: left;
    }
    
    article img {
        margin: 20px auto;
    }
    
    /* Cards em mobile */
    .card-img-top {
        height: 180px;
    }
    
    .card-body {
        padding: 20px;
        min-height: auto;
    }
    
    .card-title {
        font-size: 1.05rem;
    }
    
    .card-footer {
        padding: 0 20px 20px;
    }
    
    .btn-outline-primary {
        padding: 10px 25px;
        font-size: 0.95rem;
    }
    
    /* Tópicos complementares */
    .topic-image {
        width: 60px;
        height: 60px;
    }
    
    .topic-text {
        font-size: 0.9rem;
    }
    
    /* Container */
    .container-xxl {
        padding: 0 15px;
    }
}

/* Smartphones portrait (max-width: 576px) */
@media (max-width: 576px) {
    .page-header {
        min-height: 180px;
        padding: 30px 0;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    article.bg-white {
        padding: 15px;
    }
    
    article h2 {
        font-size: 1.25rem;
        margin-top: 1.5rem;
        padding-left: 10px;
    }
    
    article h2#introducao {
        font-size: 1.4rem;
    }
    
    article p {
        font-size: 0.95rem;
    }
    
    article .border-start {
        padding: 15px;
        margin: 20px 0;
    }
    
    /* Cards responsivos */
    .card-img-top {
        height: 200px;
    }
    
    /* Grid de artigos em coluna única */
    .artigos-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Sumário em mobile */
    .sticky-container h5 {
        font-size: 1.1rem;
    }
    
    .sticky-container li a {
        font-size: 0.9rem;
        padding: 6px 10px;
        padding-left: 22px;
    }
}

/* Telas muito pequenas (max-width: 375px) */
@media (max-width: 375px) {
    .page-header h1 {
        font-size: 1.3rem;
    }
    
    article h2 {
        font-size: 1.15rem;
    }
    
    article p {
        font-size: 0.9rem;
    }
    
    .btn-outline-primary {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
}

/* ========== IMPRESSÃO ========== */
@media print {
    .sticky-container,
    .page-header,
    .btn-outline-primary {
        display: none !important;
    }
    
    article.bg-white {
        box-shadow: none;
        padding: 0;
    }
    
    article h2 {
        page-break-after: avoid;
    }
    
    article img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}