/* Reset e estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Header */
header {
    padding: 20px;
    background: #2c3e50;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
    font-weight: normal;
}

.print-button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
}

.print-button:hover {
    background: #2980b9;
}

/* Conteúdo principal */
.content {
    padding: 40px;
    min-height: 100vh;
    font-size: 12pt;
    font-family: Arial, sans-serif;
}

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

/* Estilos tipográficos para documentos jurídicos */
.content h1 {
    font-size: 18pt;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: bold;
    text-align: center;
    page-break-after: avoid;
}

.content h2 {
    font-size: 16pt;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-weight: bold;
    page-break-after: avoid;
}

.content h3 {
    font-size: 14pt;
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
    font-weight: bold;
    page-break-after: avoid;
}

.content p {
    margin-bottom: 1rem;
    text-align: justify;
    text-indent: 1.5cm;
}

.content p:first-of-type {
    text-indent: 0;
}

.content ul, .content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.content li {
    margin-bottom: 0.5rem;
}

.content blockquote {
    margin: 1rem 0;
    padding-left: 1.5rem;
    border-left: 3px solid #ccc;
    font-style: italic;
}

.content strong {
    font-weight: bold;
}

.content em {
    font-style: italic;
}

/* Imagens */
.content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    page-break-inside: avoid;
}

/* Vídeos embutidos */
.content .video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    margin: 1.5rem 0;
    page-break-inside: avoid;
}

.content .video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Tabelas */
.content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    page-break-inside: avoid;
}

.content table th,
.content table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

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

/* Código */
.content code {
    background-color: #f4f4f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.content pre {
    background-color: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
    page-break-inside: avoid;
}

.content pre code {
    background-color: transparent;
    padding: 0;
}

/* Separadores */
.content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 2rem 0;
}

/* Estilos para impressão A4 */
@media print {
    @page {
        size: A4;
        margin: 2.5cm 2cm;
    }

    body {
        background: white;
        padding: 0;
    }

    .container {
        max-width: 100%;
        box-shadow: none;
    }

    .print-hidden {
        display: none !important;
    }

    .content {
        padding: 0;
    }

    /* Quebras de página */
    .content h1,
    .content h2 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    .content h3 {
        page-break-after: avoid;
    }

    .content p,
    .content li {
        orphans: 3;
        widows: 3;
    }

    .content img,
    .content .video-embed,
    .content table,
    .content pre {
        page-break-inside: avoid;
    }

    /* Evitar quebras em elementos importantes */
    .content blockquote {
        page-break-inside: avoid;
    }

    /* Espaçamento para impressão */
    .content {
        font-size: 12pt;
    }

    .content h1 {
        font-size: 18pt;
    }

    .content h2 {
        font-size: 16pt;
    }

    .content h3 {
        font-size: 14pt;
    }

    /* Links */
    .content a {
        color: #000;
        text-decoration: underline;
    }

    .content a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

