* {
    scroll-behavior: smooth;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

button, input, select, textarea {
    font-family: 'Inter', sans-serif;
}

.print-placeholder {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px dashed #3b82f6;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    color: #1e40af;
    font-weight: 500;
    margin: 1.5rem 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.print-placeholder::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.print-placeholder:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
}

.section-content {
    display: none;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-content.active {
    display: block;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(8px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.tab-button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border: none;
    background: transparent;
    cursor: pointer;
}

.tab-button.active {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}

.tab-button:hover:not(.active) {
    background-color: #f5f5f5;
    color: #4b5563;
}

.sidebar-link {
    transition: all 0.2s ease;
    position: relative;
    border-radius: 6px;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-link:hover {
    background-color: #eef2ff;
    color: #4f46e5;
    transform: translateX(2px);
}

.sidebar-link.active {
    background: #eef2ff;
    border-left-color: #4f46e5;
    padding-left: 1.25rem;
    font-weight: 600;
    color: #3730a3;
}

.sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-link.active .sidebar-icon {
    opacity: 1;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Botão voltar ao topo */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    animation: fadeInUp 0.3s ease-out;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.back-to-top:active {
    transform: translateY(-2px) scale(0.95);
}

.back-to-top.show {
    display: flex;
    animation: fadeInUp 0.3s ease-out;
}

.back-to-top.clicked {
    animation: scrollUpAnimation 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scrollUpAnimation {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-15px) scale(1.1);
        box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Sidebar fixo */
.sidebar {
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
    will-change: width, transform;
}

/* Desktop: sidebar sempre visível */
@media (min-width: 1025px) {
    .sidebar {
        left: 0 !important;
    }
    
    /* Sidebar minimizado no desktop */
    .sidebar.minimized {
        width: 80px !important;
    }
    
    .sidebar.minimized .sidebar-title-text {
        opacity: 0;
        width: 0;
        overflow: hidden;
        display: none;
    }
    
    .sidebar.minimized .sidebar-nav span:not(.sidebar-icon) {
        opacity: 0;
        width: 0;
        overflow: hidden;
        display: none;
    }
    
    .sidebar.minimized .sidebar-icon {
        opacity: 1 !important;
        display: inline-flex !important;
    }
    
    .sidebar.minimized .sidebar-title {
        justify-content: center;
    }
    
    .sidebar.minimized .sidebar-toggle-desktop svg {
        transform: rotate(180deg);
    }
    
    .sidebar.minimized .sidebar-nav a {
        justify-content: center;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        position: relative;
        min-width: 48px;
    }
    
    .sidebar.minimized .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .sidebar.minimized .sidebar-content {
        padding: 1.5rem 0.75rem;
    }
    
    .sidebar.minimized .sidebar-nav a {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar.minimized .sidebar-nav a:hover::after {
        content: attr(data-title);
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        margin-left: 0.75rem;
        background: #1f2937;
        color: white;
        padding: 0.5rem 0.75rem;
        border-radius: 0.375rem;
        font-size: 0.875rem;
        white-space: nowrap;
        z-index: 1000;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        pointer-events: none;
    }
    
    .sidebar.minimized .sidebar-nav a:hover::before {
        content: '';
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        margin-left: 0.5rem;
        border: 6px solid transparent;
        border-right-color: #1f2937;
        z-index: 1001;
        pointer-events: none;
    }
    
    /* Ajustar conteúdo quando sidebar minimizado */
    .main-content.sidebar-minimized {
        margin-left: 80px;
    }
}

.sidebar nav {
    padding-right: 0.5rem;
}

.sidebar-title-text {
    transition: opacity 0.3s ease;
}

.sidebar-nav {
    transition: opacity 0.3s ease;
}

.sidebar-content {
    transition: all 0.3s ease;
}

.main-content {
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: calc(100vh - 4rem);
    will-change: margin-left;
}

/* Melhorar performance de scroll */
.sidebar,
.main-content {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Ajuste do header para ficar acima do sidebar */
header {
    z-index: 50;
}

/* Menu mobile */
.mobile-menu-toggle {
    display: none;
}

@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed !important;
        top: 4rem !important;
        left: -100% !important;
        width: 280px;
        height: calc(100vh - 4rem);
        background: white;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        overflow-y: auto;
        border-right: 1px solid #e5e7eb;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar.open {
        left: 0 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 4rem;
        left: 0;
        width: 100%;
        height: calc(100vh - 4rem);
        background: rgba(0,0,0,0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        pointer-events: none;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: opacity 0.2s ease, visibility 0s 0s;
    }
}

/* Busca mobile */
#mobileSearch {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards melhorados */
.info-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    transition: all 0.3s ease;
}

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

/* Melhorias de tipografia */
h2 {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

/* Esconder scrollbar em mobile para tabs */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Animações de entrada */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Badges e tags */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
}

.print-placeholder img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto;
}

/* Garantir que todas as imagens sejam responsivas */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Melhorias de responsividade - Mobile First */
@media (max-width: 640px) {
    /* Header mobile */
    header {
        position: relative;
    }
    
    header .h-16 {
        height: 4rem;
        min-height: 4rem;
    }
    
    header .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    header .flex {
        gap: 0.5rem;
        flex-wrap: nowrap;
    }
    
    /* Logo e título no header */
    header .min-w-0 {
        flex: 1;
        min-width: 0;
    }
    
    header .min-w-0 h1 {
        font-size: 0.875rem !important;
        line-height: 1.2;
    }
    
    header .min-w-0 p {
        font-size: 0.625rem !important;
    }
    
    header .w-10 {
        width: 2rem;
        height: 2rem;
        flex-shrink: 0;
    }
    
    header .w-10 span {
        font-size: 0.875rem;
    }
    
    /* Botões do header mobile */
    header .shrink-0 {
        display: flex;
        gap: 0.25rem;
        flex-shrink: 0;
    }
    
    header button:not(.mobile-menu-toggle):not([onclick="toggleMobileSearch()"]) {
        display: none !important;
    }
    
    /* Busca mobile */
    #mobileSearch {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 40;
    }
    
    /* Ajustar altura do sidebar no mobile */
    .sidebar {
        top: 4rem;
    }
    
    /* Sidebar mobile melhorado */
    .sidebar {
        width: 85vw !important;
        max-width: 320px;
    }
    
    .sidebar .p-6 {
        padding: 1rem;
    }
    
    .sidebar h3 {
        font-size: 1rem;
    }
    
    .sidebar-link {
        padding: 0.75rem 0.875rem !important;
        font-size: 0.875rem;
    }
    
    /* Conteúdo principal mobile */
    .main-content {
        padding-top: 1rem;
    }
    
    .main-content .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Dropdown mobile */
    #sectionDropdown {
        padding-right: 2.5rem;
        min-height: 48px;
        font-size: 1rem;
        line-height: 1.5;
        color: #111827;
        background-color: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        transition: all 0.2s ease;
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        cursor: pointer;
    }
    
    #sectionDropdown:hover {
        border-color: #d1d5db;
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    }
    
    #sectionDropdown:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }
    
    #sectionDropdown option {
        padding: 0.5rem;
        font-size: 1rem;
    }
    
    /* Label do dropdown */
    label.relative.block {
        position: relative;
    }
    
    /* Ícone customizado do dropdown (esconder o padrão) */
    label.relative.block > span {
        pointer-events: none;
    }
    
    /* Tabs desktop (mantidas) */
    .tab-button {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
        min-width: auto;
        flex-shrink: 0;
        white-space: nowrap;
        transition: all 0.2s ease;
    }
    
    .tab-button span:first-child {
        font-size: 1.125rem;
        flex-shrink: 0;
    }
    
    /* Container de tabs desktop */
    .bg-white.rounded-lg.border {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    /* Melhorar scroll das tabs */
    .overflow-x-auto {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Espaçamento das tabs no desktop */
    .flex.gap-2 {
        gap: 0.5rem;
    }
    
    /* Melhorar visualização das tabs ativas no desktop */
    .tab-button.active {
        background: #eef2ff !important;
        color: #4338ca !important;
        font-weight: 600 !important;
        box-shadow: 0 2px 4px rgba(67, 56, 202, 0.1);
    }
    
    /* Títulos mobile */
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.25rem !important;
        line-height: 1.4;
    }
    
    h4 {
        font-size: 1.125rem !important;
        line-height: 1.4;
    }
    
    /* Cards e conteúdo mobile */
    .bg-white.rounded-xl {
        padding: 1rem !important;
        border-radius: 0.75rem !important;
    }
    
    .info-card {
        padding: 1rem !important;
        margin: 0.75rem 0;
    }
    
    .print-placeholder {
        padding: 1rem !important;
        margin: 1rem 0;
        border-radius: 0.5rem;
    }
    
    .print-placeholder img {
        border-radius: 0.5rem;
        width: 100%;
        max-width: 100%;
    }
    
    .print-placeholder img + img {
        margin-top: 0.75rem;
    }
    
    /* Espaçamentos mobile */
    .mb-8 {
        margin-bottom: 1.5rem !important;
    }
    
    .mb-6 {
        margin-bottom: 1.25rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .mt-8 {
        margin-top: 1.5rem !important;
    }
    
    .mt-6 {
        margin-top: 1.25rem !important;
    }
    
    .py-8 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    /* Listas mobile */
    ol, ul {
        padding-left: 1.25rem;
    }
    
    li {
        margin-bottom: 0.5rem;
        line-height: 1.6;
    }
    
    /* Prose mobile */
    .prose {
        font-size: 0.9375rem;
        line-height: 1.7;
    }
    
    .prose p {
        margin-bottom: 1rem;
    }
    
    /* Botão voltar ao topo mobile */
    .back-to-top {
        width: 44px;
        height: 44px;
        bottom: 1.25rem;
        right: 1.25rem;
    }
    
    .back-to-top svg {
        width: 1.25rem;
        height: 1.25rem;
    }
    
}

    
    /* Alerts e boxes mobile */
    .bg-green-50,
    .bg-yellow-50,
    .bg-blue-50,
    .bg-red-50 {
        padding: 0.875rem !important;
        margin: 0.75rem 0;
    }
    
    /* Border mobile */
    .border-b-2 {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
}

/* Tablet e mobile médio */
@media (min-width: 641px) and (max-width: 768px) {
    .container {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    
    h1 {
        font-size: 2.25rem !important;
    }
    
    h2 {
        font-size: 1.875rem !important;
    }
    
    .tab-button {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .print-placeholder {
        padding: 2rem;
    }
    
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}

/* Melhorias de responsividade - Mobile geral */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Garantir que imagens sejam responsivas */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    /* Imagens múltiplas em print-placeholder */
    .print-placeholder img + img {
        margin-top: 1rem;
    }
    
    /* Tabelas mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        margin: 1rem 0;
        border-collapse: collapse;
    }
    
    table thead {
        display: table-header-group;
    }
    
    table tbody {
        display: table-row-group;
    }
    
    table tr {
        display: table-row;
    }
    
    table th,
    table td {
        display: table-cell;
        padding: 0.5rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    /* Código mobile */
    pre, code {
        overflow-x: auto;
        word-wrap: break-word;
        -webkit-overflow-scrolling: touch;
    }
    
    pre {
        padding: 0.75rem;
        font-size: 0.8125rem;
        border-radius: 0.5rem;
    }
    
    code {
        font-size: 0.875rem;
        padding: 0.125rem 0.375rem;
    }
    
    /* Vídeos e iframes mobile */
    iframe,
    video,
    embed {
        max-width: 100%;
        height: auto;
    }
    
    /* Links mobile */
    a {
        word-break: break-word;
    }
    
    /* Blocos de citação e alertas mobile */
    blockquote {
        padding: 0.75rem 1rem;
        margin: 1rem 0;
        font-size: 0.9375rem;
        border-left-width: 3px;
    }
    
    /* Espaçamento entre seções mobile */
    .mb-12 {
        margin-bottom: 2rem !important;
    }
    
    /* Prose melhorado para mobile */
    .prose ul,
    .prose ol {
        padding-left: 1.5rem;
    }
    
    .prose ul li,
    .prose ol li {
        margin-bottom: 0.5rem;
    }
    
    .prose ul ul,
    .prose ol ol,
    .prose ul ol,
    .prose ol ul {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

/* Melhorias de acessibilidade */
.tab-button:focus,
.sidebar-link:focus,
.back-to-top:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Estilos para busca */
.search-highlight {
    background-color: #fef08a;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 600;
    color: #92400e;
}

.search-result {
    animation: highlightFade 0.5s ease;
}

@keyframes highlightFade {
    0% {
        background-color: rgba(59, 130, 246, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

.search-info {
    margin-bottom: 1rem;
}

.search-info button {
    transition: all 0.2s ease;
}

.search-info button:hover {
    text-decoration: underline;
}

/* Melhorias de impressão */
@media print {
    .sidebar,
    .back-to-top,
    .mobile-menu-toggle,
    .tab-button,
    .search-info {
        display: none !important;
    }
    
    .section-content {
        display: block !important;
    }
    
    .search-highlight {
        background-color: transparent;
        padding: 0;
        font-weight: normal;
        color: inherit;
    }
}