#roteiro-sidebar {
    display: flex;
    position: absolute;
    width: 440px;
    max-width: 90vw;
    height: 100%;
    flex-direction: column;

    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    border-right: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 4px 0 20px rgba(15, 23, 42, 0.06);

    user-select: none;
    cursor: default;
    padding: 22px 24px 26px 24px;

    z-index: 1000;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s ease;
}

#roteiro-sidebar.collapsed {
    width: 64px !important;
    min-width: 64px;
    overflow: hidden;
    padding: 24px 10px;
    box-shadow: 2px 0 8px rgba(15, 23, 42, 0.04);
}

#roteiro-sidebar.collapsed .sidebar-header,
#roteiro-sidebar.collapsed .sidebar-content,
#roteiro-sidebar.collapsed #sidebar-filter-options {
    display: none !important;
}

/* ================================================= */
/*                     Cabeçalho                     */
/* ================================================= */

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    padding-right: 44px; /* Reserva espaço para o botão X interno */
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-title-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header-icon {
    font-size: 1.4rem;
    color: #0284c7;
    background: #e0f2fe;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-header h3 {
    font-weight: 700;
    font-size: 1.3rem;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin: 0;
}

/* Campo de busca estilizado */
.sidebar-search-wrapper {
    position: relative;
    width: 100%;
}

.sidebar-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
    transition: color 0.2s ease;
}

#sidebar-search-input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    background-color: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.92rem;
    color: #0f172a;
    outline: none;
    transition: all 0.2s ease;
}

#sidebar-search-input::placeholder {
    color: #94a3b8;
}

#sidebar-search-input:focus {
    background-color: #ffffff;
    border-color: #0284c7;
}

#sidebar-search-input:focus + .sidebar-search-icon,
.sidebar-search-wrapper:focus-within .sidebar-search-icon {
    color: #0284c7;
}

/* Botão de filtro */
#sidebar-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-start;
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#sidebar-filter-btn:hover {
    background: #0369a1;
    transform: translateY(-1px);
}

#sidebar-filter-btn:active {
    transform: translateY(0);
}

#sidebar-filter-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 4px;
    margin-bottom: 12px;
}

.filter-category-btn {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
    padding: 7px 16px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: center;
    line-height: 1.35;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.filter-category-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.filter-category-btn.filter-btn-active {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

/* ================================================= */
/*                Conteúdo e Lista de Atividades      */
/* ================================================= */

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

#sidebar-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Card Individual do Atrativo */
.sidebar-item {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-height: 220px;
}

.sidebar-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.09);
    border-color: #bae6fd;
}

.sidebar-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background-color: #f1f5f9;
    transition: transform 0.35s ease;
}

.sidebar-item:hover img {
    transform: scale(1.05);
}

.sidebar-item-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px 14px;
    gap: 8px;
    flex: 1;
    background: #ffffff;
    z-index: 2;
}

.sidebar-item-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
}

.sidebar-item-category {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: #0369a1;
    background-color: #e0f2fe;
    padding: 4px 10px;
    border-radius: 14px;
    width: max-content;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================================= */
/*                Empty State (Sem destinos)         */
/* ================================================= */
.sidebar-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #ffffff;
    border-radius: 16px;
    padding: 3rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #f1f5f9;
    margin-top: 1rem;
}

.sidebar-empty-state i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.sidebar-empty-state h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.5rem;
}

.sidebar-empty-state p {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ================================================= */
/*            Botão Flutuante de Toggle              */
/* ================================================= */

#sidebar-toggle-btn {
    position: absolute;
    top: 22px;
    z-index: 1100;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0284c7;
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

#sidebar-toggle-btn:hover {
    transform: scale(1.05);
    background: #0369a1;
}

/* Ícone de barras no estado recolhido (centralizado na barra fechada) */
#sidebar-toggle-btn.collapsed {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    background: #0284c7;
}

#sidebar-toggle-btn.collapsed .sidebar-toggle-icon::before {
    content: "\f0c9"; /* FontAwesome fa-bars */
}

/* Ícone de X no estado expandido/aberto: Posicionado DENTRO no canto superior direito */
#sidebar-toggle-btn.expanded {
    right: 20px !important;
    left: auto !important;
    top: 22px !important;
    transform: none !important;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    box-shadow: none;
}

#sidebar-toggle-btn.expanded:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

#sidebar-toggle-btn.expanded .sidebar-toggle-icon::before {
    content: "\f00d"; /* FontAwesome fa-times (X) */
}

#sidebar-toggle-btn .sidebar-toggle-icon {
    transition: transform 0.25s ease;
}

#sidebar-toggle-btn.expanded .sidebar-toggle-icon {
    transform: rotate(90deg);
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* ================================================= */
/*                  Responsividade                   */
/* ================================================= */

@media (max-width: 768px) {
    #roteiro-sidebar {
        width: 340px;
        padding: 18px 18px 22px 18px;
    }
    
    #sidebar-list {
        grid-template-columns: 1fr;
    }
    
    .sidebar-item img {
        height: 150px;
    }
}

@media (max-width: 480px) {
    #roteiro-sidebar {
        width: 88vw;
    }
}
